I’ve seen the demoes where there is a transparent texture on a cube, but how do you give a shape a color and make it transparent?
I’ve tried this:
Shape3D psiPlane = new Shape3D(TestUtils.createPlane(0.4f, 0.4f, 0f, 0.6f, 0.6f));
Appearance aPlane = new Appearance();
Material material = new Material();
material.setColorTarget(Material.AMBIENT_AND_DIFFUSE);
aPlane.setMaterial(material);
aPlane.setPolygonAttributes(new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0));
TransparencyAttributes ta = new TransparencyAttributes();
ta.setTransparencyMode(TransparencyAttributes.BLENDED);
ta.setTransparency(0.5f);
aPlane.setTransparencyAttributes(ta);
psiPlane.setAppearance(aPlane);
and this code creates a plane that’s like a piece of glass. If you are looking in the direction of the light perpendicular to the plane, then the plane is completely transparent, and the more of an angle you look at the plane, the less transparent the plane becomes.
How would you set the plane to a color so as to give the glass some “tint”?
I commented out the following line:
material.setColorTarget(Material.AMBIENT_AND_DIFFUSE);
and tried the following:
Material material = new Material();
material.setDiffuseColor(new Color3f(.45f, .52f, 1f));
material.setAmbientColor(new Color3f(.45f, .52f, 1f));
material.setSpecularColor(new Color3f(.45f, .52f, 1f));
but then the plane is not transparent at all.
I appreciate any help.
Thanks,
Jason