Unfortunately for me, my hardware doesn't support shadows, so I'm trying to implement pseudo-shadows. It's going OK, but the transparency has got my a bit stumped. My texture is an all black JPG (made in Photoshop) with the opacity set to 50%
When the pseudo shadow is rendered, it's white, not black. This is probably something to do with Lights, but I can't figure it out. Any help appreciated!!
A screen grab and code are below. BTW, the program itself is basically a hacked up version of HelloWorld from the Wiki, with the World ambient light is 255,255,255, the code below is almost 100% taken from a forum post (sorry, can't remember who posted it).
--Tim.
private Object3D makePseudoShadow(float transZ) {
Object3D obj = new Object3D( 2 );
float offset = 50; // width / height of the billboard (assumes it is square)
obj.addTriangle( new SimpleVector( -offset, -offset, 0 ),
0, 0,
new SimpleVector( -offset, offset, 0 ), 0, 1,
new SimpleVector( offset, offset, 0 ), 1, 1,
TextureManager.getInstance().getTextureID(
"shadow" ) );
obj.addTriangle( new SimpleVector( offset, offset, 0 ),
1, 1,
new SimpleVector( offset, -offset, 0 ), 1, 0,
new SimpleVector( -offset, -offset, 0 ), 0, 0,
TextureManager.getInstance().getTextureID(
"shadow" ) );
obj.setTransparencyMode(Object3D.TRANSPARENCY_MODE_ADD);
obj.setTransparency(100);
obj.setLighting(Object3D.LIGHTING_NO_LIGHTS);
obj.setAdditionalColor(java.awt.Color.BLACK);
obj.build();
obj.rotateX(-80);
obj.translate(0,0,transZ);
return(obj);
}