Author Topic: Software Transparency Isn't Working  (Read 2166 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Software Transparency Isn't Working
« 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);
     }
}


Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Software Transparency Isn't Working
« Reply #1 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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Software Transparency Isn't Working
« Reply #2 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Software Transparency Isn't Working
« Reply #3 on: May 24, 2014, 11:00:43 pm »
In that loop, you are setting only the first plane to transparent. Is that intentionally?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Software Transparency Isn't Working
« Reply #4 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)?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Software Transparency Isn't Working
« Reply #5 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.