SpiderPig Posted August 4, 2023 Author Share Posted August 4, 2023 Found a shot of the old inventory made in Leadwerks. Ultra is much nicer. 2 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 4, 2023 Author Share Posted August 4, 2023 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. 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! 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. Now I need to make sure I can cast these heightmaps back into the voxel terrain. Should be easy though. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 4, 2023 Author Share Posted August 4, 2023 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. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 4, 2023 Author Share Posted August 4, 2023 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. 2 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 5, 2023 Author Share Posted August 5, 2023 Not 100% convinced the normal map has been generated correctly. But it's better than nothing. I think there is some stepping going on, but that's probably the height-map. I ended up using a sobel operator to calculate the normals. 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted August 5, 2023 Share Posted August 5, 2023 Bonus tip: You can convert the pixmap to BC5 format for compressed normal maps with 25% the memory usage they would have otherwise. 1 1 Quote 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 More sharing options...
SpiderPig Posted August 5, 2023 Author Share Posted August 5, 2023 Breaking out the procedural town generator. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 10, 2023 Author Share Posted August 10, 2023 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. 3 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 12, 2023 Author Share Posted August 12, 2023 Getting some towns in place. 2 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted August 14, 2023 Author Share Posted August 14, 2023 All six sides of the cuboid terrain are cast into their own heightmap so I can now do terrain erosion among other cool stuff. The six sided map is then used to create the voxel terrain. Here is the normal map turned into an atlas ready for the GPU. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted March 1 Author Share Posted March 1 Finally got normal mapping working correctly. 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. 1 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted March 2 Author Share Posted March 2 Heightmaps are applied and look really good. There needs to be more work done on blending the heights together, but for an Alpha this is fine. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted March 4 Author Share Posted March 4 Foliage volume fills the terrain nicely. It needs more work but I'll leave that for now though and start getting the UI back together and working. 3 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted May 17 Author Share Posted May 17 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. Current in Ultra; 4 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.