Fix the lighting problem at the outline of the shapes, use the depth buffer instead of the Linear depth buffer

This commit is contained in:
sam 2016-12-05 00:47:50 -08:00
parent 10c054165f
commit 310e26011f

View file

@ -30,7 +30,6 @@
<@include LightClusterGrid.slh@>
in vec2 _texCoord0;
out vec4 _fragColor;
@ -39,16 +38,14 @@ void main(void) {
// Grab the fragment data from the uv
vec2 texCoord = _texCoord0.st;
vec4 fragPosition = unpackDeferredPositionFromZeye(texCoord);
DeferredFragment frag = unpackDeferredFragmentNoPosition(texCoord);
DeferredFrameTransform deferredTransform = getDeferredFrameTransform();
DeferredFragment frag = unpackDeferredFragment(deferredTransform, texCoord);
vec4 fragPosition = frag.position;
if (frag.mode == FRAG_MODE_UNLIT) {
discard;
}
frag.position = fragPosition;
// Frag pos in world
mat4 invViewMat = getViewInverse();
vec4 fragPos = invViewMat * fragPosition;
@ -57,7 +54,6 @@ void main(void) {
vec4 clusterEyePos = frustumGrid_worldToEye(fragPos);
ivec3 clusterPos = frustumGrid_eyeToClusterPos(clusterEyePos.xyz);
ivec3 cluster = clusterGrid_getCluster(frustumGrid_clusterToIndex(clusterPos));
int numLights = cluster.x + cluster.y;
if (numLights <= 0) {