Wrong culling in DirectionalShadowMapPass.java

The backface needs to be culled, not the frontface. Or is this done because some artifacts show up otherwise?



Index: DirectionalShadowMapPass.java
===================================================================
--- DirectionalShadowMapPass.java   (revision 4756)
+++ DirectionalShadowMapPass.java   (working copy)
@@ -349,7 +349,7 @@
         colorDisabled.setAll(false);
         cullFrontFace = r.createCullState();
         cullFrontFace.setEnabled(true);
-        cullFrontFace.setCullFace(CullState.Face.Front);
+        cullFrontFace.setCullFace(CullState.Face.Back);
         noLights = r.createLightState();
         noLights.setEnabled(false);
 

Actually any culling at all is not necessary (culling anything would create artifacts with non-closed surfaces), instead the polygon offset should be set to the point until no artifacts are visible anymore.



EDIT: I noticed you posted in jME3 forum, the class you're talking about is jME2 only, so I am moving this thread to jme2 contrib depot.

Sorry for posting in the wrong forum, i'm just a newbie :wink:



Come to think of it, the culling should not be changed but kept thesame as the normal render pass. Culling should still be done to improve performance, but it's not required.