SpiderPig Posted February 17, 2023 Share Posted February 17, 2023 I have spent the last few hours working on this. Quite pleased with the result. It generates a 512x512 terrain with simplex noise and then erodes it with hydraulic erosion. I used the code found here. I believe I can speed up the code a lot and use a few more threads. First I want to use the erosion data to make a splat map for texturing. Soon I will use this to create terrain for my voxel terrain. Stats are in release mode. Without Erosion: With Erosion: Quote Link to comment Share on other sites More sharing options...
Josh Posted February 17, 2023 Share Posted February 17, 2023 One of the issues I had was that everything tended to form patterns at 0/45/90/135... degrees, because it only read exact pixel values. Ultra has the Pixmap::Sample method, which uses bilinear filtering, so you take a sample from any angle around the pixel you are working on an get an accurate result. 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 February 17, 2023 Author Share Posted February 17, 2023 I don't fully understand the code I implemented yet, but at some stage I will compare them and see what works best. Here's a basic erosion map overlay. I just did something quick, I think the dirt is being shown along the deposit positions. I will need to read through the erosion code to build a better erosion map. Ideally I'd like the flow and deposition maps to be separate channels / textures. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 17, 2023 Author Share Posted February 17, 2023 Green is default, red is sediment deposition and blue is erosion. Longer droplet lifetimes push the sediment further into the valleys and increasing the sediment capacity cuts larger grooves into the terrain. With Textures: I think now I start experimenting with merging different terrain types together and changing textures based on biome as well slope & height. 3 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 20, 2023 Author Share Posted February 20, 2023 The same hills and terrain size but as a voxel terrain. This has the one texture at the moment and currently has flat shading enabled. I will probably need to upload the heightmap to the vertex shader to do smooth shading. I want to try creating vertical cliffs as well as overhangs that can all be part of the erosion process. But we will see. I sample the heightmap like this; float CalculateTerrainSurface(shared_ptr<VoxelObject> voxel_object, shared_ptr<VoxelBrush> brush, VoxelNode* node, Decimal3& position) { auto plane = Plane(Vec3(0,64,0), Vec3(0, 1, 0)); auto x = (int)position.x; auto z = (int)position.z; auto height = terrain_generator->GetHeight(x, z); return plane.DistanceToPoint(position.x, position.y, position.z) - height; } 3 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 20, 2023 Author Share Posted February 20, 2023 I've applied the erosion map to the voxel terrain, but I don't feel like it's telling me what I want to know. It looks like gibberish compared to an erosion mask generated in world machine for the same heightmap. World Machine; 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted February 20, 2023 Share Posted February 20, 2023 Looks like random noise. 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 February 20, 2023 Author Share Posted February 20, 2023 Yeah it does a bit. Actually - it might be because each drop is randomly placed on the terrain with Random(0, terrain_size) and all I'm really drawing to the texture is the positions the drops are falling on... You have given me something to think about... 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 20, 2023 Author Share Posted February 20, 2023 Not quite. But very interesting. 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 20, 2023 Author Share Posted February 20, 2023 And this is 2.5 million iterations. Just curious to see the difference. The heightmap spat the dummy but that's just my exporting skills talking. The erosion map however looks better. Anyway I have a few ideas to try now. 2 Quote Link to comment Share on other sites More sharing options...
Josh Posted February 20, 2023 Share Posted February 20, 2023 It would be really cool if you could convert a heightmap terrain into a voxel terrain and start carving caves. 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 February 20, 2023 Author Share Posted February 20, 2023 That'd would be cool. I'm going to try to do something like that. I'll probably generate a separate cave system beneath the surface with 3D simplex noise and then have it erode through the surface into it somehow. I'm a bit closer with the erosion map now. I'd like to separate the data into 3 layers like world machine. Wear map, flow map, and deposition map. I think the flow map could be separated by using the droplets speed perhaps. 2 Quote Link to comment Share on other sites More sharing options...
Josh Posted February 21, 2023 Share Posted February 21, 2023 Maybe a denoise filter would help: https://github.com/BrutPitt/glslSmartDeNoise I have used this code before. It's good. 2 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 February 21, 2023 Author Share Posted February 21, 2023 Perfect. Thanks! Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 22, 2023 Author Share Posted February 22, 2023 I think I've found the maps now. The flow map needs some noise filtering still. I'll work on that later. Wear Map: Flow Map: Deposition Map: 3 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 22, 2023 Author Share Posted February 22, 2023 I've placed a grass and dirt texture in the flow regions. I think that when these maps are combined with height and slope texturing too they'll look quite nice. @Josh is it possible for me to create a shader for my voxel terrain that supports multiple materials like your terrain system does? 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 23, 2023 Author Share Posted February 23, 2023 Slope mask as calculated in the fragment shader. 2 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 26, 2023 Author Share Posted February 26, 2023 Height mask applied to the generation process. If the mask has values between 0.0 and 1.0 it will form a height gradient. 1 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.