Thanks for all the hints. In practice, I’m not going to code serious games. My area of interest is using Panda3D for the demoscene. And I even managed to achieve something with Panda3D:
But now I just dreamed of creating more advanced effects.
I ran this code which prints "notify-level-glgsg debug". I don’t understand much of it, but here’s what turned out:
/Users/miklesz/PycharmProjects/Demo2023/venv/bin/python /Users/miklesz/PycharmProjects/Demo2023/volumetric_4.py
Known pipe types:
CocoaGraphicsPipe
(all display modules loaded.)
:display:gsg:glgsg(debug): GL_VENDOR = Apple
:display:gsg:glgsg(debug): GL_RENDERER = Apple M1
:display:gsg:glgsg(debug): GL_VERSION = 2.1 Metal - 76.3
:display:gsg:glgsg(debug): GL_VERSION decoded to: 2.1
:display:gsg:glgsg(debug): GL_SHADING_LANGUAGE_VERSION = 1.20
:display:gsg:glgsg(debug): Detected GLSL version: 1.20
:display:gsg:glgsg(debug): Using compatibility profile
:display:gsg:glgsg(debug): GL Extensions:
GL_APPLE_aux_depth_stencil GL_APPLE_client_storage
GL_APPLE_element_array GL_APPLE_fence
GL_APPLE_float_pixels GL_APPLE_flush_buffer_range
GL_APPLE_flush_render GL_APPLE_packed_pixels
GL_APPLE_pixel_buffer GL_APPLE_rgb_422
GL_APPLE_row_bytes GL_APPLE_specular_vector
GL_APPLE_texture_range GL_APPLE_transform_hint
GL_APPLE_vertex_array_object GL_APPLE_vertex_point_size
GL_APPLE_vertex_program_evaluators GL_APPLE_ycbcr_422
GL_ARB_color_buffer_float GL_ARB_depth_buffer_float
GL_ARB_depth_clamp GL_ARB_depth_texture
GL_ARB_draw_buffers GL_ARB_draw_elements_base_vertex
GL_ARB_draw_instanced GL_ARB_fragment_program
GL_ARB_fragment_program_shadow GL_ARB_fragment_shader
GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB
GL_ARB_half_float_pixel GL_ARB_half_float_vertex
GL_ARB_imaging GL_ARB_instanced_arrays
GL_ARB_multisample GL_ARB_multitexture
GL_ARB_occlusion_query GL_ARB_pixel_buffer_object
GL_ARB_point_parameters GL_ARB_point_sprite
GL_ARB_provoking_vertex GL_ARB_seamless_cube_map
GL_ARB_shader_objects GL_ARB_shader_texture_lod
GL_ARB_shading_language_100 GL_ARB_shadow
GL_ARB_shadow_ambient GL_ARB_sync
GL_ARB_texture_border_clamp GL_ARB_texture_compression
GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map
GL_ARB_texture_env_add GL_ARB_texture_env_combine
GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3
GL_ARB_texture_float GL_ARB_texture_mirrored_repeat
GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle
GL_ARB_texture_rg GL_ARB_transpose_matrix
GL_ARB_vertex_array_bgra GL_ARB_vertex_blend
GL_ARB_vertex_buffer_object GL_ARB_vertex_program
GL_ARB_vertex_shader GL_ARB_window_pos
GL_ATI_separate_stencil GL_ATI_texture_env_combine3
GL_ATI_texture_float GL_EXT_abgr
GL_EXT_bgra GL_EXT_bindable_uniform
GL_EXT_blend_color GL_EXT_blend_equation_separate
GL_EXT_blend_func_separate GL_EXT_blend_minmax
GL_EXT_blend_subtract GL_EXT_clip_volume_hint
GL_EXT_debug_label GL_EXT_debug_marker
GL_EXT_draw_buffers2 GL_EXT_draw_range_elements
GL_EXT_fog_coord GL_EXT_framebuffer_blit
GL_EXT_framebuffer_multisample GL_EXT_framebuffer_multisample_blit_scaled
GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB
GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters
GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays
GL_EXT_packed_depth_stencil GL_EXT_packed_float
GL_EXT_provoking_vertex GL_EXT_rescale_normal
GL_EXT_secondary_color GL_EXT_separate_specular_color
GL_EXT_shadow_funcs GL_EXT_stencil_two_side
GL_EXT_stencil_wrap GL_EXT_texture_array
GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc
GL_EXT_texture_env_add GL_EXT_texture_filter_anisotropic
GL_EXT_texture_integer GL_EXT_texture_lod_bias
GL_EXT_texture_rectangle GL_EXT_texture_sRGB
GL_EXT_texture_sRGB_decode GL_EXT_texture_shared_exponent
GL_EXT_timer_query GL_EXT_transform_feedback
GL_EXT_vertex_array_bgra GL_IBM_rasterpos_clip
GL_NV_blend_square GL_NV_conditional_render
GL_NV_depth_clamp GL_NV_fog_distance
GL_NV_fragment_program2 GL_NV_fragment_program_option
GL_NV_light_max_exponent GL_NV_texgen_reflection
GL_NV_texture_barrier GL_NV_vertex_program2_option
GL_NV_vertex_program3 GL_SGIS_generate_mipmap
GL_SGIS_texture_edge_clamp GL_SGIS_texture_lod
GL_SGI_color_matrix
:display:gsg:glgsg(debug): HAS EXT GL_EXT_debug_marker 1
:display:gsg:glgsg(debug): HAS EXT GL_KHR_debug 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_debug_output 0
:display:gsg:glgsg(debug): gl-debug disabled and unsupported.
:display:gsg:glgsg(debug): HAS EXT GL_ARB_ES3_compatibility 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_texture_storage 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_clear_texture 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_clear_buffer_object 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_texture_array 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_seamless_cube_map 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_texture_cube_map_array 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_texture_buffer_object 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_texture_compression_rgtc 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_array_bgra 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_type_10f_11f_11f_rev 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_framebuffer_object 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_map_buffer_range 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_buffer_storage 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_array_object 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_tessellation_shader 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_geometry_shader4 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_geometry_shader4 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_program 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_fragment_program 1
:display:gsg:glgsg(debug): HAS EXT GL_NV_gpu_program5 0
:display:gsg:glgsg(debug): HAS EXT GL_NV_gpu_program4 0
:display:gsg:glgsg(debug): HAS EXT GL_NV_vertex_program3 1
:display:gsg:glgsg(debug): HAS EXT GL_NV_fragment_program2 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_compute_shader 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_gpu_shader4 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_attrib_64bit 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_attrib_binding 0
:display:gsg:glgsg(debug): HAS EXT ARB_shader_storage_buffer_object 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_instanced_arrays 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_draw_instanced 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_draw_indirect 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_framebuffer_object 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_direct_state_access 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_framebuffer_no_attachments 0
:display:gsg:glgsg(debug): HAS EXT GL_NV_framebuffer_multisample_coverage 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_viewport_array 0
:display:gsg:glgsg(debug): Occlusion query counter provides 32 bits.
:display:gsg:glgsg(debug): HAS EXT GL_ARB_timer_query 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_blend_func_extended 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_texture_mirror_clamp 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_texture_mirror_clamp_to_edge 0
:display:gsg:glgsg(debug): max texture dimension = 16384, max 3d texture = 2048, max 2d texture array = 2048, max cube map = 16384
:display:gsg:glgsg(debug): max_elements_vertices = 1048575, max_elements_indices = 150000
:display:gsg:glgsg(debug): vertex buffer objects are supported.
:display:gsg:glgsg(debug): Supported compressed texture formats:
GL_COMPRESSED_RGB_S3TC_DXT1_EXT
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:display:gsg:glgsg(debug): HAS EXT GL_EXT_texture_filter_anisotropic 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_shader_image_load_store 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_shader_image_load_store 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_sampler_objects 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_multi_bind 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_internalformat_query2 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_bindless_texture 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_get_program_binary 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_stencil_two_side 1
:display:gsg:glgsg(debug): max lights = 8
:display:gsg:glgsg(debug): max clip planes = 6
:display:gsg:glgsg(debug): max texture stages = 8
:display:gsg:glgsg(debug): No program binary formats supported.
:display:gsg:glgsg(debug): HAS EXT GL_NV_gpu_program5 0
:display:gsg:glgsg(debug): HAS EXT GL_NV_gpu_program4 0
:display:gsg:glgsg(debug): HAS EXT GL_NV_fragment_program2 1
:display:gsg:glgsg(debug): Supported Cg profiles:
:display:gsg:glgsg(debug): arbvp1
:display:gsg:glgsg(debug): fp40
:display:gsg:glgsg(debug): arbfp1
:display:gsg:glgsg(debug): vp40
:display:gsg:glgsg(debug): glslv
:display:gsg:glgsg(debug): glslf
:display:gsg:glgsg(debug): glslg
:display:gsg:glgsg(debug): Cg GLSL version = CG_GL_GLSL_120
:display:gsg:glgsg(debug): Cg latest vertex profile = vp40
:display:gsg:glgsg(debug): Cg latest fragment profile = fp40
:display:gsg:glgsg(debug): Cg latest geometry profile = unknown
:display:gsg:glgsg(debug): basic-shaders-only #f
:display:gsg:glgsg(debug): Cg active vertex profile = vp40
:display:gsg:glgsg(debug): Cg active fragment profile = fp40
:display:gsg:glgsg(debug): Cg active geometry profile = unknown
:display:gsg:glgsg(debug): shader model = 3.0
:display:gsg:glgsg(debug): GLGraphicsStateGuardian 0x7fda93815210 destructing
Process finished with exit code 0
I also tried to force "gl-version 4 1" but the effect was like forcing "gl-version 3 2" (which is none, unfortunately).
Based on this thread from Stack Overflow, I realized that Mac in general has problems with OpenGL and the solution could be Vulkan. Therefore, I can see 3 solutions:
I will not see any other solutions and maybe I will write a shader from scratch that implements Volumetric Lighting on the old OpenGL (which would be a solution, although probably quite desperate).
It looks a bit different than yours, but it’s probably a matter of fine-tuning the parameters.
PS: But, I had to turn OFF loadPrcFileData("","gl-version 3 2") (just delete/comment this line).
Hi, I copied the exact same code to my editor and run, but it showed no effect at all. I’m using MacOS Montery 12.4 and the debug information of the GLSL is like this
:display:gsg:glgsg(debug): GL_VENDOR = Apple
:display:gsg:glgsg(debug): GL_RENDERER = Apple M1
:display:gsg:glgsg(debug): GL_VERSION = 4.1 Metal - 76.3
:display:gsg:glgsg(debug): Detected OpenGL version: 4.1
:display:gsg:glgsg(debug): GL_SHADING_LANGUAGE_VERSION = 4.10
:display:gsg:glgsg(debug): Detected GLSL version: 4.10
:display:gsg:glgsg(debug): Using core profile
:display:gsg:glgsg(debug): GL Extensions:
GL_APPLE_client_storage GL_APPLE_container_object_shareable
GL_APPLE_flush_render GL_APPLE_rgb_422
GL_APPLE_row_bytes GL_APPLE_texture_range
GL_ARB_ES2_compatibility GL_ARB_blend_func_extended
GL_ARB_draw_buffers_blend GL_ARB_draw_indirect
GL_ARB_explicit_attrib_location GL_ARB_gpu_shader5
GL_ARB_gpu_shader_fp64 GL_ARB_instanced_arrays
GL_ARB_internalformat_query GL_ARB_occlusion_query2
GL_ARB_sample_shading GL_ARB_sampler_objects
GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding
GL_ARB_shader_subroutine GL_ARB_shading_language_include
GL_ARB_tessellation_shader GL_ARB_texture_buffer_object_rgb32
GL_ARB_texture_cube_map_array GL_ARB_texture_gather
GL_ARB_texture_query_lod GL_ARB_texture_rgb10_a2ui
GL_ARB_texture_storage GL_ARB_texture_swizzle
GL_ARB_timer_query GL_ARB_transform_feedback2
GL_ARB_transform_feedback3 GL_ARB_vertex_attrib_64bit
GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array
GL_EXT_debug_label GL_EXT_debug_marker
GL_EXT_framebuffer_multisample_blit_scaled
GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic
GL_EXT_texture_sRGB_decode GL_NV_texture_barrier
:display:gsg:glgsg(debug): HAS EXT GL_EXT_debug_marker 1
:display:gsg:glgsg(debug): HAS EXT GL_KHR_debug 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_debug_output 0
:display:gsg:glgsg(debug): gl-debug disabled and unsupported.
:display:gsg:glgsg(debug): HAS EXT GL_ARB_ES3_compatibility 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_secondary_color 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_texture_storage 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_clear_texture 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_clear_buffer_object 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_type_10f_11f_11f_rev 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_buffer_storage 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_compute_shader 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_vertex_attrib_binding 0
:display:gsg:glgsg(debug): HAS EXT ARB_shader_storage_buffer_object 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_direct_state_access 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_framebuffer_no_attachments 0
:display:gsg:glgsg(debug): HAS EXT GL_NV_framebuffer_multisample_coverage 0
:display:gsg:glgsg(debug): Occlusion query counter provides 32 bits.
:display:gsg:glgsg(debug): HAS EXT GL_EXT_texture_mirror_clamp 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_texture_mirror_clamp_to_edge 0
:display:gsg:glgsg(debug): max texture dimension = 16384, max 3d texture = 2048, max 2d texture array = 2048, max cube map = 16384
:display:gsg:glgsg(debug): max_elements_vertices = 1048575, max_elements_indices = 150000
:display:gsg:glgsg(debug): vertex buffer objects are supported.
:display:gsg:glgsg(debug): Supported compressed texture formats:
GL_COMPRESSED_RGB_S3TC_DXT1_EXT
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
:display:gsg:glgsg(debug): HAS EXT GL_EXT_texture_filter_anisotropic 1
:display:gsg:glgsg(debug): HAS EXT GL_ARB_shader_image_load_store 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_shader_image_load_store 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_multi_bind 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_internalformat_query2 0
:display:gsg:glgsg(debug): HAS EXT GL_ARB_bindless_texture 0
:display:gsg:glgsg(debug): HAS EXT GL_EXT_stencil_two_side 0
:display:gsg:glgsg(debug): No program binary formats supported.
:display:gsg:glgsg(debug): shader model = 5.0
:display:gsg:glgsg(debug): Compiling GLSL vertex shader created-shader
:display:gsg:glgsg(debug): Compiling GLSL fragment shader created-shader
:display:gsg:glgsg(debug): Linking GLSL shader created-shader
:display:gsg:glgsg(debug): Active attribute p3d_MultiTexCoord0 with size 1 and type 0x8b50 is bound to location 1
:display:gsg:glgsg(debug): Active attribute p3d_Vertex with size 1 and type 0x8b52 is bound to location 0
:display:gsg:glgsg(debug): Active attribute p3d_Color with size 1 and type 0x8b52 is bound to location 3
:display:gsg:glgsg(debug): Active uniform p3d_ModelViewProjectionMatrix with size 1 and type 0x8b5c is bound to location 0
:display:gsg:glgsg(debug): Active uniform p3d_Texture0 with size 1 and type 0x8b5e is bound to location 4
:display:gsg:glgsg(debug): Active uniform p3d_TexAlphaOnly with size 1 and type 0x8b52 is bound to location 5
:display:gsg:glgsg(debug): Active uniform p3d_ColorScale with size 1 and type 0x8b52 is bound to location 6
:display:gsg:glgsg(debug): loading uncompressed texture panda_torso
:display:gsg:glgsg(debug): loading new texture object for panda_torso, 512 x 256 x 1, z = 0, mipmaps 1, uses_mipmaps = 0
:display:gsg:glgsg(debug): loading uncompressed texture panda_head
:display:gsg:glgsg(debug): loading new texture object for panda_head, 512 x 256 x 1, z = 0, mipmaps 1, uses_mipmaps = 0
:display:gsg:glgsg(debug): loading uncompressed texture panda_viser
:display:gsg:glgsg(debug): loading new texture object for panda_viser, 256 x 64 x 1, z = 0, mipmaps 1, uses_mipmaps = 0
:display:gsg:glgsg(debug): loading uncompressed texture panda_hat
:display:gsg:glgsg(debug): loading new texture object for panda_hat, 512 x 256 x 1, z = 0, mipmaps 1, uses_mipmaps = 0
I also changed the config.prc but also no effect. I would appreciate it a lot if someone knows the answer to what happened!
I run the code on a Linux machine and it works.
THANK YOU!
Hi,
Thanks for your reply! Yes I tried both with and without the loadPrcFileData(“”,“gl-version 3 2”) and it only changes the GLSL version.
With the line is GL_VERSION = 4.1 Metal - 76.3
Without the line is GL_VERSION = 2.1 Metal - 76.3
Hi @Yixuan_Li and welcome to the forum,
I am sorry to have waited so long for my answer.
I see you are working on a Mac with an M1 processor (just like me). I noticed that when using Python natively under M1, the filters in the CommonFilters class do not work. Switching to Intel’s Python solves the problem (unfortunately, probably at the expense of performance). As I recall, this is one of the “known bugs” of the current version of the Panda3D engine, which (I think) is to be improved in the long-awaited version 1.11.
If that’s not it, or if you have problems choosing Intel’s Python version, let me know.
PS: As I recall, the attribute ShowBase().win.gsg.supports_basic_shaders tells you (in a boolean form) whether CommonFilters will work: https://docs.panda3d.org/1.10/python/reference/panda3d.core.GraphicsStateGuardian#panda3d.core.GraphicsStateGuardian.supports_basic_shaders
I would really like to understand how the intel python build affects panda. But while I have a suggestion similar to Windows on mobile devices, perhaps the driver mistakenly uses a built-in video card or some kind of power-saving mode with reduced performance.
On Windows, sometimes the python interpreter uses embedded graphics and this can be fixed by installing an external video card in the driver for the python application. I’m not sure that by analogy there is such a problem with Mac OS, but theoretically it is possible.
All these problems will be fixed in Panda3D 1.11 because the new shader pipeline will automatically convert between the different shader types and versions as needed.