|
@@ -3,7 +3,14 @@ vec3 transformedNormal = objectNormal;
|
|
|
|
|
|
#ifdef USE_INSTANCING
|
|
|
|
|
|
- transformedNormal = mat3( instanceMatrix ) * transformedNormal;
|
|
|
+ // this is in lieu of a per-instance normal-matrix
|
|
|
+ // shear transforms in the instance matrix are not supported
|
|
|
+
|
|
|
+ mat3 m = mat3( instanceMatrix );
|
|
|
+
|
|
|
+ transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
|
|
+
|
|
|
+ transformedNormal = m * transformedNormal;
|
|
|
|
|
|
#endif
|
|
|
|