Translucent?

Now perhaps I'm missing something here, and perhaps I'm not, but when I create an Object and setSolidColor(new ColorRGBA(0.0f, 0.0f, 0.0f, 0.5f)); shouldn't this give me a translucently black/gray object?  Is alpha channels not yet supported or am I doing something wrong?  I am trying to figure out how to create translucent objects with and without textures.



Thanks,



darkfrog

See TestRenderQueue for an example on creating a translucent object.

Yeah, I was monkeying around with the AlphaState just a few minutes ago, but I've got a textured ball that I'm applying this to and it looks good but as it rolls it fades from a darker blue to a lighter blue…just looks strange and unrealistic.  I can put up a WebStart of it if you'd like to see it.



Thanks,



darkfrog

do you have culling enabled?  often translucent items will appear odd if backface triangles are rendered.

Well here is the code segment:



Sphere sphereGraphics = new Sphere("Sphere", new Vector3f(), 50, 50, 3.0f);

        sphereGraphics.setLocalTranslation(new Vector3f(0.0f, 8.0f, 5.0f));

        sphereGraphics.setRenderState(loadTexture("/data/brushedMetal.png"));

        MaterialState ms1 = display.getRenderer().createMaterialState();

        ms1.setEnabled(true);

        ms1.setDiffuse(new ColorRGBA(0,0,1,.75f));

        ms1.setShininess(128);

        sphereGraphics.setRenderState(ms1);

        as = display.getRenderer().createAlphaState();

        as.setEnabled(true);

        as.setBlendEnabled(true);

        as.setSrcFunction(AlphaState.SB_SRC_ALPHA);

        as.setDstFunction(AlphaState.DB_ONE_MINUS_SRC_ALPHA);

        sphereGraphics.setRenderState(as);

        rootNode.attachChild(sphereGraphics);

        DynamicPhysicsObject spherePhysics = new DynamicPhysicsObject(sphereGraphics, 1.0f);

        pw.addObject(spherePhysics);



I copied and pasted what I saw in TestRenderQueue just in case I was missing something in the first test.



Thanks,



darkfrog

Sure, but those are boxes.  Spheres are quite a bit different.  Anyhow, please go ahead and webstart it so I can see what you're up against.

Maybe this thread should be moved to the "Graphics" board?

Yeah, sorry about that…I've just been living in the Physics forum and forgot that anything existed outside of it. :o  Feel free to move it if you'd like.



The WebStart for it is: http://www.pyramex.com/webstart/test2/GameTest01.jnlp



I've been playing with explosions too, so if you hit 'X' you can see verbatim of what I stole out of the ExplosionTest. :-p



Thanks,



darkfrog

Now that this has been moved to Graphics nobody is responding…what's up with that? :-p



Thanks,



darkfrog

Sorry, I looked at the webstart a few days ago and thought, yep, it's translucent…  and yep I see the issue you describe.  :P  I had the same issue too when I was making a translucent sphere to put around the planets in FurBallz to simulate atmosphere (eventually stripped out.)  I believe I was able to get rid of most of the issue by adding a Cull state to the sphere to remove back faces.  The other thing I think I did was try using CompositeSphere instead to try and make the cap circles less evident.  Anyhow, see if those two things help at all.

Thanks, I'll give a little more time to this over the weekend and see if those fix the problem.



darkfrog