oh yeah, and to that idea he metioned at the end of the video i say, create an algorithm that roughly simulates the physical and chemical processes, which take place to form the different sediments in the first place ;)
Thats not that hard to implement, i reckon. I suppose there is a part where the amount of erosion is calculated as some sort of value, that value could be multiplied by some value from a 2d array like a pixel value, normalized, of course. Shouldn't be hard to implement in theory
Hi, the guy from the mentioned paper here, I actually did implement this. It is briefly mentioned in section 5.2 in the paper. What I experimented with was multiple layers of terrain, basically just a stack of heightmaps, each with a different hardness. When the top layer had 0 material left, I started to erode the next layer and so on. but deposited sediment always got put in the top most layer, which was very soft as to represent sand. That way hard rock also got turned to sand , kind of. I also tried to implement it based on 3D noise. With just a 2D noise map I did not really like the results, it was too obvious and unnatural. But this needs a lot of parameter tweaking to get nice results. In the end my time ran out to finish the paper, so I didn't experiment with it anymore.
@@BillieJoe512 awesome, thanks for the explanation! Definetely have to take a look at your paper.. one question: did you think about the possibility of cave-forming? I also had the idea of multiple 'ground'-layers in mind, pointing directly downwards from the uppermost layer, but the possibility of caves seems to add a lot of complexity to this.. I guess with a 3d-noise-map it would be possible, but would still require some considerations..
You would introduce lag if you are creating new land and then changing it afterwards to simulate erosion. Also, I suspect there would be an issue with water drop size and distribution if the idea was to have in-game rain erode the land after generation. Things like World machine do make the land look great zoomed out, but in-game you would be hard pressed to notice much difference between that and vanilla or one of the popular biome mods
@@Ironbuket if you trained an AI to create similar hight maps to images fed from this guys video, it could blend the Y height of each surface block in minecraft with the Hight map to create a "simulated" terrain generation without the extra lag that comes from the simulation. basicaly deep-faking heightmap "faces" onto the terrain.
While this is true, in many games terrain like this isn't very desirable, it's harder to limit traversal, this erosion by it's nature tends to create slopes that aren't that steep, and flat areas, authored terrain, while less natural, gives more freedom with how the designers want the player to navigate through it. There are often gameplay considerations on top of the art.
@@DreadKyller A friend of mine made this mountain in Minecraft, what do you think of it? www.reddit.com/r/Minecraft/comments/gjnya5/a_mountainous_landscape_i_just_finished_today/
@@DreadKyller I wonder if that's true. While this method changes the texture of the terrain a lot, it doesn't change the overall shape much. So the initial heightmap could be designed to specific design parameters before the procedural engine takes over.
@@DreadKyller It will be applicable in future's procgen games - games like NMS or Elite (not now, but when atmospheric planets are implemented) could use this heavily.
I hadn't realized how critical erosion was to proper-looking terrain until I saw the before and after images side-by-side. It was a big improvement. Well-done!
Then you can implement things like "a surface with vegetation will erode less then a rock/soil surface", "vegetation doesn't grow above a certain altitude", implementing different hardness for the soil...
yes ,......... the Algorithm also this factor considered.................................... while eroding (amount to erode) * p_factor...........at a point this p_factor vary from 0 to 1f - 0 means no_erosion(Like Rock) - 1 means complete erode
I'm not sure that vegetation slows down erosion in the real world. Real erosion of solid rock is mostly due to frost, so it tends to affect areas that are saturated with moisture. And the roots of plants can act like crowbars as they needle into rock fissures, pushing things apart.
I'm a geologist learning programming as a hobby This is just the kind of inspiration I need. The after-simulation terrain looks so much more realistic. Very well done.
Hey Sebastian, I just saw you uploaded this video today and I wanted to say thanks for all your videos! I have been following some of your series (the blender animation; the procedurally generated terrain) and wow, I simply have not seen another TH-camr delve this deep into these Unity topics as far as you do. You explain everything very clearly, go at a very good pace, and the videos are just really good quality. This is the kind of stuff you would take an expensive class for, it's so good! Keep up the great videos!
Sebastian, what you're doing is absolutely amazing! That terrain looks incredible. As a passionate computer science student, you motivate me to try out new experiences like that more! Keep going you're amazing :)
this kind of stuff (hydraulic action, land formation, weathering, etc) really fascinates me, so it's awesome to see you simulate it and be able to adjust variables and time. Really cool XD
This is amazing, it looks so much more real. I never thought about it consciously, but mountains have always had a weird look to them, and that has to be why. I don't get out a ton, but every time we drive by the mountains, I see really similar patterns. It was immediately recognizable, I had to pause in awe. The before is vaguely recognizable too, as terrain I've seen in (especially older) games a lot. To think you can have it improve on it that much with just .75 of a second is amazing to me.
ahh, it is so interesting that an untrained eye does not even recognize what is missing on the terrain before the water-simulation. But this texture that is being formed by your simulation makes it look vastly more realistic!
As someone with no more than a basic understanding of programming this video was really well presented and easy to follow. I was able to grasp the concept and the results were fantastic to watch happen, it was pretty entertaining.
Ugh! You solved this problem way better than I did. I'm gonna adjust my solution, then work on perfecting my method for generating rivers: - Store a copy of the initial terrain heightmap and shift all points downward 1-2 meters, give it a water texture - Each time a droplet flow direction is generated, add it to a normalized flow field map - Use the flow field map to create a dynamic scrolling texture shader for the water terrain The parts of the original terrain that were impacted the most by the erosion process should reveal "holes" where the water terrain pokes through, and that terrain should show the water moving downhill.
Another thing to consider in this is wind erosion. Climate, season, and weather manipulation could also add a lot of realism to this. Then use PhysX fluid simulations to find where rivers and lakes should be. Vegetation also adds to how terrain develops over time. It'd be cool if you could export all of this into a game engine, then make it to where the game engine itself can procedurally generate random terrain based on all of these factors.
I am doing my senior capstone on generating realistic terrain but unfourtunetly I had such little time to actually work on it. This is so much cooler than anything I have ever done and am now feeling jealous. Nice job hahah
"Coding adventures isn't as exciting as it sounds, It is just a thing where I share my little projects" I watch these Coding adventures as if there my top 3 fav shows combined
Wouw, Sebastian you are quite an inspiration for me as a coder. I have been following your videos for a while now and you just keep doing baffling work. Your procedural world series got me through my thoughest assignment ever, and I couldn't be more grateful. And now this, this is just amazing. Your ability to use research and experience to create truly new and impressive work is astounding.
Just tried integrating the terrain compute shader from this with the infinite terrain generator from an earlier series (still sad that eps22+ of that were never made). It looks like, if you've got a bunch of terrain chunks to calculate, it's quicker to do CPU calculations parallelised across multiple threads than sequential ComputeShader calculations (which have to be called from the main thread). Also, just a big thumbs up to all of these tutorials. As someone with 20+years professional coding who picked up C# and game writing barely a year ago, I find far too many Unity tutorials assume you know all about game dev and nothing about coding, or nothing about either and don't want to be bothered with code. Sebastian's work pretty much hits the right balance for me.
when stuff gets broken down into steps like this it shows how simple things can be, it just takes the right kind of mindset to set out about setting up the steps. i need more vigilance. but you have inspired me
Oh man, your channel is awesome. I came across it today and cannot stop watching your videos. There are plenty of youtubers teaching programming or game development but what you are doing here is so explorative and so cool. Keep up the good work, genius!
@@brendankapp5237 Its time to implement my evil plan by the suggestion and learn from it :) I have a couple of projects that can incorporate compute shaders perfectly e.g. (th-cam.com/video/36kmJCELT0w/w-d-xo.html This example is on cpu). I learned most things a while back but didn't get to actually implementing things in my projects as I didn't have time. I was using 2D textures but I think I will switch to compute buffers as they are more flexible. Maybe I will try something in the next weekend and see how it goes :)
The complexity and depth of the topic and its research and implementation is just phenomenal. I needed to re-watch the video several times to fully understand it, but it's extremely interesting nonetheless. Looking forward to more coding adventures!
This is astounding and yet not that complex... and generating random terrain with the different resolutions of noise is ingenious! I'm going to try this myself and see if I can do anything else with it...
It's called "Perlin Noise", named after Ken Perlin. It's also worth looking into Simplex Noise, which avoids some of the limitations of Perlin Noise, can be faster to calculate, produces better results, and is not patent encumbered (Ken Perlin patented his method, although I think the patent has expired by now).
Hey Sebastian ! Ive been watching your tutorials for quite a while now and now i just have to write this. Thank you so much for sharing your knowledge ! The things one can learn from you are beyond any value and tought in a very competend way. I spent some time following your tutorials about procedural mesh generation since i am working on a strategy game. I learned a lot from you and applied the stuff to unitys terrain system. After that i started to expand and alter the code and searched for ways to implement hydraulic errosion. Thou i found the paper you are referring to as well, seeing this now is just so awesome ! If of any interest, I changed the first noise octave to a ridged noise to get something more like mountain ranges, maybe that is interesting for someone. I have a question though ... is there a reason to use a mesh object instead of unitys terrain ?
Thanks, happy my videos have helped you! Not really -- I used to dislike the terrain system, but apparently it's much better now. I should really take a look :P
This was awesome! It makes such a transformation on the terrain that makes it more natural, more smoother where it should be. This is so difficult to achieve on 3d modelling in a natural way. Really incredible!
Add up the number of times that a precipiton has passed through each pixel. Use that information not only to determine the reduction in elevation, but also(perhaps in combination with local flatness/slope)a “wetness index” to feed into a vegetation algorithm.
You're a wizard Harry. Seriously though, I wonder how you manage to find the logic behind such cool-looking results. My brain doesn't even meet the minimum requirements to do half the work you did here. I think I'm gonna try the project you uploaded on your Github, it looks promising. Have fun with that project :)
This looks awesome! It reminds me of someone who created an application that not only generates terrain, but also speculates where rivers would form, where people would establish settlements, which settlements would grow into bigger cities, what path would become roads and even added a name generator with some very complex linguistic rules.
oh my god thats so fucking amazing. it honestly kinda motivates me to do things like that on my own as well. like, observe something on nature and try to recreate it in unity with some kind of algorithm that someone has published on a paper or something. i bet watching the end result working is the best feeling ever
Well… It's a good start! Your going to be limited to certain types of techniques though, if you stick with only using a height map. To get really realistic terrain, you'll need to move to volumetric pixels, or some way to simulate voxels. (You might be able to simulate voxels for the purpose of erosion, because the really relevant part of using voxels, is the exposed surface of the voxel terrain, because that's where the erosion is happening. So if you had multiple planes of different materials, with both a height map for depth, and a masking/clipping layer for presence, you have whatever is sticking up above the surface of the other layers, take the erosion, and effectively protect the layers below it.) You should also consider how plant life impacts erosion, because I happen to know that it has a very significant effect. A carpet of grass will dramatically slow soils from eroding, and plants can also contribute to eroding rock, if there are any cracks where roots can get into. And constantly flowing water will also make it hard for plant to grow, such as is the case with rivers and such. And consider that plants have a much harder time growing on different materials. You should look up some information on how the first plants and fungus got their start on this planet. There was apparently some type of organism that evolved to very, very, slowly, digest bare rock. And it would pile up, creating a foundation for the first stiff plants to grow in.
That's really cool stuff, I've been looking into trying this myself at some point but I never got to it. There are a bunch of other erosion mechanics that can be implemented alongside this as well, to add further detail. Also, unrelated to the video really, but I saw in another comment that the animation on the intro was Delaunay Triangulation. I've been trying to understand how that crap works for a while now and I don't seem to get it; and all the videos on TH-cam about it either don't actually explain anything, or are awful attempts at it.... Could you make a video about it maybe? It'd be super useful for a lot of procedural mesh generation problems!
I really love this project. The difference between the raw model and when it was simulated was so big. It looks so much more realistic. Imagine that he would add generated trees and snow, and added a hightboundary for the grass.
Also, could this hydraulic erosion be procedurally generated? Can the program make a high-def normal map, reduce the vertices for easier computing, and then project the normal map to give the illusion of a higher def terrain? Very curious...
@@moth.monster maybe he works in a field that would benefit from this or maybe he wants to build a mountain house and he wants to try to find the best spot for it and generations to come the graphics card isn't all for games
The graphics looks like unity, there are unity files in your repository, and the manual says to open in unity... so why is the project a vscode project?
You Sir, are a gentleman and a scholar. Thank you so much for all your work and the fact that you always give us the source code so we can learn how you did your stuff. I've been working on my game for 5 years and I must say without you there's no way I'd be this far. Thank you so much!
@@SebastianLague You should make a video about how it works, there are no real good explanations that I could find, that weren't either awful explanations, or so deeply technical I couldn't wrap my mind around them anyway. To see a walkthrough of an actual code implementation would be awesome!
1 . set of random points 2 . Triangulate them by Triangle_splitting_Algorithm................... 3 . a . now loop through all Triangle .......... make a circle b . check if neighbour point to triangle is inside..........or............on && outside The circle c . Flip edges Accordingly _......................till none remains
No joke but this is EXCATLY what I was looking for. I'm currently developing a game that is based in an area of the United States that had extensive mining operations along with erosion. With some tweaks, your experiment is most likely going to make my game world look incredibly realistic. Thank you for sharing this online.
This is incredible. This is so incredible you have no idea. I'm so happy you're starting a new series just dedicated to *cool stuff*, really looking forward to it!
I actually wrote my thesis on something very similar, it was an interactive terrain simulation. I completed it the same time as the referenced paper, I think everyone must have had the procedural terrain bug from watching the No Man's Sky trailers. It was a combination of several different systems, a simple vegetation model, a heightmap-based water simulation with an erosion and deposition model, a soil slippage model and a simple weather model. Definitely something I need to revisit.
Another helpful factor: during inundation, because MANY droplets are falling simultaneously, they merge and form a coherent LARGE channel, which will give your mountain ridges more varied, fractal distribution of ripples, instead of the 'straight hair' look that the current method produces. You'll be able to tell the difference when you look carefully at the pattern of flow - your current model produces numerous parallel small channels, while actual mountains produce 'fronds' that merge into larger streams and rivers.
this saved our lives and helped greatly with the project we’re doing for school. otherwise we would’ve slit our wrists!!!1!1! sending love from Czech Republic :)
Hi I just want to tell you that I'm a physicist who works in a really prestigious place, and that I'm impressed by how you make all these complicated(mathematically and physically) things come to life using unity, looks amazing
One episode back I thought "nah, this terrain isn't real because there's no erosion", but then I saw this. I watched several videos and was impressed by the relative simplicity of coding. I program in Python as my day job, and it does get complex, but things are linear and straightforward unless you consciously dive into multiprocessing. I tried VB/VBA/VC++Builder years ago, but long time did not approac IDEs, because of the steep learning curve and finally low returns in the perspective. 3DMax/Blender-like UI also scares, compared to Sketchup (because the latter you can learn by just poking around), but probably with a reachable goal in the end one can get over the complexities. Thanks for these introductions!
I have literally never coded or watched a coding video but this was in my recommendations and I actually enjoyed it. Keep up the good work, and I look forward to seeing many more adventures with you!
You are such an amazing game developer, programmer and content developer, Sebastian! Thank you so much for sharing all of these with us. It feel's so good to know i can come to your channel to get awesome tutorials with great practices. Also, it may sound a bit, silly? But even though i really like Unity, because i love programming, i'm very afraid of it hindering my progress as a programmer because it "does too much for me". But, thanks to you, i can remember that it just allows me to focus on other things, and not have to worry myself about some things like graphics (which is a fascinating area on its own!) and still come out with quite complex ideas. Thank you so much from Venezuela!
as a Geographer I find this approach very appealing, and the result is surprisingly accurate. it can be improved of course by incorporating hydraulic head(momentum works ok enough), different rock and soil erosion resistance, subsurface flows(voxels prbly) etc. however I assume you quickly run into diminishing returns in simulationist approach. lots of detail and effort for very little visual difference.
There are so many things that could influence your pre-rain terrain: astral bombardment, wind, waves. Honestly, I don't know if there ever was a period in Earth's history, other than when Earth was still molten and coalescing, when rain did not coexist with all the other forces acting on terrain. I hope that isn't overwhelming. I'd enjoy watching this project continue.
Another factor which effects how rocks erode which other commenters haven't mentioned is (an)isotropy. Rocks typically form with a non-uniform fracture orientation based on the stress environment during the formation of those fractures. So rocks in a certain mountain range might be more likely to fracture along non-uniformly oriented planes. I don't know the coding side of it, but I think something in that direction could add a certain "naturalness" to the appearance of the landscape.
The terrain looks absolutely awesome after the simulation
Ikr?
@@porsellaAh yes, as we know, realism = aesthetics, almost like you didn’t take a single art class in school
@@jubite9565 What is this comment even? ofcourse realism = aesthetics. we life in a world full of beauty after all
@@timonix2 Realism does not equal aesthetics. One google search.
@@timonix2 we life 😂
Maybe other than just a height map, you also make a "hardness map" for how much erosion takes place
That would be so cool, could get plateaus, vistas, plains etc!
oh yeah, and to that idea he metioned at the end of the video i say, create an algorithm that roughly simulates the physical and chemical processes, which take place to form the different sediments in the first place ;)
Thats not that hard to implement, i reckon.
I suppose there is a part where the amount of erosion is calculated as some sort of value, that value could be multiplied by some value from a 2d array like a pixel value, normalized, of course. Shouldn't be hard to implement in theory
Hi, the guy from the mentioned paper here, I actually did implement this. It is briefly mentioned in section 5.2 in the paper. What I experimented with was multiple layers of terrain, basically just a stack of heightmaps, each with a different hardness. When the top layer had 0 material left, I started to erode the next layer and so on. but deposited sediment always got put in the top most layer, which was very soft as to represent sand. That way hard rock also got turned to sand , kind of.
I also tried to implement it based on 3D noise. With just a 2D noise map I did not really like the results, it was too obvious and unnatural. But this needs a lot of parameter tweaking to get nice results. In the end my time ran out to finish the paper, so I didn't experiment with it anymore.
@@BillieJoe512 awesome, thanks for the explanation! Definetely have to take a look at your paper.. one question: did you think about the possibility of cave-forming? I also had the idea of multiple 'ground'-layers in mind, pointing directly downwards from the uppermost layer, but the possibility of caves seems to add a lot of complexity to this.. I guess with a 3d-noise-map it would be possible, but would still require some considerations..
"multiplied by the wrong variable"
*nod nod* Definitely a programmer.
I get it? Don't you?
Lol
How do you do that?
@@SilasC 1 asterisk on each side of the word or phrase
You either feel like you downed 5 bottles of nyquil, or 5 cans of red bull. There are no in betweens.
That's quite incredible :) ! The complexity of what you're doing blows my mind away. I sure look forward to joining you on more coding adventures !
Thanks Noa :)
I just wish I could code on he's level.
@@conan5743 practice, practice, practice, practice, practice, practice, practice and more practice...
@@SeppahBaws Well, not practice. Research.
@@1234macro Well, not only research. BOTH practice AND research!
One day, geologically accurate Minecraft terrain generation would be a reality.
...jay?... i guess?
You would introduce lag if you are creating new land and then changing it afterwards to simulate erosion. Also, I suspect there would be an issue with water drop size and distribution if the idea was to have in-game rain erode the land after generation. Things like World machine do make the land look great zoomed out, but in-game you would be hard pressed to notice much difference between that and vanilla or one of the popular biome mods
Yeah, its called Dwarf Fortress XD
@@Ironbuket if you trained an AI to create similar hight maps to images fed from this guys video, it could blend the Y height of each surface block in minecraft with the Hight map to create a "simulated" terrain generation without the extra lag that comes from the simulation. basicaly deep-faking heightmap "faces" onto the terrain.
We, the people of Minecraft, will annihilate you and your supporters as heretics...
Sometimes TH-cam recommendations can take you to a magical place. Holy shit.
Willmakk Tell me about it! I have never watched none of this kind of videos and now im like whaaaat this is so cool!
4:15 looks better than almost any mountain I've seen in a game ever.
While this is true, in many games terrain like this isn't very desirable, it's harder to limit traversal, this erosion by it's nature tends to create slopes that aren't that steep, and flat areas, authored terrain, while less natural, gives more freedom with how the designers want the player to navigate through it. There are often gameplay considerations on top of the art.
@@DreadKyller A friend of mine made this mountain in Minecraft, what do you think of it?
www.reddit.com/r/Minecraft/comments/gjnya5/a_mountainous_landscape_i_just_finished_today/
@@DreadKyller I wonder if that's true. While this method changes the texture of the terrain a lot, it doesn't change the overall shape much. So the initial heightmap could be designed to specific design parameters before the procedural engine takes over.
@@DreadKyller but this may a be a really good generator of an inacessible area that you'll simply see changing as a background
@@DreadKyller It will be applicable in future's procgen games - games like NMS or Elite (not now, but when atmospheric planets are implemented) could use this heavily.
I hadn't realized how critical erosion was to proper-looking terrain until I saw the before and after images side-by-side. It was a big improvement. Well-done!
2:40 "Which brace placement style do you use?"
Sebastian: "All of them. At the same time!"
@Sushifu ?
@Sushifu what do you mean? I didn't get the joke.
Then you can implement things like "a surface with vegetation will erode less then a rock/soil surface", "vegetation doesn't grow above a certain altitude", implementing different hardness for the soil...
yes ,......... the Algorithm also this factor considered.................................... while eroding (amount to erode) * p_factor...........at a point
this p_factor vary from 0 to 1f
- 0 means no_erosion(Like Rock)
- 1 means complete erode
@@oren7404 rocks definitely erode. Should be like 0.05 erosion on big vegetation, and 1 in high altitude rocks
hey maby you could do that, the code is in the description :^)
I'm not sure that vegetation slows down erosion in the real world. Real erosion of solid rock is mostly due to frost, so it tends to affect areas that are saturated with moisture. And the roots of plants can act like crowbars as they needle into rock fissures, pushing things apart.
@@nagualdesign Vegetation definitely stabilise the soil, look it up.
I'm a geologist learning programming as a hobby This is just the kind of inspiration I need. The after-simulation terrain looks so much more realistic. Very well done.
Yes, yes, yes! Please do this with voxels! That was absolutely awesome!
Hey Sebastian, I just saw you uploaded this video today and I wanted to say thanks for all your videos! I have been following some of your series (the blender animation; the procedurally generated terrain) and wow, I simply have not seen another TH-camr delve this deep into these Unity topics as far as you do. You explain everything very clearly, go at a very good pace, and the videos are just really good quality. This is the kind of stuff you would take an expensive class for, it's so good! Keep up the great videos!
Thank you :)
I completely agree, His work is simply inspiring and I love your procedural videos. Amazing work man! ❤
agree, although I have finished the series yet, I found Seb's topics brings me the fundamental part of fun, interesting and challenge of coding to me.
"Welcome to Coding Adventures, a series which is probably a lot less exciting than it sounds." That is most definitely not true!
agreed
Magnificent. The result looked so natural, it was very satisfying.
Me: **has never coded in my life**
Sebastian: **makes a tiny mistake**
Me: Ah yes, a trivial mistake, I too have struggled with this
It's such a beautiful moment when we are getting more accurate with terrain generation.
0:03 it is a lot more exciting than it sounds, hence why im rewatching all your videos instead of studying
Thats so cool. Finding a video on a random youtube streak that takes advantage of a paper produced at "your" university.
That's what i just thought!
Sebastian, what you're doing is absolutely amazing! That terrain looks incredible. As a passionate computer science student, you motivate me to try out new experiences like that more! Keep going you're amazing :)
this kind of stuff (hydraulic action, land formation, weathering, etc) really fascinates me, so it's awesome to see you simulate it and be able to adjust variables and time. Really cool XD
Wow, that simulation did wonders for the terrain! I had no idea just how much of a difference a thing like this would make.
This is amazing, it looks so much more real. I never thought about it consciously, but mountains have always had a weird look to them, and that has to be why. I don't get out a ton, but every time we drive by the mountains, I see really similar patterns. It was immediately recognizable, I had to pause in awe. The before is vaguely recognizable too, as terrain I've seen in (especially older) games a lot. To think you can have it improve on it that much with just .75 of a second is amazing to me.
i have watched this video tens of times and i still love it
ahh, it is so interesting that an untrained eye does not even recognize what is missing on the terrain before the water-simulation. But this texture that is being formed by your simulation makes it look vastly more realistic!
As someone with no more than a basic understanding of programming this video was really well presented and easy to follow. I was able to grasp the concept and the results were fantastic to watch happen, it was pretty entertaining.
Very cool stuff...way over my head on the calculations, but very interesting to hear how you came up with the solution. Thanks for sharing.
That's the first thing to realize that most calculations already exist its just finding the right ones to meet your need that's the big task
I'm so incredibly impressed by your procedural renders. Please keep doing these in this format and at this length.
Voxels with different densities and cohesive stability (and color) could produce some spectacular terrains.
Ugh! You solved this problem way better than I did.
I'm gonna adjust my solution, then work on perfecting my method for generating rivers:
- Store a copy of the initial terrain heightmap and shift all points downward 1-2 meters, give it a water texture
- Each time a droplet flow direction is generated, add it to a normalized flow field map
- Use the flow field map to create a dynamic scrolling texture shader for the water terrain
The parts of the original terrain that were impacted the most by the erosion process should reveal "holes" where the water terrain pokes through, and that terrain should show the water moving downhill.
Another thing to consider in this is wind erosion. Climate, season, and weather manipulation could also add a lot of realism to this. Then use PhysX fluid simulations to find where rivers and lakes should be. Vegetation also adds to how terrain develops over time.
It'd be cool if you could export all of this into a game engine, then make it to where the game engine itself can procedurally generate random terrain based on all of these factors.
I am doing my senior capstone on generating realistic terrain but unfourtunetly I had such little time to actually work on it. This is so much cooler than anything I have ever done and am now feeling jealous. Nice job hahah
"Coding adventures isn't as exciting as it sounds, It is just a thing where I share my little projects"
I watch these Coding adventures as if there my top 3 fav shows combined
Wouw, Sebastian you are quite an inspiration for me as a coder. I have been following your videos for a while now and you just keep doing baffling work. Your procedural world series got me through my thoughest assignment ever, and I couldn't be more grateful. And now this, this is just amazing. Your ability to use research and experience to create truly new and impressive work is astounding.
I finally found a video where all the comments aren't memes or "Why did I get recommended this". Blessed
Ill make sure to cross you off the Area 51 raid list...
Why did I get recommended this?
People who comment like you are part of the problem
Just tried integrating the terrain compute shader from this with the infinite terrain generator from an earlier series (still sad that eps22+ of that were never made). It looks like, if you've got a bunch of terrain chunks to calculate, it's quicker to do CPU calculations parallelised across multiple threads than sequential ComputeShader calculations (which have to be called from the main thread).
Also, just a big thumbs up to all of these tutorials. As someone with 20+years professional coding who picked up C# and game writing barely a year ago, I find far too many Unity tutorials assume you know all about game dev and nothing about coding, or nothing about either and don't want to be bothered with code. Sebastian's work pretty much hits the right balance for me.
I cannot wait for the tectonic based voxel terrain. Cool video!
when stuff gets broken down into steps like this it shows how simple things can be, it just takes the right kind of mindset to set out about setting up the steps. i need more vigilance. but you have inspired me
You think we might not like it
I JUST SUBSCRIBED, I LOVE THIS
The MIT licensed code is the cherry on top of this video. Thank you for your generosity, and for helping spread innovative ideas for unity.
How dare you to be so amazing!! Now you leave me no choice but to worship you and follow you channel!
Oh man, your channel is awesome. I came across it today and cannot stop watching your videos. There are plenty of youtubers teaching programming or game development but what you are doing here is so explorative and so cool. Keep up the good work, genius!
This would be a great candidate for compute shaders tutorial.
Or it could be used to showcase Unity's new Burst compiler
@@torginusTrue... overall, though. I think GPU would win if you scale the map to bigger size.
@@mustafageo You would need to tweak the simulation a bit, but you could definitely get some great performance out of it.
@@brendankapp5237 Its time to implement my evil plan by the suggestion and learn from it :) I have a couple of projects that can incorporate compute shaders perfectly e.g. (th-cam.com/video/36kmJCELT0w/w-d-xo.html This example is on cpu). I learned most things a while back but didn't get to actually implementing things in my projects as I didn't have time. I was using 2D textures but I think I will switch to compute buffers as they are more flexible. Maybe I will try something in the next weekend and see how it goes :)
The complexity and depth of the topic and its research and implementation is just phenomenal. I needed to re-watch the video several times to fully understand it, but it's extremely interesting nonetheless. Looking forward to more coding adventures!
"a series which is proberbly a lot less exciting than it sounds", are u joking, this is insane.
This is astounding and yet not that complex... and generating random terrain with the different resolutions of noise is ingenious! I'm going to try this myself and see if I can do anything else with it...
It's called "Perlin Noise", named after Ken Perlin. It's also worth looking into Simplex Noise, which avoids some of the limitations of Perlin Noise, can be faster to calculate, produces better results, and is not patent encumbered (Ken Perlin patented his method, although I think the patent has expired by now).
Now please apply this to your Procedural Planet series!!!
Truly a cornerstone of Unity. You, my good sir, are a pillar.
Hey Sebastian ! Ive been watching your tutorials for quite a while now and now i just have to write this. Thank you so much for sharing your knowledge ! The things one can learn from you are beyond any value and tought in a very competend way. I spent some time following your tutorials about procedural mesh generation since i am working on a strategy game. I learned a lot from you and applied the stuff to unitys terrain system. After that i started to expand and alter the code and searched for ways to implement hydraulic errosion. Thou i found the paper you are referring to as well, seeing this now is just so awesome ! If of any interest, I changed the first noise octave to a ridged noise to get something more like mountain ranges, maybe that is interesting for someone.
I have a question though ... is there a reason to use a mesh object instead of unitys terrain ?
Thanks, happy my videos have helped you! Not really -- I used to dislike the terrain system, but apparently it's much better now. I should really take a look :P
This was awesome! It makes such a transformation on the terrain that makes it more natural, more smoother where it should be. This is so difficult to achieve on 3d modelling in a natural way. Really incredible!
Store the paths of the water and use it in terrain colouring
Great_
x , y ...................... texture2D......................................Material.main_texture = texture2D;
Add up the number of times that a precipiton has passed through each pixel. Use that information not only to determine the reduction in elevation, but also(perhaps in combination with local flatness/slope)a “wetness index” to feed into a vegetation algorithm.
So SO bloody cool!
Your's and CodeParade's channels have never failed to blow my mind with programs time and time again.
Keep it up!
You're a wizard Harry.
Seriously though, I wonder how you manage to find the logic behind such cool-looking results. My brain doesn't even meet the minimum requirements to do half the work you did here. I think I'm gonna try the project you uploaded on your Github, it looks promising. Have fun with that project :)
This looks awesome! It reminds me of someone who created an application that not only generates terrain, but also speculates where rivers would form, where people would establish settlements, which settlements would grow into bigger cities, what path would become roads and even added a name generator with some very complex linguistic rules.
mewo2.com/notes/terrain/
3:33 lmao the magic of programming.
oh my god thats so fucking amazing. it honestly kinda motivates me to do things like that on my own as well. like, observe something on nature and try to recreate it in unity with some kind of algorithm that someone has published on a paper or something. i bet watching the end result working is the best feeling ever
Well… It's a good start! Your going to be limited to certain types of techniques though, if you stick with only using a height map. To get really realistic terrain, you'll need to move to volumetric pixels, or some way to simulate voxels. (You might be able to simulate voxels for the purpose of erosion, because the really relevant part of using voxels, is the exposed surface of the voxel terrain, because that's where the erosion is happening. So if you had multiple planes of different materials, with both a height map for depth, and a masking/clipping layer for presence, you have whatever is sticking up above the surface of the other layers, take the erosion, and effectively protect the layers below it.) You should also consider how plant life impacts erosion, because I happen to know that it has a very significant effect. A carpet of grass will dramatically slow soils from eroding, and plants can also contribute to eroding rock, if there are any cracks where roots can get into. And constantly flowing water will also make it hard for plant to grow, such as is the case with rivers and such. And consider that plants have a much harder time growing on different materials.
You should look up some information on how the first plants and fungus got their start on this planet. There was apparently some type of organism that evolved to very, very, slowly, digest bare rock. And it would pile up, creating a foundation for the first stiff plants to grow in.
Wow, this was recommended to me by TH-cam and I'm stunned by how amazingly well this method worked. Great job!
That's really cool stuff, I've been looking into trying this myself at some point but I never got to it. There are a bunch of other erosion mechanics that can be implemented alongside this as well, to add further detail.
Also, unrelated to the video really, but I saw in another comment that the animation on the intro was Delaunay Triangulation. I've been trying to understand how that crap works for a while now and I don't seem to get it; and all the videos on TH-cam about it either don't actually explain anything, or are awful attempts at it.... Could you make a video about it maybe? It'd be super useful for a lot of procedural mesh generation problems!
The results you got are just incredible! I'm now fully convinced that every terrain generator should have this.
Is there a way i can get a heightmap back out of this program after its done eroding?
I really love this project. The difference between the raw model and when it was simulated was so big. It looks so much more realistic.
Imagine that he would add generated trees and snow, and added a hightboundary for the grass.
Also, could this hydraulic erosion be procedurally generated? Can the program make a high-def normal map, reduce the vertices for easier computing, and then project the normal map to give the illusion of a higher def terrain? Very curious...
This was fascinating. Beautiful results sir.
Really loved the commentary and the included bugs/bloopers. Real shit.
I'd be interested to see how this could be adapted to running parallel on the GPU.
Unless erosion is a main game mechanic I don't think we need to worry about that.
Would be intresting though, what kind of gameplay might involve interactive erosion?
@@moth.monster
maybe he works in a field that would benefit from this
or maybe he wants to build a mountain house and he wants to try to find the best spot for it and generations to come
the graphics card isn't all for games
@@MyFilippo94 "From Dust". A modern version of "From Dust" in either sandbox, or game form would be perfect.
Super impressive Sebastian! Thank you so much for stepping through it for the benefit of us all. Really wonderful channel you've created here.
The graphics looks like unity, there are unity files in your repository, and the manual says to open in unity... so why is the project a vscode project?
feha92 you can make things for unity in vscode
VSCode is just a fancy text editor. You can edit C# files in it
@@bammam5988 old necro xD and yeah, I clearly had no idea how unity worked back then, figured it was an IDE.
You Sir, are a gentleman and a scholar. Thank you so much for all your work and the fact that you always give us the source code so we can learn how you did your stuff. I've been working on my game for 5 years and I must say without you there's no way I'd be this far.
Thank you so much!
Great Work..................was that Delauny_Triangulation at start of video
Thanks! Yes it was.
@@SebastianLague You should make a video about how it works, there are no real good explanations that I could find, that weren't either awful explanations, or so deeply technical I couldn't wrap my mind around them anyway. To see a walkthrough of an actual code implementation would be awesome!
1 . set of random points
2 . Triangulate them by Triangle_splitting_Algorithm...................
3 .
a . now loop through all Triangle .......... make a circle
b . check if neighbour point to triangle is inside..........or............on && outside The circle
c . Flip edges Accordingly _......................till none remains
No joke but this is EXCATLY what I was looking for. I'm currently developing a game that is based in an area of the United States that had extensive mining operations along with erosion. With some tweaks, your experiment is most likely going to make my game world look incredibly realistic. Thank you for sharing this online.
“Potential pitfalls” 🙃
Potentially literal pitfalls xd
Haha yeah, 2:07
The mountain looks extremly realistic! Imagine this model with realistic textures and lightning!
This is incredible. This is so incredible you have no idea. I'm so happy you're starting a new series just dedicated to *cool stuff*, really looking forward to it!
I actually wrote my thesis on something very similar, it was an interactive terrain simulation. I completed it the same time as the referenced paper, I think everyone must have had the procedural terrain bug from watching the No Man's Sky trailers. It was a combination of several different systems, a simple vegetation model, a heightmap-based water simulation with an erosion and deposition model, a soil slippage model and a simple weather model. Definitely something I need to revisit.
Another helpful factor: during inundation, because MANY droplets are falling simultaneously, they merge and form a coherent LARGE channel, which will give your mountain ridges more varied, fractal distribution of ripples, instead of the 'straight hair' look that the current method produces. You'll be able to tell the difference when you look carefully at the pattern of flow - your current model produces numerous parallel small channels, while actual mountains produce 'fronds' that merge into larger streams and rivers.
this saved our lives and helped greatly with the project we’re doing for school. otherwise we would’ve slit our wrists!!!1!1! sending love from Czech Republic :)
I can vouch for this statement +999999
Hi I just want to tell you that I'm a physicist who works in a really prestigious place, and that I'm impressed by how you make all these complicated(mathematically and physically) things come to life using unity, looks amazing
One episode back I thought "nah, this terrain isn't real because there's no erosion", but then I saw this.
I watched several videos and was impressed by the relative simplicity of coding. I program in Python as my day job, and it does get complex, but things are linear and straightforward unless you consciously dive into multiprocessing. I tried VB/VBA/VC++Builder years ago, but long time did not approac IDEs, because of the steep learning curve and finally low returns in the perspective. 3DMax/Blender-like UI also scares, compared to Sketchup (because the latter you can learn by just poking around), but probably with a reachable goal in the end one can get over the complexities. Thanks for these introductions!
I've been binging these since I got a better computer. These are awesome for personal projects, thanks Seb!
I have literally never coded or watched a coding video but this was in my recommendations and I actually enjoyed it. Keep up the good work, and I look forward to seeing many more adventures with you!
Wow this is actually pretty awesome, looks like real mountains with the ridges and everything.
You are such an amazing game developer, programmer and content developer, Sebastian!
Thank you so much for sharing all of these with us. It feel's so good to know i can come to your channel to get awesome tutorials with great practices.
Also, it may sound a bit, silly? But even though i really like Unity, because i love programming, i'm very afraid of it hindering my progress as a programmer because it "does too much for me". But, thanks to you, i can remember that it just allows me to focus on other things, and not have to worry myself about some things like graphics (which is a fascinating area on its own!) and still come out with quite complex ideas.
Thank you so much from Venezuela!
exactly what i was just thinking of coding, i think first i will watch any tutorials i can find thanks for the share!
amazing result and good work
as a Geographer I find this approach very appealing, and the result is surprisingly accurate. it can be improved of course by incorporating hydraulic head(momentum works ok enough), different rock and soil erosion resistance, subsurface flows(voxels prbly) etc. however I assume you quickly run into diminishing returns in simulationist approach. lots of detail and effort for very little visual difference.
wow, this is incredible, I love the look of the finished result, can't wait to dig through your code
Your video format is amazing. It feels engaging and I never felt bored. Do more of these please.
0:03 "...a lot less exciting than it sounds" oh my friend it is MORE exciting you are so good
There's no other place like your channel on the internet. Thanks for your work !
SMOOOOTH valleys with rocky shapes emerging in the right spots. 9/10
Hey Sebastian, you contents are unique and your way of explaining things are just awesome. Thank you so much for your support. Learned a lot from you.
Just the fact that the code is actually availible makes me so happy. You're great, I just want to play with erosion too now. Keep up the good work!
it took less than half a second to calculate that?! I could watch that all day! It's beautiful!
There are so many things that could influence your pre-rain terrain: astral bombardment, wind, waves. Honestly, I don't know if there ever was a period in Earth's history, other than when Earth was still molten and coalescing, when rain did not coexist with all the other forces acting on terrain. I hope that isn't overwhelming. I'd enjoy watching this project continue.
This is amazing! Thanks for the walk-through. I'm very impressed how you describe the concept thoroughly without making a video taking 40 minutes.
Another factor which effects how rocks erode which other commenters haven't mentioned is (an)isotropy. Rocks typically form with a non-uniform fracture orientation based on the stress environment during the formation of those fractures. So rocks in a certain mountain range might be more likely to fracture along non-uniformly oriented planes. I don't know the coding side of it, but I think something in that direction could add a certain "naturalness" to the appearance of the landscape.
This looks SO GOOD, it should be a standard asset in every game engine.
This is really inspiring, thanks for sharing! Procedural approaches emulate nature best
One of the most underrated youtuber ever. You did high quality stuff since the begin. Thank you for that!
This is the Best Unity tutorial channel in TH-cam and probably the best tutorials among all over internet. Love yoi.😀