Enabled blending to all but iso surface shader.
Changed the alpha value of the iso surface colour to 1.0
This commit is contained in:
@@ -173,8 +173,12 @@ void RayTracedTechnique::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool enableBlending = false;
|
||||||
|
|
||||||
if (shadingModel==MaximumIntensityProjection)
|
if (shadingModel==MaximumIntensityProjection)
|
||||||
{
|
{
|
||||||
|
enableBlending = true;
|
||||||
|
|
||||||
if (tf)
|
if (tf)
|
||||||
{
|
{
|
||||||
osg::Texture1D* texture1D = new osg::Texture1D;
|
osg::Texture1D* texture1D = new osg::Texture1D;
|
||||||
@@ -259,6 +263,8 @@ void RayTracedTechnique::init()
|
|||||||
}
|
}
|
||||||
else if (shadingModel==Light)
|
else if (shadingModel==Light)
|
||||||
{
|
{
|
||||||
|
enableBlending = true;
|
||||||
|
|
||||||
if (tf)
|
if (tf)
|
||||||
{
|
{
|
||||||
osg::Texture1D* texture1D = new osg::Texture1D;
|
osg::Texture1D* texture1D = new osg::Texture1D;
|
||||||
@@ -301,10 +307,12 @@ void RayTracedTechnique::init()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
enableBlending = true;
|
||||||
|
|
||||||
if (tf)
|
if (tf)
|
||||||
{
|
{
|
||||||
osg::notify(osg::NOTICE)<<"Setting up TF path"<<std::endl;
|
osg::notify(osg::NOTICE)<<"Setting up TF path"<<std::endl;
|
||||||
|
|
||||||
osg::Texture1D* texture1D = new osg::Texture1D;
|
osg::Texture1D* texture1D = new osg::Texture1D;
|
||||||
texture1D->setImage(tf->getImage());
|
texture1D->setImage(tf->getImage());
|
||||||
texture1D->setResizeNonPowerOfTwoHint(false);
|
texture1D->setResizeNonPowerOfTwoHint(false);
|
||||||
@@ -329,7 +337,7 @@ void RayTracedTechnique::init()
|
|||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume.frag");
|
osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "shaders/volume.frag");
|
||||||
if (fragmentShader)
|
if (fragmentShader)
|
||||||
@@ -362,6 +370,13 @@ void RayTracedTechnique::init()
|
|||||||
stateset->addUniform(new osg::Uniform("AlphaFuncValue",alphaFuncValue));
|
stateset->addUniform(new osg::Uniform("AlphaFuncValue",alphaFuncValue));
|
||||||
|
|
||||||
|
|
||||||
|
if (enableBlending)
|
||||||
|
{
|
||||||
|
stateset->setMode(GL_BLEND, osg::StateAttribute::ON);
|
||||||
|
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::ON);
|
stateset->setMode(GL_CULL_FACE, osg::StateAttribute::ON);
|
||||||
|
|
||||||
osg::TexGen* texgen = new osg::TexGen;
|
osg::TexGen* texgen = new osg::TexGen;
|
||||||
|
|||||||
@@ -108,8 +108,9 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
|||||||
" color.y = lightScale;\n"
|
" color.y = lightScale;\n"
|
||||||
" color.z = lightScale;\n"
|
" color.z = lightScale;\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" \n"
|
"\n"
|
||||||
" if (color.w>1.0) color.w = 1.0; \n"
|
" color.a = 1.0;\n"
|
||||||
|
"\n"
|
||||||
" gl_FragColor = color;\n"
|
" gl_FragColor = color;\n"
|
||||||
" \n"
|
" \n"
|
||||||
" return;\n"
|
" return;\n"
|
||||||
@@ -124,4 +125,5 @@ char volume_iso_frag[] = "uniform sampler3D baseTexture;\n"
|
|||||||
"\n"
|
"\n"
|
||||||
" // we didn't find an intersection so just discard fragment\n"
|
" // we didn't find an intersection so just discard fragment\n"
|
||||||
" discard;\n"
|
" discard;\n"
|
||||||
"}\n";
|
"}\n"
|
||||||
|
"\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user