Jump to content

The Seventh World - WIP


SpiderPig
 Share

Recommended Posts

I've been working on the foundation for the terrain.  Currently the voxel terrain samples an SDF field to get the basic shape.  It only ever samples what it needs to render so it is very fast.  But, it posses problems in areas such as procedurally placing foliage, buildings, roads and paths as well as calculating erosion to get nicer looking terrain.  While ray-casting the voxel terrain's octree is super fast I can't use that information to place things due to the fact that in the distance lower LOD levels won't give accurate height information.  As the player moves the terrain will change, leaving trees and buildings in the air.  I could update all these things to match the new terrain heights but that'll involve everything popping and moving around during game which I think won't be nice to look at.

What I really wanted to do is create a 3D grid of floats for the entire voxel volume and just use that as the map for the entire volume.  But at a size of 2048^3 that is about 3x10^10 bytes.  Which is... something big in gigabytes.  I can't math today. :P

Subdividing the terrain's octree to store this information (even though it doesn't have to be all rendered at once) will still result in massive amounts of RAM and is just unmanageable.

So I think the only way is to cast my SDF function into a small set of heightmaps.  From them I can perform erosion, calculate normals maps (pass both of these maps to the shader to get some nice results at lower LOD levels) and use these maps to procedurally populate the world rather than ray-casting the octree all the time.

As far as stopping the terrain from intersecting buildings and trees in the distance, I'll have to make the LOD algorithm to be smarter and reduce the poly count in areas where it won't matter too much to be noticeable.

First attempt at ray-casting the SDF field gave more of a mask result.  And it took 10 minutes to calculate! :blink:

FoundationMap_001.thumb.png.31e11682a6195258e2d7261af607d81c.png

Got it to work a bit later though.  These are top down shots and it took about 40 seconds to ray-cast this 2048x2048 heightmap.  I'm pretty sure I can split this into workgroups and give it a compute shader.  I will need six heightmaps.  Once for each face of the cuboid terrain.  This results in a manageable 100MB of RAM / GPU Memory usage.  ^_^

FoundationMap_002.thumb.png.739d5c76c062d9358d06c995ed5f4c98.png

Now I need to make sure I can cast these heightmaps back into the voxel terrain.  Should be easy though.  ;)

  • Like 1
Link to comment
Share on other sites

Got a little side tracked and generated a gravity map.  Red is 0% gravity and green is 100% with all the smooth interprolation between them as you approach the edge of the world.  This is going to be used in the erosion calculations as well which should give interesting results.  I'll add another element to this too - small pockets of reversed gravity where if you go over those, you'll have to be quick to get back down!  I might also make some 0% gravity areas around mountains as well.  Just for a bit of fun. ;)

FoundationGravityMap_003.thumb.jpg.7c1a2bb20dcce54219c3b4283fa595bc.jpg

  • Like 1
Link to comment
Share on other sites

I can't help but notice areas like this.  This is exactly what I wanted and got easily with voxels.  This is a strong gravity area right to the edge of the world and will provided a sharp transition between two gravity regions.  The player can tie a rope too a tree and jump off then quickly fall / land safely in another world. :D

FoundationGravityMap_002.jpg.5207db77392623e4fe0b4966909a82e4.jpg

  • Like 2
Link to comment
Share on other sites

Bonus tip: You can convert the pixmap to BC5 format for compressed normal maps with 25% the memory usage they would have otherwise.

  • Like 1
  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Before starting the towns I had to fix a lot of core things with the voxel terrain.  Now that I've done that I have also fixed a problem in the ray-casting of the SDF causing stepping in the heightmap and thus stepping in the normal map.

Much nicer.  I think it'd look better if the normal map was 4x bigger to give more detail, but I'll assess that after erosion maps and better texture placement are in use.

FoundationMap_003.thumb.jpg.fe8fb37a25ddf94f7df5b106a360a8b5.jpg

  • Like 3
Link to comment
Share on other sites

Finally got normal mapping working correctly.  :wub:

NormalsDoneRight.thumb.png.e637fd6ab71bbe4e13d619bcff0df4ba.png

I'm using debugging heightmaps to identify each world and the square in the top left of each map tells me what the coordinate system should be for that world.  I love it how the edges of each map blend nicely together with no extra work other than just normals.

Next steps;

  • Fix tangent & bitangent maps
  • Re-apply heightmaps and generate rocky heights for the borders between worlds
  • Apply gravity maps & get physics working again
  • Generate biomes according to heightmap stamps used

After all that I can finally start working on gameplay again. :D

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

Working on the skills menu at the moment.   First shown is the old one in Leadwerks, and then the current WIP in Ultra.

Also updated the discord link at the beginning of this thread.

Screenshot_10.thumb.png.727ea09f7cc70ec7a9e3a553c229d96c.png

Current in Ultra;

SkillsMenu_001.thumb.png.d3feb9444da860aa8b7d7f16e845f51f.png

  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...