Page 1 of 1

How does Minecraft sort semitransparent blocks?

Posted: Tue Jul 11, 2017 09:51
by wes
I know Minetest does not support semitransparent textures. AFAIK semitransparency is difficult because everything with a semitransparent textures needs to be sorted by distance when it's drawn. Does anyone know how Minecraft sorts its semitransparent blocks? The only solution I can imagine is recreating the VBO for the chunk (block) model as the player moves around it. i.e. if you're standing at the northeast corner of the chunk, it creates the VBO from southwest to northeast so the southwestern blocks are drawn first. (EDIT: That wouldn't even work because it doesn't consider being in the middle of the chunk) Am I over-thinking it? Does anyone know? What do you think?

Re: How does Minecraft sort semitransparent blocks?

Posted: Tue Jul 11, 2017 13:07
by Fixer
Try googling, for example, I found this
https://www.reddit.com/r/opengl/comment ... h_sorting/

Re: How does Minecraft sort semitransparent blocks?

Posted: Tue Jul 11, 2017 16:00
by TumeniNodes

Re: How does Minecraft sort semitransparent blocks?

Posted: Wed Jul 12, 2017 07:06
by wes
Fixerol wrote:Try googling, for example, I found this
https://www.reddit.com/r/opengl/comment ... h_sorting/
You did a better job googling than me. I only found "how to make transparent skins" and "sorting machines" lol

EDIT:
For water and clouds, the traditional methods of handling transparency (e.g. a sort on the object, and separate draw call) are probably your best bet. (but maybe not. profile). The other stuff (ice and the like) is rare enough that this might be good enough for it as well, but it's hard to say with certainty.
Thanks, I think that's the answer

Re: How does Minecraft sort semitransparent blocks?

Posted: Wed Jul 12, 2017 07:18
by wes
Interesting, thanks. There's two rendering passes. Still doesn't explain how the semitransparent blocks are sorted, but because there are less of them there's more options.

Re: How does Minecraft sort semitransparent blocks?

Posted: Thu Aug 24, 2017 13:48
by juhdanad