Well I think this Screenshot already describes the problem that occurs, the trees are 2D textures drawn on a Quad. The texture is loaded from a .png file and I initialize the material with:
[java]TreeMat = new Material(
Main.assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
TreeMat.setTexture(“ColorMap”,
Main.assetManager.loadTexture(“Models/Trees/tree1.png”));
TreeMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);[/java]
and on the Quad-Geometry itself I call:
[java]tree.setQueueBucket(Bucket.Transparent);[/java]
Is there anything else I’ve forgotten to set when using textures containing alpha values?
@Tjong said:
Well I think this Screenshot already describes the problem that occurs, the trees are 2D textures drawn on a Quad. The texture is loaded from a .png file and I initialize the material with:
[java]TreeMat = new Material(
Main.assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
TreeMat.setTexture(“ColorMap”,
Main.assetManager.loadTexture(“Models/Trees/tree1.png”));
TreeMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);[/java]
and on the Quad-Geometry itself I call:
[java]tree.setQueueBucket(Bucket.Transparent);[/java]
wow that’s so pretty!
Is there anything else I’ve forgotten to set when using textures containing alpha values?
@pspeed said:
Classic alpha sorting problem. You can find about five hundred posts on a similar problem though finding specific keywords may be difficult.
Short answer is to turn on alpha discard or alphatest falloff, etc.
Wow that a fast answer
And thanks for the tip, a simple:
[java]TreeMat.getAdditionalRenderState().setAlphaTest(true);[/java]
fixed the Problem.
uhm…
if I replace my working lines
[java]TreeMaterial.getAdditionalRenderState().setAlphaTest(true);
TreeMaterial.getAdditionalRenderState().setAlphaFallOff(0.5f);[/java]
with your line, it throws an exception:
java.lang.IllegalArgumentException: Material parameter is not defined: AlphaDiscardThreshold
Which occurs as I simply use the Unshaded Material which got no such parameter, but then next why am I running into problems with my solution?
Until now everything works quite good so far:
Alpha test is deprecated in way newer OpenGL versions or something and won’t work on Android at all. Other than that, I’m not sure what the issues are.
Hm ok, I will just change the material to lightning anyway now or later as I plan to add a day-night cycle in the future…
Well then thanks for the answers and also great job on that engine, it really makes me not care about all that nasty graphics black magic down there and focus more on stuff which is fun to create