Selaa lähdekoodia

fixed velocity for motion blur by computing transformations deltas before bones computation for skinned meshes

Julien MOREAU-MATHIS 6 vuotta sitten
vanhempi
commit
9d446df5e1
1 muutettua tiedostoa jossa 6 lisäystä ja 5 poistoa
  1. 6 5
      src/Shaders/geometry.vertex.fx

+ 6 - 5
src/Shaders/geometry.vertex.fx

@@ -39,6 +39,12 @@ void main(void)
 {
 #include<instancesVertex>
 
+	#ifdef VELOCITY
+	// Compute velocity before bones computation
+	vCurrentPosition = viewProjection * finalWorld * vec4(position, 1.0);
+	vPreviousPosition = previousWorldViewProjection * vec4(position, 1.0);
+	#endif
+
 #include<bonesVertex>
 	vec4 pos = vec4(finalWorld * vec4(position, 1.0));
 
@@ -49,11 +55,6 @@ void main(void)
 	vPosition = pos.xyz / pos.w;
 	#endif
 
-	#ifdef VELOCITY
-	vCurrentPosition = viewProjection * finalWorld * vec4(position, 1.0);
-	vPreviousPosition = previousWorldViewProjection * vec4(position, 1.0);
-	#endif
-
 	gl_Position = viewProjection * finalWorld * vec4(position, 1.0);
 
 #if defined(ALPHATEST) || defined(BASIC_RENDER)