LWJGL - Voxel Engine

I may give it a shot.

Better? Or you have anything else in mind?

I may give it a shot.

Better? Or you have anything else in mind?

89c9Bq1SbWY

*Added a simple sky.


I still have the problem I mentioned some posts before.

89c9Bq1SbWY

*Added a simple sky.


I still have the problem I mentioned some posts before.

If you render the water first at any point, the depth test will prevent terrain being drawn behind it. Draw all solid terrain first. Then transparent things in s second pass. That may solve it

If you render the water first at any point, the depth test will prevent terrain being drawn behind it. Draw all solid terrain first. Then transparent things in s second pass. That may solve it

I already draw the blocks at 2 passes. But it seems that each kind of transparent block need to be renders are different pass. And the problem is that I cant really find a way to do that automatically, yet

Not each kind, you need to render the transparent blocks from back to front.
So you always need to render towards the player.

You only want to render transparent objects back to front but all else from front to back.

Simple rendering order is like this.

  1. Render all opaque. Depth test on. Depth writes On. Front to back.
  2. Render all alpha tested. Depth test on. Depth writes On. Front to back.
  3. Render all transparent. Depth Test on. Depth writes Off. Back to front. Enable blending.(use premultiplied alpha)
  4. Render ui. Depth test off. Depth writes off. Back to front. Enable blending.

These simple rules work 90% of cases.

I already draw the blocks at 2 passes. But it seems that each kind of transparent block need to be renders are different pass. And the problem is that I cant really find a way to do that automatically, yet

Not each kind, you need to render the transparent blocks from back to front.
So you always need to render towards the player.

You only want to render transparent objects back to front but all else from front to back.

Simple rendering order is like this.

  1. Render all opaque. Depth test on. Depth writes On. Front to back.
  2. Render all alpha tested. Depth test on. Depth writes On. Front to back.
  3. Render all transparent. Depth Test on. Depth writes Off. Back to front. Enable blending.(use premultiplied alpha)
  4. Render ui. Depth test off. Depth writes off. Back to front. Enable blending.

These simple rules work 90% of cases.

if youre not working on it anymore, would you be so kind as to release the source? :smiley:

if youre not working on it anymore, would you be so kind as to release the source? :smiley: