Moved biasLWVP matrix uniform reference to a new one for sun
This was done because the original "_biasLightWorldViewProjectionMatrix" relies on renderpath.light, which is problematic when rendering the deferred light pass and there is a sun and other lights of different type on the scene. Which would result on the wrong light being picked up for the calculation of the uniform value.
This commit is contained in:
parent
4a784c70a8
commit
ead7dc9d32
|
@ -99,7 +99,7 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLightWorldViewProjectionMatrix",
|
||||
"link": "_biasLightWorldViewProjectionMatrixSun",
|
||||
"ifndef": ["_CSM"],
|
||||
"ifdef": ["_Sun", "_ShadowMap"]
|
||||
},
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLightWorldViewProjectionMatrix",
|
||||
"link": "_biasLightWorldViewProjectionMatrixSun",
|
||||
"ifndef": ["_CSM"],
|
||||
"ifdef": ["_Sun", "_ShadowMap"]
|
||||
},
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLightWorldViewProjectionMatrix",
|
||||
"link": "_biasLightWorldViewProjectionMatrixSun",
|
||||
"ifndef": ["_CSM"],
|
||||
"ifdef": ["_Sun", "_ShadowMap"]
|
||||
},
|
||||
|
|
|
@ -372,7 +372,7 @@ def make_forward_mobile(con_mesh):
|
|||
frag.write('float sdotNL = max(dot(n, sunDir), 0.0);')
|
||||
if is_shadows:
|
||||
vert.add_out('vec4 lightPosition')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLightWorldViewProjectionMatrix')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLightWorldViewProjectionMatrixSun')
|
||||
vert.write('lightPosition = LWVP * spos;')
|
||||
frag.add_uniform('bool receiveShadow')
|
||||
frag.add_uniform(f'sampler2DShadow {shadowmap_sun}')
|
||||
|
@ -694,7 +694,7 @@ def make_forward_base(con_mesh, parse_opacity=False, transluc_pass=False):
|
|||
vert.write('lightPosition = LVP * vec4(wposition, 1.0);')
|
||||
else:
|
||||
vert.add_out('vec4 lightPosition')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLightWorldViewProjectionMatrix')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLightWorldViewProjectionMatrixSun')
|
||||
vert.write('lightPosition = LWVP * spos;')
|
||||
frag.write('vec3 lPos = lightPosition.xyz / lightPosition.w;')
|
||||
frag.write('const vec2 smSize = shadowmapSize;')
|
||||
|
|
Loading…
Reference in New Issue