forked from LeenkxTeam/LNXSDK
Light fixes to correct light culling. Now lights show up properly!
This commit is contained in:
@ -9,8 +9,7 @@
|
|||||||
"texture_params": [],
|
"texture_params": [],
|
||||||
"vertex_shader": "../include/pass.vert.glsl",
|
"vertex_shader": "../include/pass.vert.glsl",
|
||||||
"fragment_shader": "clear_color_depth_pass.frag.glsl",
|
"fragment_shader": "clear_color_depth_pass.frag.glsl",
|
||||||
"color_attachments": ["_HDR"],
|
"color_attachments": ["_HDR"]
|
||||||
"clear_depth": 0.0
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -478,8 +478,8 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _Clusters
|
#ifdef _Clusters
|
||||||
// compute linear depth for clustering directly from the reconstructed view-space pos:
|
// compute depth for clustering: use the view-space Z component (linearized depth)
|
||||||
float viewz = length(viewPos);
|
float viewz = viewPos.z;
|
||||||
int clusterI = getClusterI(texCoord, viewz, cameraPlane);
|
int clusterI = getClusterI(texCoord, viewz, cameraPlane);
|
||||||
int numLights = int(texelFetch(clustersData, ivec2(clusterI, 0), 0).r * 255);
|
int numLights = int(texelFetch(clustersData, ivec2(clusterI, 0), 0).r * 255);
|
||||||
|
|
||||||
|
@ -24,7 +24,8 @@ void main() {
|
|||||||
// gl_Position = vec4((gl_VertexID % 2) * 4.0 - 1.0, (gl_VertexID / 2) * 4.0 - 1.0, 0.0, 1.0);
|
// gl_Position = vec4((gl_VertexID % 2) * 4.0 - 1.0, (gl_VertexID / 2) * 4.0 - 1.0, 0.0, 1.0);
|
||||||
|
|
||||||
// For reverse-Z, the “far” plane lives at NDC z = 0
|
// For reverse-Z, the “far” plane lives at NDC z = 0
|
||||||
vec4 v = vec4(pos.x, pos.y, 0.0, 1.0);
|
vec4 ndcFar = vec4(pos.x, pos.y, 0.0, 1.0);
|
||||||
|
vec4 v = invVP * ndcFar;
|
||||||
v = vec4(invVP * v);
|
v = vec4(invVP * v);
|
||||||
v.xyz /= v.w;
|
v.xyz /= v.w;
|
||||||
viewRay = v.xyz - eye;
|
viewRay = v.xyz - eye;
|
||||||
|
Reference in New Issue
Block a user