Problem with simple transparency

hello everyone,



i’m programing some things in openwonder ( a platform to create collaborative virtual worlds). it uses the jme (version 2).

i need to create some simple transparent sphere.



TriMesh sp = new Sphere(name, new Vector3f(), 25, 25, -12);



BlendState bs =

(BlendState)rm.createRendererState(RenderState.StateType.Blend);

bs.setConstantColor(new ColorRGBA(0.3f,0.3f,0.7f,0.4f));

((BlendState)bs).setEnabled(true);



bs.setBlendEnabled(true);

bs.apply();

Node r = new Node();

r.attachChild(sp);

r.setRenderState(bs);



something like this. some of these lines seem obsolete tho. the problem is that whatever i do the sphere is only transparent from one side. the second prblem is that the color is always grey no matter what i do.

is there something general i need to setup?



regards,

ramin

Warning: I have not used JME2 in over a year, so my knowledge may be outdated. Sorry if this is the case.



IIRC, in JME2, Spheres use the opposite culling direction that other geometry does for backface culling, so you have to use the constructor with the “inside” boolean parameter to make it appear as you want it.



For the blendstate, try using setDefaultColor() instead of setConstantColor()



It looks like you need to set your source/destination blend functions. This might be what’s causing your grey color. Look at one of the JMETests for examples.