Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
b2424cba
Commit
b2424cba
authored
Dec 03, 2010
by
Sebastian Eichelbaum
Browse files
[CHANGE] - renamed step property to sample as it is a more telling name.
parent
77ed8303
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
26 deletions
+26
-26
src/modules/directVolumeRendering/WMDirectVolumeRendering.cpp
...modules/directVolumeRendering/WMDirectVolumeRendering.cpp
+10
-10
src/modules/directVolumeRendering/WMDirectVolumeRendering.h
src/modules/directVolumeRendering/WMDirectVolumeRendering.h
+3
-3
src/modules/directVolumeRendering/shaders/WMDirectVolumeRendering-fragment.glsl
...meRendering/shaders/WMDirectVolumeRendering-fragment.glsl
+6
-6
src/modules/directVolumeRendering/shaders/WMDirectVolumeRendering-varyings.glsl
...meRendering/shaders/WMDirectVolumeRendering-varyings.glsl
+3
-3
src/modules/directVolumeRendering/shaders/WMDirectVolumeRendering-vertex.glsl
...lumeRendering/shaders/WMDirectVolumeRendering-vertex.glsl
+4
-4
No files found.
src/modules/directVolumeRendering/WMDirectVolumeRendering.cpp
View file @
b2424cba
...
...
@@ -99,10 +99,10 @@ void WMDirectVolumeRendering::properties()
// Initialize the properties
m_propCondition
=
boost
::
shared_ptr
<
WCondition
>
(
new
WCondition
()
);
m_s
tepCount
=
m_properties
->
addProperty
(
"S
tep
count"
,
"The number of s
tep
s to walk along the ray during raycasting. A low value "
"may cause artifacts whilst a high value slows down rendering."
,
256
);
m_s
tepCount
->
setMin
(
1
);
m_s
tepCount
->
setMax
(
5000
);
m_s
amples
=
m_properties
->
addProperty
(
"S
ample
count"
,
"The number of s
ample
s to walk along the ray during raycasting. A low value "
"may cause artifacts whilst a high value slows down rendering."
,
256
);
m_s
amples
->
setMin
(
1
);
m_s
amples
->
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 s
tep
count "
"sample count. If disabled, changing the s
ample
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
>
s
tep
s
=
new
osg
::
Uniform
(
"u_s
tep
s"
,
m_s
tepCount
->
get
()
);
s
tep
s
->
setUpdateCallback
(
new
SafeUniformCallback
(
this
)
);
osg
::
ref_ptr
<
osg
::
Uniform
>
s
ample
s
=
new
osg
::
Uniform
(
"u_s
ample
s"
,
m_s
amples
->
get
()
);
s
ample
s
->
setUpdateCallback
(
new
SafeUniformCallback
(
this
)
);
rootState
->
addUniform
(
s
tep
s
);
rootState
->
addUniform
(
s
ample
s
);
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_s
tepCount
->
changed
()
&&
(
uniform
->
getName
()
==
"u_s
tep
s"
)
)
if
(
m_module
->
m_s
amples
->
changed
()
&&
(
uniform
->
getName
()
==
"u_s
ample
s"
)
)
{
uniform
->
set
(
m_module
->
m_s
tepCount
->
get
(
true
)
);
uniform
->
set
(
m_module
->
m_s
amples
->
get
(
true
)
);
}
}
src/modules/directVolumeRendering/WMDirectVolumeRendering.h
View file @
b2424cba
...
...
@@ -116,9 +116,9 @@ private:
boost
::
shared_ptr
<
WModuleInputData
<
WDataSetVector
>
>
m_gradients
;
/**
* The number of s
tep
s to walk along the ray.
* The number of s
ample
s to walk along the ray.
*/
WPropInt
m_s
tepCount
;
WPropInt
m_s
amples
;
/**
* 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_s
tepCount
)
* number changes (m_s
amples
)
*/
WPropBool
m_opacityCorrectionEnabled
;
...
...
src/modules/directVolumeRendering/shaders/WMDirectVolumeRendering-fragment.glsl
View file @
b2424cba
...
...
@@ -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_s
tep
Distance
*
jitter
);
vec3
rayStart
=
v_rayStart
+
(
v_ray
*
v_s
ample
Distance
*
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_relativeS
teps
);
src
.
g
=
1
.
0
-
fastpow
(
1
.
0
-
src
.
g
,
v_relativeS
teps
);
src
.
b
=
1
.
0
-
fastpow
(
1
.
0
-
src
.
b
,
v_relativeS
teps
);
src
.
a
=
1
.
0
-
fastpow
(
1
.
0
-
src
.
a
,
v_relativeS
teps
);
src
.
r
=
1
.
0
-
fastpow
(
1
.
0
-
src
.
r
,
v_relativeS
ampleDistance
);
src
.
g
=
1
.
0
-
fastpow
(
1
.
0
-
src
.
g
,
v_relativeS
ampleDistance
);
src
.
b
=
1
.
0
-
fastpow
(
1
.
0
-
src
.
b
,
v_relativeS
ampleDistance
);
src
.
a
=
1
.
0
-
fastpow
(
1
.
0
-
src
.
a
,
v_relativeS
ampleDistance
);
#endif
// apply front-to-back compositing
dst
=
(
1
.
0
-
dst
.
a
)
*
src
+
dst
;
// go to next value
currentDistance
+=
v_s
tep
Distance
;
currentDistance
+=
v_s
ample
Distance
;
}
// early ray-termination
...
...
src/modules/directVolumeRendering/shaders/WMDirectVolumeRendering-varyings.glsl
View file @
b2424cba
...
...
@@ -34,10 +34,10 @@ varying vec3 v_rayStart;
varying
vec3
v_ray
;
// The sampling distance
varying
float
v_s
tep
Distance
;
varying
float
v_s
ample
Distance
;
// The steps in relation to a default steps of
256
.
varying
float
v_relativeS
teps
;
// The steps in relation to a default steps of
128
.
varying
float
v_relativeS
ampleDistance
;
#ifdef LOCALILLUMINATION_PHONG
// The light source in local coordinates, normalized
...
...
src/modules/directVolumeRendering/shaders/WMDirectVolumeRendering-vertex.glsl
View file @
b2424cba
...
...
@@ -39,8 +39,8 @@
// texture containing the data
uniform
sampler3D
tex0
;
// The number of s
tep
s to use.
uniform
int
u_s
tep
s
;
// The number of s
ample
s to use.
uniform
int
u_s
ample
s
;
/////////////////////////////////////////////////////////////////////////////
// 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_s
tep
Distance
=
1
.
0
/
float
(
u_s
tep
s
);
v_relativeS
teps
=
128
.
0
/
float
(
u_s
tep
s
);
v_s
ample
Distance
=
1
.
0
/
float
(
u_s
ample
s
);
v_relativeS
ampleDistance
=
128
.
0
/
float
(
u_s
ample
s
);
#ifdef LOCALILLUMINATION_PHONG
// also get the coordinates of the light
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment