fix dynamic lighting frozen calculation

this broke recently with the reverse-z, the froxel calculation relies
on the depth, which is now inverted.

we actually fix our getNormalizedViewportCorrd() public API, which the
froxel code uses.
This commit is contained in:
Pixelflinger
2020-09-02 15:13:34 -07:00
committed by Mathias Agopian
parent 513b3b8c3a
commit 7fb1b853ac
+3 -1
View File
@@ -89,11 +89,13 @@ highp vec3 getLightSpacePosition() {
/**
* Returns the normalized [0, 1] viewport coordinates with the origin at the viewport's bottom-left.
* Z coordinate is in the [0, 1] range as well.
*
* @public-api
*/
highp vec3 getNormalizedViewportCoord() {
return vec3(shading_normalizedViewportCoord, gl_FragCoord.z);
// make sure handle our reversed-z
return vec3(shading_normalizedViewportCoord, 1.0 - gl_FragCoord.z);
}
#if defined(HAS_SHADOWING) && defined(HAS_DYNAMIC_LIGHTING)