Hello,
I am working on a project where the user starts by drawing lines on the ground. The issue is that the lines are being culled depending on the camera angle. I am unsure of what causes this:
Not Culled: http://prntscr.com/fnsh9x
Culled: http://prntscr.com/fnshe0
In the line creation code, I am disabling depth test and setting cull face mode to off in the material. additionally, I am setting the geometry cull hint to Never, so I am unsure of what is causing this.
Here is the camera frustum perspective line: cam.setFrustumPerspective(70f, ((float) settings.getWidth())/settings.getHeight(), 0.1f, 1000f);
Let me know if there is something I can do to fix this. Thanks!
What do you mean?
Line line = new Line(start, end);
Geometry geo = new Geometry("", line);
Material material = new Material(Main.getApp().getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);
material.setColor(“Color”, ColorRGBA.Black);
material.getAdditionalRenderState().setDepthTest(false);
geo.setMaterial(material);
node.attachChild(geo);
This is the code. I don’t see what I am missing.
It worked because it forced it to be drawn after the “floor”… which presumably is in the opaque bucket.
Because the lines are exactly on the floor if the floor gets drawn after then it might cover it up. You could either offset it up a little or play with the poly offsets in the material’s additional render state.
Interesting, So I ran a test where I offset the line much higher than the floor, and it still disappeared. Your explanation definitely made sense, however, I am unsure why that is still an issue in this case. I disabled the depth test on the line, but that didn’t seem to make a difference. Just somewhat peculiar…
Well, if the line is drawn first then depth test won’t matter. (which is clearly what’s happening)
If you offset it up and it still disappears then it’s the angle of the camera… the sorting is done based on point closest to the camera… and the opaque bucket sorts nearest to farthest.
Actually, I can’t really explain it based on just what I’ve seen in this thread but it’s definitely what’s happening. You will have to experiment a little… or just leave the lines in the transparent bucket. (That’s what I would do, probably.)