www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: AGP on May 24, 2014, 08:08:13 am

Title: Software Transparency Isn't Working
Post by: AGP on May 24, 2014, 08:08:13 am
Software transparency isn't working. I haven't tested the hardware in this case, but I am loading the Texture with the alpha boolean. It's not the legacy renderer, either. Have a look at the black rectangles for the crowds.

Code: [Select]
class Crowd {
     private Object3D[] planes;
     private Object3D pivot;
     public Crowd(World theWorld) {
planes = Loader.loadOBJ("Crowd.obj", "Crowd.mtl", 2f);
pivot = Object3D.createDummyObj();
for (int i = 0; i < planes.length; i++) {
planes[1].setTransparency(0);
     planes[i].setTransparencyMode(Object3D.TRANSPARENCY_MODE_DEFAULT);
     planes[i].setTexture("Torcida.png");
     pivot.addChild(planes[i]);
     theWorld.addObject(planes[i]);
}
     }
     public void setChildOf(Object3D parent) {
parent.addChild(pivot);
     }
}

(https://dl.dropboxusercontent.com/u/93826015/TransparencyProblem.jpg)
Title: Re: Software Transparency Isn't Working
Post by: EgonOlsen on May 24, 2014, 11:16:04 am
Should work fine. Maybe the texture simply has no proper alpha. Have you tried with false instead.
Title: Re: Software Transparency Isn't Working
Post by: AGP on May 24, 2014, 08:40:34 pm
The texture has alpha. I did just try with false (not sure what the point was), but it also didn't work.
Title: Re: Software Transparency Isn't Working
Post by: EgonOlsen on May 24, 2014, 11:00:43 pm
In that loop, you are setting only the first plane to transparent. Is that intentionally?
Title: Re: Software Transparency Isn't Working
Post by: AGP on May 25, 2014, 02:02:54 am
No, it's indented differently because I wasn't sure whether the line was needed. The 1 is a combination of an initial typo and the fact that I'm too lazy to get glasses. Thanks. But as a note, the texture lights up when transparent. I had to decrease brightness on the texture itself in order to achieve a proper effect. Is there no way to produce an identical effect to the hardware (just the transparency without affecting the brightness)?
Title: Re: Software Transparency Isn't Working
Post by: EgonOlsen on May 26, 2014, 08:54:31 am
Is there no way to produce an identical effect to the hardware (just the transparency without affecting the brightness)?
If you can use additive blending, then the results should be pretty similar. With the "normal" blending mode, the operation is just different and so is the outcome. I had this issue myself in the past and i reverted to some ITextureEffect that tweaked the textures in case of the software renderer being used. That worked well enough for me.