Page MenuHome

BGE: Fix T43592: World GLSL
ClosedPublic

Authored by Thomas Szepe (hg1) on Dec 29 2013, 4:04 PM.

Details

Summary

This patch will fix the world GLSL (mist, background, ambient) update for the BGE.

Diff Detail

Event Timeline

Brecht Van Lommel (brecht) requested changes to this revision.Dec 31 2013, 1:20 AM

Looks good, just some minor comments.

source/blender/editors/space_view3d/view3d_draw.c
3254–3260

Can you only do this in case GLSL drawing is enabled? There is a check for it before calling gpu_update_lamps_shadows a bit earlier in this function.

source/blender/gpu/intern/gpu_material.c
78–87

Can you make this static and rename gpuworld to GPUCurrentWorld or something like that? There isn't really a convention for this but global variables are not typically lowercase.

1423–1425

can use copy_v3_v3 here and in other places.

Mitchell Stokes (moguri) requested changes to this revision.Jan 3 2014, 11:52 PM

Ketsji really shouldn't have any OpenGL or bf_gpu code in it. I know it currently does, but I've been working to address that, and adding more bf_gpu code to KX_KetsjiEngine doesn't help. You could at least move things to one of the world classes. The actual rendering code can then be moved to the rasterizer at a later date.

@Mitchell Stokes (moguri). This will be done by the BGE Code clean up for world D152.

source/blender/gpu/GPU_material.h
64

I will remove the struct GPUWorldand and typedef struct GPUWorld GPUWorld. I don't use the structure in the header or somewhere else, so the definition is not necessary.

source/blender/gpu/intern/gpu_material.c
78–87

I seems that the structure name and the variable name is always the same. I will rename the variable gpuworld to GPUWorld.

Thomas Szepe (hg1) updated this revision to Unknown Object (????).Jan 8 2014, 11:09 PM

Done Brecht's suggested modifications.

Brecht Van Lommel (brecht) requested changes to this revision.Jan 9 2014, 6:06 PM

Looks good, just noticed one more problem.

source/blender/editors/space_view3d/view3d_draw.c
12–20

I just noticed that ED_view3d_draw_offscreen_init actually needs these world settings as well for OpenGL render. Can you move these 4 lines into gpu_update_lamps_shadows so they are handled in both cases? The function could be renamed to gpu_update_lamps_shadows_world.

Thomas Szepe (hg1) updated this revision to Unknown Object (????).Jan 9 2014, 7:55 PM

Moved world update functions into gpu_update_lamps_shadows_world.

Looks good to me.

This will be fine if it's also committed with D152, which cleans up the GPU_* calls in KX_KetsjiEngine.

Thomas Szepe (hg1) updated this revision to Unknown Object (????).Jul 19 2014, 7:14 PM

Update for the actual master.

Thomas Szepe (hg1) edited edge metadata.

Update fix merge conflicts with actual master branch.

@Thomas Szepe (hg1) Why you don't call GPU_mist_update_* in a function in RAS_OpenGLRasterizer ?
Maybe it's better to past uniform blocks to the shader than many uniform.

Why you don't call GPU_mist_update_* in a function in RAS_OpenGLRasterizer ?

  1. It don’t see any improvement by moving it into RAS_OpenGLRasterizer.
  2. In D154 I have done the color conversion for the color management in BlenderWolrdInfo. For GLSL this is not necessary (done in the shader). So simply RAS_OpenGLRasterizer will hold the wrong colors.

Maybe it's better to past uniform blocks to the shader than many uniform.

  1. Uniform Buffer Objects (or UBO in short) have been introduced with OpenGL 3.1 (GL_ARB_uniform_buffer_object). Older graphic cards don’t support it.
  2. We don’t reuse the mist uniforms for another shader program. So there is no speed improvement by using UBO’s.
  3. There is no method in Blender for binding UBO’s.
  4. The shader export function actually accepts only single uniforms.

This patch is a fix to get the mist working in the BGE. It should not mixed with cleanups or new features like UBO.

Thomas Szepe (hg1) retitled this revision from BGE: World GLSL fix to BGE: Fix T43592: World GLSL.Mar 23 2015, 9:56 AM
Thomas Szepe (hg1) edited edge metadata.

Update fur current master.

This revision was automatically updated to reflect the committed changes.