Skip to content

Commit

Permalink
fix(rendering): fix the cinematic volume shadow direction
Browse files Browse the repository at this point in the history
  • Loading branch information
sankhesh committed Jan 31, 2023
1 parent e0a3045 commit 6512ab7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Sources/Rendering/OpenGL/glsl/vtkVolumeFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ float volume_shadow(vec3 posIS, vec3 lightDirNormIS)
{
return 1.0;
}
vec4 scalar = vec4(0.0);
float maxdist = hit.tmax;

// interpolate shadow ray length between: 1 unit of sample distance in IS to SQRT3, based on globalIlluminationReach
Expand All @@ -688,8 +687,8 @@ float volume_shadow(vec3 posIS, vec3 lightDirNormIS)
float current_dist = 0.0;
float current_step = length(sampleDistanceISVS_jitter * lightDirNormIS);
float clamped_step = 0.0;
float sampled_dist = 0.0;

vec4 scalar = vec4(0.0);
while(current_dist < maxdist)
{
scalar = getTextureValue(posIS);
Expand All @@ -706,8 +705,7 @@ float volume_shadow(vec3 posIS, vec3 lightDirNormIS)
}

clamped_step = min(maxdist - current_dist, current_step);
sampled_dist = current_dist + clamped_step;
posIS += sampled_dist;
posIS += clamped_step * lightDirNormIS;
current_dist += current_step;
}

Expand Down

0 comments on commit 6512ab7

Please sign in to comment.