Commit 85666eb9 authored by Ken Martin's avatar Ken Martin

Make sure molecule mapper works with depth peeling

Imposters use FragDepth as opposed to FragCoord.z

Change-Id: If376c2cb3c0dc8f1513b2712690d773afea4027a
parent f62600ac
......@@ -113,6 +113,17 @@ void vtkOpenGLSphereMapper::ReplaceShaderValues(std::string &VSSource,
" gl_FragDepth = (pos.z / pos.w + 1.0) / 2.0;\n"
);
if (ren->GetLastRenderingUsedDepthPeeling())
{
FSSource = vtkgl::replace(FSSource,
"//VTK::DepthPeeling::Impl",
"float odepth = texture2D(opaqueZTexture, gl_FragCoord.xy/screenSize).r;\n"
" if (gl_FragDepth >= odepth) { discard; }\n"
" float tdepth = texture2D(translucentZTexture, gl_FragCoord.xy/screenSize).r;\n"
" if (gl_FragDepth <= tdepth) { discard; }\n"
);
}
this->Superclass::ReplaceShaderValues(VSSource,FSSource,GSSource,lightComplexity,ren,actor);
}
......
......@@ -173,6 +173,19 @@ void vtkOpenGLStickMapper::ReplaceShaderValues(std::string &VSSource,
);
}
if (ren->GetLastRenderingUsedDepthPeeling())
{
FSSource = vtkgl::replace(FSSource,
"//VTK::DepthPeeling::Impl",
"float odepth = texture2D(opaqueZTexture, gl_FragCoord.xy/screenSize).r;\n"
" if (gl_FragDepth >= odepth) { discard; }\n"
" float tdepth = texture2D(translucentZTexture, gl_FragCoord.xy/screenSize).r;\n"
" if (gl_FragDepth <= tdepth) { discard; }\n"
);
}
this->Superclass::ReplaceShaderValues(VSSource,FSSource,GSSource,lightComplexity,ren,actor);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment