Commit 66c92475 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[ADD] the isosurface raytracer now allows disabling specular highlights which...

[ADD] the isosurface raytracer now allows disabling specular highlights which might tamper with the colormap
parent 48593a23
......@@ -137,7 +137,8 @@ void WMIsosurfaceRaytracer::properties()
m_phongShading = m_properties->addProperty( "Phong shading", "If enabled, Phong shading gets applied on a per-pixel basis.", true );
m_cortexMode = m_properties->addProperty( "Emphasize cortex", "Emphasize the cortex while inner parts ar not that well lighten.", false );
m_phongNoSpec = m_properties->addProperty( "No Specular Highlights", "Disables specular highlights on the surface. This is especially "
"useful when these highlights tamper with the colormap.", false );
m_stochasticJitter = m_properties->addProperty( "Stochastic jitter", "Improves image quality at low sampling rates but introduces slight "
"noise effect.", true );
......@@ -161,7 +162,7 @@ void WMIsosurfaceRaytracer::moduleMain()
{
m_shader = osg::ref_ptr< WGEShader > ( new WGEShader( "WMIsosurfaceRaytracer", m_localPath ) );
m_shader->addPreprocessor( WGEShaderPreprocessor::SPtr(
new WGEShaderPropertyDefineOptions< WPropBool >( m_cortexMode, "CORTEXMODE_DISABLED", "CORTEXMODE_ENABLED" ) )
new WGEShaderPropertyDefineOptions< WPropBool >( m_phongNoSpec, "PHONGSHADING_NOSECULAR_DISABLED", "PHONGSHADING_NOSECULAR_ENABLED" ) )
);
m_shader->addPreprocessor( WGEShaderPreprocessor::SPtr(
new WGEShaderPropertyDefineOptions< WPropBool >( m_stochasticJitter, "STOCHASTICJITTER_DISABLED", "STOCHASTICJITTER_ENABLED" ) )
......
......@@ -146,9 +146,9 @@ private:
WPropDouble m_colormapRatio;
/**
* Some special coloring mode emphasizing the cortex.
* Some special coloring mode for disabling specular hightlights.
*/
WPropBool m_cortexMode;
WPropBool m_phongNoSpec;
/**
* If true, per-pixel-phong shading is applied to the surface.
......
......@@ -216,23 +216,13 @@ void main()
float light = 1.0;
#ifdef PHONGSHADING_ENABLED
// only calculate the phong illumination only if needed
light = blinnPhongIlluminationIntensity( normalize( normal ) );
wge_LightIntensityParameter lightParams = wge_DefaultLightIntensity;
#ifdef PHONGSHADING_NOSECULAR_ENABLED
lightParams.materialSpecular = 0.0;
#endif
light = blinnPhongIlluminationIntensity( lightParams, normalize( normal ) );
#endif
// 4: set color
#ifdef CORTEXMODE_ENABLED
// NOTE: these are a lot of weird experiments ;-)
float d = 1.0 - curPointProjected.z;
d = 1.5 * pointDistance( curPoint, vec3( 0.5 ) );
float w = dot( normalize( vec3( 0.5 ) - curPoint ), normalize( v_ray ) );
w = ( w + 0.5 );
if( w > 0.8 ) w = 0.8;
float d2 = w * d * d * d * d * d;
light = light * 11.0 * d2;
#endif
// mix color with colormap
vec4 color = mix(
colormapping( vec4( curPoint.x * u_texture0SizeX, curPoint.y * u_texture0SizeY, curPoint.z * u_texture0SizeZ, 1.0 ) ),
......
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