Skip to content

Commit

Permalink
Displacement Map: displace after morphing/skinning
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxry committed May 6, 2017
1 parent 68d46fc commit 572bd54
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 22 deletions.
2 changes: 0 additions & 2 deletions src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ vec3 transformedNormal = normalMatrix * objectNormal;
transformedNormal = - transformedNormal;

#endif


11 changes: 1 addition & 10 deletions src/renderers/shaders/ShaderChunk/displacementmap_vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
#ifdef USE_DISPLACEMENTMAP

#ifdef USE_MORPHNORMALS

transformed += morphNormal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );

#else

transformed += normal * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );

#endif

transformed += normalize(objectNormal) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );

#endif
6 changes: 0 additions & 6 deletions src/renderers/shaders/ShaderChunk/morphnormal_vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,4 @@
objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];

#ifdef USE_DISPLACEMENTMAP

vec3 morphNormal = normalize(objectNormal);

#endif

#endif
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderLib/depth_vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ void main() {
#include <skinbase_vertex>

#include <begin_vertex>
#include <displacementmap_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderLib/meshphong_vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ void main() {
#endif

#include <begin_vertex>
#include <displacementmap_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderLib/meshphysical_vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ void main() {
#endif

#include <begin_vertex>
#include <displacementmap_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>
#include <clipping_planes_vertex>
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderLib/normal_vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ void main() {
#endif

#include <begin_vertex>
#include <displacementmap_vertex>
#include <morphtarget_vertex>
#include <skinning_vertex>
#include <displacementmap_vertex>
#include <project_vertex>
#include <logdepthbuf_vertex>

Expand Down

0 comments on commit 572bd54

Please sign in to comment.