summaryrefslogtreecommitdiffstats
path: root/src/datavisualization/engine/shaders/texture3d.frag
diff options
context:
space:
mode:
Diffstat (limited to 'src/datavisualization/engine/shaders/texture3d.frag')
-rw-r--r--src/datavisualization/engine/shaders/texture3d.frag8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/datavisualization/engine/shaders/texture3d.frag b/src/datavisualization/engine/shaders/texture3d.frag
index 6dd7f78c..460cbcc6 100644
--- a/src/datavisualization/engine/shaders/texture3d.frag
+++ b/src/datavisualization/engine/shaders/texture3d.frag
@@ -74,9 +74,8 @@ void main() {
highp vec4 destColor = vec4(0, 0, 0, 0);
highp float totalOpacity = 1.0;
- highp float nextOpacity = 1.0;
- highp float extraAlphaMultiplier = fullDist * alphaThicknesses;
+ highp float extraAlphaMultiplier = fullDist * alphaThicknesses * alphaMultiplier;
// nextEdges vector indicates the next edges of the texel boundaries along each axis that
// the ray is about to cross. The first edges are offset by a fraction of a texel to
@@ -134,11 +133,10 @@ void main() {
curLen += stepSize;
if (curColor.a >= 0.0) {
- curAlpha = alphaMultiplier * curColor.a;
- if (curAlpha >= 1.0 || (curColor.a == 1.0 && preserveOpacity == 1))
+ if (curColor.a == 1.0 && (preserveOpacity == 1 || alphaMultiplier >= 1.0))
curAlpha = 1.0;
else
- curAlpha = curAlpha * extraAlphaMultiplier * stepSize;
+ curAlpha = curColor.a * extraAlphaMultiplier * stepSize;
highp float nextOpacity = totalOpacity - curAlpha;
// If opacity goes beyond full opacity, we need to adjust current alpha according
// to the fraction of the distance the material is visible, so that we don't get