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
5a72ea30
Commit
5a72ea30
authored
Feb 01, 2013
by
Sebastian Eichelbaum
Browse files
[FIX] the normal used for projecting the input vectors needs to be in object space.
parent
1681f4dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-Transformation-fragment.glsl
...eLIC/shaders/WMImageSpaceLIC-Transformation-fragment.glsl
+2
-1
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-Transformation-varyings.glsl
...eLIC/shaders/WMImageSpaceLIC-Transformation-varyings.glsl
+5
-0
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-Transformation-vertex.glsl
...aceLIC/shaders/WMImageSpaceLIC-Transformation-vertex.glsl
+2
-1
No files found.
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-Transformation-fragment.glsl
View file @
5a72ea30
...
...
@@ -145,7 +145,8 @@ void main()
gl_FragData
[
1
]
=
colormapping
();
// is the vector very orthogonal to the surface? We scale our advection according to this.
float
dotS
=
abs
(
dot
(
v_normal
,
vec
.
xyz
)
);
float
dotS
=
abs
(
dot
(
v_normalObject
,
vec
.
xyz
)
);
// scale down the vector -> the more it "comes out of the surface, the shorter the vector".
vec2
dotScaled
=
(
1
.
0
-
dotS
)
*
scaleMaxToOne
(
vecProjected
).
xy
;
gl_FragData
[
0
]
=
vec4
(
vec2
(
0
.
5
)
+
(
0
.
5
*
dotScaled
),
light
,
noise3D
);
...
...
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-Transformation-varyings.glsl
View file @
5a72ea30
...
...
@@ -27,6 +27,11 @@
*/
varying
vec3
v_normal
;
/**
* Normal in object space
*/
varying
vec3
v_normalObject
;
/**
* The normal interpolated and projected to screenspace
*/
...
...
src/modules/imageSpaceLIC/shaders/WMImageSpaceLIC-Transformation-vertex.glsl
View file @
5a72ea30
...
...
@@ -95,10 +95,11 @@ void main()
// some light precalculations
v_normal
=
gl_NormalMatrix
*
gl_Normal
;
v_normalObject
=
gl_Normal
;
// NOTE: we normalize the vec here although we need to normalize it again in the fragment shader since the projected vector might be very
// small and we want to avoid numerical issues when interpolating.
v_normalProjected
=
normalize
(
projectVector
(
vec4
(
gl_N
ormal
.
xyz
,
0
.
0
)
)
);
v_normalProjected
=
normalize
(
projectVector
(
vec4
(
v_n
ormal
,
0
.
0
)
)
);
// if we use 3d noise textures and auto resolution feature:
#ifdef NOISE3D_ENABLED
...
...
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