j3o Shadow Acne

This is with jme3 beta (though I don’t know if that is relevant).



I have a scene with models in it casting shadows using a PssmShadowRenderer. If I load the model as an Ogre scene the shadows look great. But if the model is first converted to j3o, then the model has shadow acne all over it. This happens when I do the deployment too as the files are automatically converted.



Any help would be great. Thanks.

mhhh… a screen shot could help

a test case could help much more.

Ok. I don’t know if this will work, but…



Here is a model loaded from the j3o:







Here is the model loaded from the scene file:







Here is a zip of the project files:



http://www.mediafire.com/?kyhkt41hfqqg0o8



By the way, I added the bucket as you recommended and now I can see the smoke. Thanks for that.

I forgot to mention, to change which is loaded, change which line is commented out at the beginning of the addTrain routine.



You can also change which track is loaded in the addTrack routine.

That’s the same issue i had here:

http://hub.jmonkeyengine.org/groups/graphics/forum/topic/shadow-banding/



In my case it also appeared suddenly, after an import.

Nehon’s advice solved it though

Please make a test case and not a complete project :confused:

what bothers me here is the difference between the ogre file and the j3o file…

The problem does not appear with the ogre file… that’s strange…

Can only be serialization (saving), internally the loaded model is the same as the j3o.

Dumping the model to XML would allow better investigation of the issue.

It is difficult to know how to make a test case as I couldn’t see any test data models with a scene file and a j3o file. But I did make a simpler demo - though you will need to download the model files (hey, it’s only 5kb).



http://www.mediafire.com/?n7aba9nm8h8gsvc



It displays two boxes, both from the same blender file, one is loaded from the scene the other was added to the project using the model import wizard.







[java]package mygame;



import com.jme3.app.SimpleApplication;

import com.jme3.light.AmbientLight;

import com.jme3.light.DirectionalLight;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.queue.RenderQueue.ShadowMode;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.shadow.PssmShadowRenderer;



public class Main extends SimpleApplication {



public static void main(String[] args) {

Main app = new Main();

app.start();

}



private Vector3f lightDir = new Vector3f(-4.9236743f, -1.27054665f, 5.896916f);

private PssmShadowRenderer pssmRenderer;

private Spatial ogreBox;

private Spatial j3oBox;



@Override

public void simpleInitApp() {



Node mainScene = new Node(“Main Scene”);

rootNode.attachChild(mainScene);

rootNode.setShadowMode(ShadowMode.Off);



DirectionalLight sun = new DirectionalLight();

sun.setDirection(lightDir);

sun.setColor(ColorRGBA.White.clone().multLocal(1.7f));

mainScene.addLight(sun);



pssmRenderer = new PssmShadowRenderer(assetManager,1024,4);

pssmRenderer.setDirection(lightDir);

viewPort.addProcessor(pssmRenderer);



flyCam.setMoveSpeed(150);

cam.setLocation(new Vector3f(0, 50, -50));

cam.lookAt(new Vector3f(0,0,0), new Vector3f(0, 1, 0));



j3oBox = assetManager.loadModel(“Models/box/box.j3o”);

j3oBox.setLocalTranslation(new Vector3f(10, 0, 0));

j3oBox.setLocalScale(new Vector3f(5, 5, 5));

j3oBox.setShadowMode(ShadowMode.CastAndReceive);

mainScene.attachChild(j3oBox);



ogreBox = assetManager.loadModel(“Models/ogreBox/box.scene”);

ogreBox.setLocalTranslation(new Vector3f(-10, 0, 0));

ogreBox.setLocalScale(new Vector3f(5, 5, 5));

ogreBox.setShadowMode(ShadowMode.CastAndReceive);

mainScene.attachChild(ogreBox);

}

}



[/java]

thanks!

i downloaded your project before and notice the problem too (BTW nice scene!!)



this test case will help thanks.



As Rickard said, setting the filtering to PCF4 or 8 smooth the issue, but does not remove it, you can use it as a work around while we try to figure it out.

also PCF is a bit more expensive than the default dither.





@Momoko_Fan…apparently it’s the same with any xml file…that must be an issue in the post shadow shader…but i don’t really see how it could depend on the mesh file format…

Should be fixed now. Need some testing before we can push it as a stable fix

For the record it was an issue with the polyoffset being wrongly applied to 0,0