- Home /
What is the best way to generate water bodies in a procedurally generated world?
Ok so I have a world generated with Perlin noise. The world is flat, I use the Perlin noise (with the x & z position as the input) to set the mesh vertices Y position to either 3 if the Perlin value is above a certain ground threshold value or to 0 if its less than the threshold value. I have a 2d int array for all the chunks with 1 if the vertex is ground vertex and 0 if its not. With this rule I can achieve a flat world with valleys for water. I want the water to extend out of the map bounds so I don't just empty void when im at the edge of the map.
In this particular situation what is the best way to go about creating water for this world? the water needs to be chunkable since the world can be pretty big, up to 2048x2048. Note currently I have two methods of loading/unloading chunks: CPU multi-threading and Compute Shader GPU multi-threading, after testing the two, GPU yields a better result.
Heres a screenshot of the world :
Answer by Llama_w_2Ls · Nov 07, 2021 at 08:29 AM
Run the same mesh algorithm using the same perlin noise on another object, but if the perlin noise value is less than the threshold, set the y pos to like 2, and if greater, set it to 0. This will create the opposite effect as the ground, and will fill in all the holes with water instead.
Or just have a massive plane that extends outwards for a long time. If you want water-looking terrain, or simulated water, you might want to look at a water shader, or if you want blocky but simulated water, look into cellular automata.
Your answer
Follow this Question
Related Questions
Procedural Terrain Merge 1 Answer
How to create voxel-based procedural terrain 1 Answer
How do i Offset a Shader Graph material? 0 Answers
For loop not starting from zero 0 Answers