about the transparency

Have jReality programming problems or questions? Post them here.
Post Reply
cznlzq
Posts: 17
Joined: Mon 5. Mar 2012, 22:55

about the transparency

Post by cznlzq » Mon 5. Mar 2012, 23:06

Hi,

Currently I'm using the tutorial to learn about the features of the JReality.

When I run the example "LineShaderExample" in package de.jreality.tutorial.app, I found out a problem with the transparency.

You can rotate the circles in the scene in the "LineShaderExample",
however, you will see that the circle 5 and circle 6 will appear before the circle 4 when you rotate some angles.
It looks like the transparency is not handled well there.

So my question is:
is there any setting I was missing?
Or the JReality cannot handle this overlap case for the good transparency for the appearance?

Thank you.
Attachments
notGood.PNG
notGood.PNG (150.67 KiB) Viewed 844 times

User avatar
gunn
Posts: 323
Joined: Thu 14. Dec 2006, 09:56
Location: TU Berlin
Contact:

Re: about the transparency

Post by gunn » Sun 18. Mar 2012, 22:07

The problem lies in the "depth buffer" approach to rendering, which is used by the JOGL backend. You only get correct results when all the non-transparent objects are drawn first, and no non-transparent objects overlap each other (although the latter constraint is not so important as the first). Try changing the code of the tutorial so that the last scene graph (on the right when viewed as a tree) is the one corresponding to circle #4 (child component #3). For example, at the end before displaying, insert

Code: Select all

    	SceneGraphComponent childComponent = world.getChildComponent(3);
		world.removeChild(childComponent);
    		world.addChild(childComponent);

For many situations involving simple geometry, rendering the transparent object last produces correct images. However, the JOGL backend is not appropriate for scenes with complicated overlapping transparent objects.

You can also compare the results with the softviewer by checking the menu item "Viewer->Softviewer". Here the transparency is calculated correctly. One sees that the software viewer and the JOGL viewer do not render all line options the same. In particular, it appears that the ability to disable transparency is not interpreted the same both backends. But that is another matter.
jReality core developer

Post Reply