Jump to content

Recommended Posts

Posted

Hello.

 

I am trying to add fluid pipes with transparency.

I render my pipes in a TESR and tried to add the partly transparent fluids there too.
 

In a forum post about transparency and depth masks (https://relativity.net.au/gaming/java/Transparency.html) I read that the solution would be to:

> 1. Draw the entire scene with depth testing on for all the opaque fragments.

> 2. Draw the entire scene again with the depth buffer read only.

I implemented this for each TileEntity on its own, and they're working somewhat (see first attachment):

fdbagijuvadshgbhaiusdfhaiusdhfgahiousdghaisdfuhgasdioufh.jpg

However, when I'm facing eastwards, the block more far away from me gets entirely replaced by the one closer (see second attachment):

zzzzzzzzzz.jpg

This does not happen with any other block, I didn't test other TEs (see third attachment):

zzzzzzzzzzzzzzzzzzzzzzzzzzzzz.jpg

 

My code is in https://pastebin.com/ezS9RmZ9

 

I guess this happens because the TEs are rendered in the wrong order and because the depth mask is set to read only when the transparent water is drawn.

 

I think this could be drawn by collecting all TEs to render in the render() method and rendering them after I have got all collected in one global run (in the two steps specified above).

 

However, this would result in a huge performance overhead, if I'm not mistaken.

 

Can anybody else help me how I could fix or at least debug this?

Thanks for any help in advance :)

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.