Page 1 of 1

cylinder transparency

Posted: Thu 12. Aug 2010, 17:18
by argo2185
Hello,

i'm creating a closed clinder with this code:

Code: Select all

SceneGraphComponent stu = Primitives.closedCylinder(10, 5, 10, 10 , Math.PI*2);
SceneGraphComponent sgc = SceneGraphUtility.createFullSceneGraphComponent();
Appearance appearance = sgc.getAppearance();
DefaultGeometryShader dgs = ShaderUtility.createDefaultGeometryShader(appearance, false);
dgs.setShowPoints(false);
dgs.setShowLines(false);
dgs.setShowFaces(true);
DefaultPolygonShader dps = (DefaultPolygonShader) dgs.createPolygonShader("default");
dps.setDiffuseColor(Color.RED);
dps.setTransparency(0.5);
The problem is that the cylinder is not transparent. What i'm doing wrong?
Is it possible to set certain coordinates for the central point of the cylinder and then to translate the cylinder by changing the center position?

Re: cylinder transparency

Posted: Thu 12. Aug 2010, 18:37
by steffen
You have to enable transparency in the RenderingHintsShader:

Code: Select all

RenderingHintsShader rhs = ShaderUtility.createDefaultRenderingHintsShader(appearance, false);
rhs.setTransparencyEnabled(true);
This is because OpenGL does not enable transparent rendering by default. And there is also no depth buffer sorting, so you probably also want to turn on back face culling:

Code: Select all

rhs.setBackFaceCulling(true);
Steffen.

Re: cylinder transparency

Posted: Thu 12. Aug 2010, 22:43
by argo2185
i see. but the u3d exporter does not support transparency for cylinder?

is there an alternative way to create something like a cylinder but with transparency in PDF?

Re: cylinder transparency

Posted: Fri 13. Aug 2010, 10:14
by argo2185
sry, my fault. with the RenderingHintsShader is everything working, also in pdf.