mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
Fix a bad conversion to integer for negative values of the GRid COordinates
This commit is contained in:
parent
784a0540ed
commit
1d3fc1b647
2 changed files with 4 additions and 3 deletions
|
@ -136,6 +136,7 @@ ivec3 frustumGrid_eyeToClusterPos(vec3 eyePos) {
|
|||
|
||||
vec3 volumePos = frustumGrid_eyeToVolume(eyePos, frustumGrid.eyeToGridProj, frustumGrid.rangeNear, frustumGrid.rangeFar);
|
||||
|
||||
|
||||
vec3 gridPos = frustumGrid_volumeToGrid(volumePos, frustumGrid.dims);
|
||||
|
||||
if (gridPos.z >= frustumGrid.dims.z) {
|
||||
|
@ -143,7 +144,7 @@ ivec3 frustumGrid_eyeToClusterPos(vec3 eyePos) {
|
|||
}
|
||||
|
||||
|
||||
return ivec3(gridPos);
|
||||
return ivec3(floor(gridPos));
|
||||
}
|
||||
|
||||
int frustumGrid_eyeToClusterDirH(vec3 eyeDir) {
|
||||
|
|
|
@ -38,9 +38,9 @@ void main(void) {
|
|||
// From frag world pos find the cluster
|
||||
vec4 clusterEyePos = frustumGrid_worldToEye(fragWorldPos);
|
||||
ivec3 clusterPos = frustumGrid_eyeToClusterPos(clusterEyePos.xyz);
|
||||
int clusterIndex = frustumGrid_clusterToIndex(clusterPos);
|
||||
|
||||
|
||||
ivec3 cluster = clusterGrid_getCluster(frustumGrid_clusterToIndex(clusterPos));
|
||||
ivec3 cluster = clusterGrid_getCluster(clusterIndex);
|
||||
int numLights = cluster.x + cluster.y;
|
||||
float numLightsScale = clamp(numLights * 0.05, 0.01, 1.0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue