Transparency in Android

Hi funbox and nehon,
I am experiencing the same problem with my scene.
Can you please explain how to solve this for android,

Thanks

Okay guys, please can anyone help me?
Here is a screenshot of my problem.

As you can see it is having a problem with the zbuffer or something.
I am currently making use of the unshaded material shader and if I make use with lighting material it works.
Ligting material is not an option for my game on android.
Please help.

You don’t have alpha discard set on the material. That means its writing to the depth buffer even on transparent pixels - so other stuff doesn’t get drawn in.

Thanks, but can you explain how I should do that?
What is the setting? Please?

This is my current code I am using, I have tried multiple combination.
[java] Material mat = new Material(assetManager, “Common/MatDefs/Misc/Unshaded.j3md”);
mat.setTexture(“ColorMap”, assetManager.loadTexture(“Textures/treeflat5.png”));
mat.getAdditionalRenderState().setAlphaFallOff(0.6f);
mat.getAdditionalRenderState().setAlphaTest(true);
mat.getAdditionalRenderState().setDepthTest(true);
mat.getAdditionalRenderState().setFaceCullMode(RenderState.FaceCullMode.Off);
mat.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);[/java]

I think you need to hack the shader. As I understand, alpha fall off doesn’t work on Android and the “AlphaDiscard” material parameter doesn’t exist (yet) on Unshaded. (Unless @nehon added it and I forgot.)

Hi.
The alphadiscard property is in the unshaded material def, but it is not exposed to jme.
I have tried to build it in by making a copy of the unshaded material and exposing it, but I have no luck in getting it to work.
Any help will be much appreciated.

<cite>@ndebruyn said:</cite> Hi. The alphadiscard property is in the unshaded material def, but it is not exposed to jme. I have tried to build it in by making a copy of the unshaded material and exposing it, but I have no luck in getting it to work. Any help will be much appreciated.

If it’s in the material def then you can set it. Please run through the material tutorials… setting a material parameter is a pretty basic thing.

I know how to do it, my problem is that it did not solve the problem.

uh actually the discard threshold is not supported by the unshaded material and alphafalloff won’t work on opengles.
I’m gonna add the alphathreshold support to unshaded once and for all.

1 Like

Should be ok now.

1 Like

Will this be in the latest nightly? Or can I get it now?

<cite>@nehon said:</cite> Should be ok now.

Nice one Remy

[java]// Apha threshold for fragment discarding[/java]

Should be “Alpha” tho :slight_smile:

<cite>@wezrule said:</cite> Nice one Remy

[java]// Apha threshold for fragment discarding[/java]

Should be “Alpha” tho :slight_smile:


lol, the typo was in Lighting.j3md and i copied it along :stuck_out_tongue:
So from my point of view it’s pretty consistent :stuck_out_tongue:

<cite>@ndebruyn said:</cite> Will this be in the latest nightly? Or can I get it now?
in latest nightly, i'm afraid.

Thank you so much.
I will get the code from the svn and then test it.
Will let you know, sooner than later.
Cheers

Okay people, I have tested this from my side and it works perfectly.
Thanks nehon, as always you don’t disappoint…

:affe:

My pleasure :wink:

<cite>@nehon said:</cite> lol, the typo was in Lighting.j3md and i copied it along :p So from my point of view it's pretty consistent :p

ok, I will let you off this one time :slight_smile:

After trying most things in this thread to solve the issue. Using this code works on my SGS3
[java]

geo.getMaterial().setFloat(“AlphaDiscardThreshold”, 0.5f);
[/java]
It seems that android does not recognize the
[java]
.setAlphaFallOff()
[/java]
function

EDIT: using jme 3 RC2

@mr.ljwilliams said: After trying most things in this thread to solve the issue. Using this code works on my SGS3 [java]

geo.getMaterial().setFloat(“AlphaDiscardThreshold”, 0.5f);
[/java]
It seems that android does not recognize the
[java]
.setAlphaFallOff()
[/java]
function

EDIT: using jme 3 RC2

Yes, setAlphaFallOff() doesn’t work on Android as was mentioned at least three times in this thread already. I guess it’s nice to summarize again, though.