From 733e71af2d1ce44838ad35119bac5ec32fbd6091 Mon Sep 17 00:00:00 2001 From: Cyrille Favreau Date: Wed, 10 Nov 2021 21:52:28 +0100 Subject: [PATCH] Transparency fix in advanced renderer --- bioexplorer/core/module/ispc/render/AdvancedRenderer.ispc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bioexplorer/core/module/ispc/render/AdvancedRenderer.ispc b/bioexplorer/core/module/ispc/render/AdvancedRenderer.ispc index 0e0a355ae..59879190a 100644 --- a/bioexplorer/core/module/ispc/render/AdvancedRenderer.ispc +++ b/bioexplorer/core/module/ispc/render/AdvancedRenderer.ispc @@ -829,6 +829,8 @@ inline vec3f AdvancedRenderer_shadeRay( const uniform AdvancedRenderer* uniform self, varying ScreenSample& sample) { Ray ray = sample.ray; + float maxt = self->fogStart + self->fogThickness; + vec4f color = make_vec4f(0.f); vec3f bgColor = make_vec3f(0.f); if (self->showBackground) @@ -839,7 +841,8 @@ inline vec3f AdvancedRenderer_shadeRay( uint32 depth = 0; float oldlocalRefraction = 1.f; - sample.z = inf; + sample.z = maxt; + ray.t = maxt; bool moreRebounds = true; while (moreRebounds && depth < self->maxBounces && color.w < 0.95f) @@ -950,7 +953,8 @@ inline vec3f AdvancedRenderer_shadeRay( ++depth; } - ray.t = inf - ray.t; + maxt -= ray.t; + ray.t = maxt; ray.primID = -1; ray.geomID = -1; ray.instID = -1;