LWJGL - Voxel Engine

It’s just a value that is calculated to get a bobbing effect - I got the idea from Vermeer who I believe got it from one of nehe’s tuts.

You can just do:

GL11.glTranslatef(-0.05f, 0.9f, 0.4f);

You may have to play around with the values dependant on your camera position.

Yes walkbias is from NEHE’s tutorial. I have scaled it down by 2.3 as the motion does not need to be as pronounced as the full bias of the character.

Thank you all for your help. I used steg90’s method, and it worked. I was expecting something more compilicated with usage of trigonometry to tell you the truth.

My current problem is that from some angles, players cannot see the rest of the blocks through a transparent block. At some points it seems like there are no other blocks behind the transparent ones like water. I don’t know if my explanation is good enough to understand. I am not sure what causes that.

Paul.

To fix this problem (almost):


			GL11.glEnable(GL11.GL_BLEND);
			GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
			GL11.glAlphaFunc(GL11.GL_GREATER, (float) 0.1);

And then you will also have to do depth-sort your chunks.
Then render opaque things front-to-back, and then render back-to-front transparent things.

Example:


List<?> visibleChunks = ???;
Collections.sort(visibleChunks,frontBackDistanceSort);

for(int n = 0; n < visibleChunks.size(); n++)
    visibleChunks.get(n).renderCall(OPAQUE);
for(int n = visibleChunks.size()-1; n >= 0; n--)
    visibleChunks.get(n).renderCall(TRANSPARENT);

  • Longor1996

Thank you all for your help. I used steg90’s method, and it worked. I was expecting something more compilicated with usage of trigonometry to tell you the truth.

My current problem is that from some angles, players cannot see the rest of the blocks through a transparent block. At some points it seems like there are no other blocks behind the transparent ones like water. I don’t know if my explanation is good enough to understand. I am not sure what causes that.

Paul.

To fix this problem (almost):


			GL11.glEnable(GL11.GL_BLEND);
			GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE_MINUS_SRC_ALPHA);
			GL11.glAlphaFunc(GL11.GL_GREATER, (float) 0.1);

And then you will also have to do depth-sort your chunks.
Then render opaque things front-to-back, and then render back-to-front transparent things.

Example:


List<?> visibleChunks = ???;
Collections.sort(visibleChunks,frontBackDistanceSort);

for(int n = 0; n < visibleChunks.size(); n++)
    visibleChunks.get(n).renderCall(OPAQUE);
for(int n = visibleChunks.size()-1; n >= 0; n--)
    visibleChunks.get(n).renderCall(TRANSPARENT);

  • Longor1996

The creator of Dysis (Arktos) got around that problem by rendering chunks in 2 passes.

The first pass is all the normal blocks.
The second is water and all the other semi-transparent blocks

(Make sure all chunks are rendered by the first pass before going onto the second pass.)

Wow, after adding some simple checks to try your solution the game crashes everytime I try to spawn water and this is the error log.

I googled it and some people had this error at minecraft. The possible reason was the graphics card driver, but it is the first time I get this. (Also, first time I use transparency.)

http://pastebin.java-gaming.org/d6d37427e58

Paul.

I used 2 render passes for transparent water etc…

Just tried that and it worked.

Thank you, HeroesGraveDev.

The creator of Dysis (Arktos) got around that problem by rendering chunks in 2 passes.

The first pass is all the normal blocks.
The second is water and all the other semi-transparent blocks

(Make sure all chunks are rendered by the first pass before going onto the second pass.)

Wow, after adding some simple checks to try your solution the game crashes everytime I try to spawn water and this is the error log.

I googled it and some people had this error at minecraft. The possible reason was the graphics card driver, but it is the first time I get this. (Also, first time I use transparency.)

http://pastebin.java-gaming.org/d6d37427e58

Paul.

I used 2 render passes for transparent water etc…

Just tried that and it worked.

Thank you, HeroesGraveDev.

This is the current state of the voxel engine. I am not sure if I will continue working on it.

SIGCNIGiL4M

This is the current state of the voxel engine. I am not sure if I will continue working on it.

SIGCNIGiL4M

You going to rename the title sometime soon? :point:

That is looking and working very well. It seems a shame to stop progress on it, but I guess you have an idea for another game now you have developed all the skills with this.

Or maybe you could do a UI and crafting?

I like your water, looks cool, your project has really developed so far! :slight_smile:

You going to rename the title sometime soon? :point:

That is looking and working very well. It seems a shame to stop progress on it, but I guess you have an idea for another game now you have developed all the skills with this.

Or maybe you could do a UI and crafting?

I like your water, looks cool, your project has really developed so far! :slight_smile: