Commit b2424cba authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - renamed step property to sample as it is a more telling name.

parent 77ed8303
......@@ -99,10 +99,10 @@ void WMDirectVolumeRendering::properties()
// Initialize the properties
m_propCondition = boost::shared_ptr< WCondition >( new WCondition() );
m_stepCount = m_properties->addProperty( "Step count", "The number of steps to walk along the ray during raycasting. A low value "
"may cause artifacts whilst a high value slows down rendering.", 256 );
m_stepCount->setMin( 1 );
m_stepCount->setMax( 5000 );
m_samples = m_properties->addProperty( "Sample count", "The number of samples to walk along the ray during raycasting. A low value "
"may cause artifacts whilst a high value slows down rendering.", 256 );
m_samples->setMin( 1 );
m_samples->setMax( 5000 );
// illumination model
m_localIlluminationSelections = boost::shared_ptr< WItemSelection >( new WItemSelection() );
......@@ -130,7 +130,7 @@ void WMDirectVolumeRendering::properties()
m_propCondition );
m_opacityCorrectionEnabled = m_improvementGroup->addProperty( "Opacity Correction", "If enabled, opacities are assumed to be relative to the "
"sample count. If disabled, changing the step count "
"sample count. If disabled, changing the sample count "
"varies brightness of the image.", true,
m_propCondition );
......@@ -336,10 +336,10 @@ void WMDirectVolumeRendering::moduleMain()
// for the texture, also bind the appropriate uniforms
rootState->addUniform( new osg::Uniform( "tex0", 0 ) );
osg::ref_ptr< osg::Uniform > steps = new osg::Uniform( "u_steps", m_stepCount->get() );
steps->setUpdateCallback( new SafeUniformCallback( this ) );
osg::ref_ptr< osg::Uniform > samples = new osg::Uniform( "u_samples", m_samples->get() );
samples->setUpdateCallback( new SafeUniformCallback( this ) );
rootState->addUniform( steps );
rootState->addUniform( samples );
WGEColormapping::apply( cube, false );
......@@ -372,9 +372,9 @@ void WMDirectVolumeRendering::moduleMain()
void WMDirectVolumeRendering::SafeUniformCallback::operator()( osg::Uniform* uniform, osg::NodeVisitor* /* nv */ )
{
// update some uniforms:
if ( m_module->m_stepCount->changed() && ( uniform->getName() == "u_steps" ) )
if ( m_module->m_samples->changed() && ( uniform->getName() == "u_samples" ) )
{
uniform->set( m_module->m_stepCount->get( true ) );
uniform->set( m_module->m_samples->get( true ) );
}
}
......@@ -116,9 +116,9 @@ private:
boost::shared_ptr< WModuleInputData< WDataSetVector > > m_gradients;
/**
* The number of steps to walk along the ray.
* The number of samples to walk along the ray.
*/
WPropInt m_stepCount;
WPropInt m_samples;
/**
* Types of local illumination supported.
......@@ -172,7 +172,7 @@ private:
/**
* If active, the opacity of the classified fragment gets scaled according to sample count to ensure relative opacities even if sampling
* number changes (m_stepCount)
* number changes (m_samples)
*/
WPropBool m_opacityCorrectionEnabled;
......
......@@ -194,7 +194,7 @@ void main()
// stochastic jittering can help to void these ugly wood-grain artifacts with larger sampling distances but might
// introduce some noise artifacts.
float jitter = 0.5 - texture2D( JITTERTEXTURE_SAMPLER, gl_FragCoord.xy / JITTERTEXTURE_SIZEX ).r;
vec3 rayStart = v_rayStart + ( v_ray * v_stepDistance * jitter );
vec3 rayStart = v_rayStart + ( v_ray * v_sampleDistance * jitter );
#else
vec3 rayStart = v_rayStart;
#endif
......@@ -214,17 +214,17 @@ void main()
#ifdef OPACITYCORRECTION_ENABLED
// opacity correction
src.r = 1.0 - fastpow( 1.0 - src.r, v_relativeSteps );
src.g = 1.0 - fastpow( 1.0 - src.g, v_relativeSteps );
src.b = 1.0 - fastpow( 1.0 - src.b, v_relativeSteps );
src.a = 1.0 - fastpow( 1.0 - src.a, v_relativeSteps );
src.r = 1.0 - fastpow( 1.0 - src.r, v_relativeSampleDistance );
src.g = 1.0 - fastpow( 1.0 - src.g, v_relativeSampleDistance );
src.b = 1.0 - fastpow( 1.0 - src.b, v_relativeSampleDistance );
src.a = 1.0 - fastpow( 1.0 - src.a, v_relativeSampleDistance );
#endif
// apply front-to-back compositing
dst = ( 1.0 - dst.a ) * src + dst;
// go to next value
currentDistance += v_stepDistance;
currentDistance += v_sampleDistance;
}
// early ray-termination
......
......@@ -34,10 +34,10 @@ varying vec3 v_rayStart;
varying vec3 v_ray;
// The sampling distance
varying float v_stepDistance;
varying float v_sampleDistance;
// The steps in relation to a default steps of 256.
varying float v_relativeSteps;
// The steps in relation to a default steps of 128.
varying float v_relativeSampleDistance;
#ifdef LOCALILLUMINATION_PHONG
// The light source in local coordinates, normalized
......
......@@ -39,8 +39,8 @@
// texture containing the data
uniform sampler3D tex0;
// The number of steps to use.
uniform int u_steps;
// The number of samples to use.
uniform int u_samples;
/////////////////////////////////////////////////////////////////////////////
// Attributes
......@@ -72,8 +72,8 @@ void main()
v_ray = normalize( worldToLocal( camLookAt, camPos ).xyz );
// to have equidistant sampling for each side of the box, use a fixed step size
v_stepDistance = 1.0 / float( u_steps );
v_relativeSteps = 128.0 / float( u_steps );
v_sampleDistance = 1.0 / float( u_samples );
v_relativeSampleDistance = 128.0 / float( u_samples );
#ifdef LOCALILLUMINATION_PHONG
// also get the coordinates of the light
......
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