jPCT - a 3d engine for Java > Support

Transparent Object and ZBuffer

(1/2) > >>

Jakes:
Hello,

I've been working with transparent objects (in this case, sprites with transparent cutout, like leaves and branches), and knowing that transparency doesnt write to zbuffer, I was expecting to experience some known cases, but instead I'm experiencing different results, as you can see below:

Expected results:

Right: Good Result.
Left:   it is known that this scenario could happen when the red circle in the back is drawn last, so the area of the blue circle will then occlude the red circle due to the zbuffer.

Experienced results:

Right: Good Result.
Left: This wasn't what I was expecting, mainly because the red circle in the back should be depth tested and therefore be drawin behind the blue circle, even when using transparency, the only artifcat I should expect would be clipping and not overlapping. Is there any ZbufferCheck not being made when using transparent objects?

Regards,
Jakes

EgonOlsen:
Not sure what you mean exactly. Transparent objects don't write into the zbuffer, just like you've mentioned. If the red circle is depth tested, it's only depth tested against objects that are present in the depth buffer. If both objects are transparent, they will both be tested, but none will write into the depth buffer, so their order depends on their sorting which be correct in some cases but wrong in others. Or didn't I get your question correctly?

Jakes:
Yes, but how do I know if they are being delph checked? is there any option to set that per object?
or are all the objects ignoring the zbuffer when set to transparent by the Object.setTransparent()?

because I'm having the last behaviour instead of the first one, which would be expected, right?

EgonOlsen:
They are all checked but they don't write. Regarding your examples, I'm still sure how to read them. Are these red and blue disc both transparent or just one of it?

Jakes:
Both are transparent planes one in front of the other regarding the camera position.
the order would be:

Red Circle Plane
      ⬆️
Blue Circle Plane
      ⬆️
Camera

Navigation

[0] Message Index

[#] Next page

Go to full version