Transparent sphere lets see thru terrain

The spheres geometry is on the transparent bucket, using a backed TextureAtlas material.

The terrain is a TerrainQuad.

I have read about 5 threads on the subject.
The problem seems related to the Z buffer, and to the drawing priority.

I tried several things like:

terrain.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
terrain.getMaterial().getAdditionalRenderState().setDepthWrite(true);
terrain.getMaterial().getAdditionalRenderState().setAlphaTest(true); 
terrain.getMaterial().getAdditionalRenderState().setAlphaFallOff(0);
terrain.getMaterial().getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
terrain.setQueueBucket(Bucket.Opaque);
terrain.setQueueBucket(Bucket.Transparent);
terrain.setQueueBucket(Bucket.Translucent);

(obs I tried these settings at the app update call, not the app init call)

EDIT: nothing changes to better, and if not changing to worse, here is what I always get when a setting seems to do nothing :frowning:

As you can see, the 2nd sphere sees the wall thru the ground.
The 3rd one sees the void thru the ground where there is no more wall.

Terrain should be in the opaque bucket. Sphere should be in the transparent bucket.

…and you understand that only the last call matters here, right? Things can only be in one bucket at a time.

I ran each of those code lines, one per time, restore previous setting before setting a new one. So I also dont know if I should make some kind of settings combination?

I just added a code to make it sure terrain is/remain at opaque bucket, and it is at opaque.

could it be a limitation/problem/bug of my gfx card in some way then?

Once again… you haven’t addressed which bucket the sphere is in. It HAS to be in the transparent bucket and not the opaque bucket.

1 Like

fixed it!

the sphere seems to have to:

  • be at transparent bucket
  • be Unshaded.j3md
  • be BlendMode.Alpha.

aditionally I can control its alpha as said here too: GUI Picture Transparency - #3 by pspeed
using only the color

  • mat.setColor(“Color”, color);
    or combined with texture (where color should be white to keep texture coloring)
  • mat.setTexture(“ColorMap”, tx);

thx!

I just still do not understand how I got that cool transparent sphere with some kind of shadowing on it, if anyone has any idea it would be cool to know, as all transparencies are now like this that does not show a volumetric feeling:

Well, when you use unshaded, obviously you will have no shading… because it’s… unshaded.

You should be able to use Lighting.j3md also. Your initial problem was entirely a rendering order problem caused by bad buckets.

1 Like

I thought Lighting.j3md was impossible with transparency, never was able to make it work, just found this:
http://wiki.jmonkeyengine.org/doku.php/jme3:intermediate:how_to_use_materials

tomorrow I will see if I can make it work, thx!