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": [],
|
||||
"vertex_shader": "../include/pass.vert.glsl",
|
||||
"fragment_shader": "clear_color_depth_pass.frag.glsl",
|
||||
"color_attachments": ["_HDR"],
|
||||
"clear_depth": 0.0
|
||||
"color_attachments": ["_HDR"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -478,8 +478,8 @@ void main() {
|
||||
#endif
|
||||
|
||||
#ifdef _Clusters
|
||||
// compute linear depth for clustering directly from the reconstructed view-space pos:
|
||||
float viewz = length(viewPos);
|
||||
// compute depth for clustering: use the view-space Z component (linearized depth)
|
||||
float viewz = viewPos.z;
|
||||
int clusterI = getClusterI(texCoord, viewz, cameraPlane);
|
||||
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);
|
||||
|
||||
// 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.xyz /= v.w;
|
||||
viewRay = v.xyz - eye;
|
||||
|
Reference in New Issue
Block a user