Skip to content

Commit

Permalink
Adding an additive blend mode to the shader
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeFuller committed May 25, 2021
1 parent c74d238 commit 0a72271
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Rendering/OpenGL/glsl/vtkVolumeFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ void applyBlend(vec3 posIS, vec3 endIS, float sampleDistanceIS, vec3 tdims)
// Now map through opacity and color
gl_FragData[0] = getColorForValue(value, posIS, tstep);
#endif
#if vtkBlendMode == 3 //AVERAGE_INTENSITY_BLEND
#if vtkBlendMode == 3 || vtkBlendMode == 4 //AVERAGE_INTENSITY_BLEND || ADDITIVE_BLEND
vec4 averageIPScalarRangeMin = vec4 (
//VTK::AverageIPScalarRangeMin,
//VTK::AverageIPScalarRangeMin,
Expand Down Expand Up @@ -856,7 +856,9 @@ void applyBlend(vec3 posIS, vec3 endIS, float sampleDistanceIS, vec3 tdims)
stepsTraveled++;
}

sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);
#if vtkBlendMode == 3 // Average
sum /= vec4(stepsTraveled, stepsTraveled, stepsTraveled, 1.0);
#endif

gl_FragData[0] = getColorForValue(sum, posIS, tstep);
#endif
Expand Down

0 comments on commit 0a72271

Please sign in to comment.