Problems with Transparency

Hi

are there any known issues about rendering transparent things before other transparent things ???
It’s just this: I get this very strange effect of the one transparent shape un-transparenting the other (making it invisible). This may sound confusing, so here’s a screenshot:

http://www.wi-bw.tfh-wildau.de/~_amueller/screenshots/transparenyTreeError.jpg

The tree consists of several Faces with a texture that also contains alpha values. Now at the places, where a face is 100% invisible the ground (also a Shape with a alpha-texture) gets also invisible. >:(
Also parts of the tree (probably because of that effect) don’t get shown, but they do if I rotate (again probably because of that effect).

Arne

I sthe problem still there whan you render something other on your terrain (just one transparent poly, for example)? Maybe it is connected with the model of the tree. I had similar issues with trees recently (in lwjgl, though) and I found out that the problem was in my model, not in rendering…

This will be because your transparent surfaces are still writing to the depth buffer - even those alpha-0 pixels will update the depth buffer, so objects rendered later are skipped because they fail the depth test. Generally the solution is:

  • render all solid objects
  • turn off depth writing (but leave on depth testing)
  • render transparent objects sorted from back to front

However I’m not sure how you’d go about doing this in Xith. A small cheat (with works rather well) for trees etc. is to use alpha testing instead of blending. Then these can be happily rendered as a normal solid object and the ordering doesn’t matter.

Thank you for your replies :slight_smile:

[quote]A small cheat (with works rather well) for trees etc. is to use alpha testing instead of blending. Then these can be happily rendered as a normal solid object and the ordering doesn’t matter.
[/quote]
Yes! That did the trick :smiley:

For those who want to see how it looks now, here’s a screenshot:

http://www.wi-bw.tfh-wildau.de/~_amueller/screenshots/screenshotTreeWorking.jpg

Arne

This is rather strange since Xith3D pipeline is supposed to render translucent object in a separate pass, sorting them in order to avoid the problem you have encountered.

Does someone has an explanation or is translucency broken in Xith3D ?

Arne, what exactly did you do so the problem disapear? Please post the code change!

Thanks

I’ve simply used these RenderingAttributes:

		RenderingAttributes rAttrib = new RenderingAttributes();
		rAttrib.setAlphaTestValue(0.5f);
		rAttrib.setAlphaTestFunction(RenderingAttributes.GREATER);
		a.setRenderingAttributes(rAttrib);