ENG New site

Advanced search

[ New messages · Forum rules · Members ]
  • Page 1 of 1
  • 1
Implementing rivers
nubDate: Saturday, 14.03.2015, 13:01 | Message # 1
Observer
Group: Newbies
United States
Messages: 1
Status: Offline
Quote SpaceEngineer ()
Realistic rivers are impossible on an GPU procedurally generated landscape

hmm, I remember seeing something a while back that proposed a system to (to the best of my ability to remember)

  • seed random areas above sea level
  • find the first level at which the valley's slope is 0, and has a continuous downward slope for x distance after the flat area
  • trace the steepest path
  • lowered the steepest path x width, where x is a subjective measurement/slope, and y depth, where y is slope/subjective measurement
  • placed a water surface x width, where x is the width of the lowered area.
  • if a reached slope is 0, the calculations began again, making another lake
  • if an existing water surface was reached, the calculations would be complete.

I have no clue how this would break when exposed to a system with a dynamic LOD, though. pretty sure it would.

however, even not knowing exactly how GPU's work, I can't believe this is a viable method.
Perhaps tracing lines, finding the widths and depths based on slope, and whether or not the next vertex has a water surface attached could be left to the GPU, Leaving only the Lake generation for the CPU. If I'm terribly wrong, don't be too hard on me. I don't really know much code, just conceptual stuff. ''>3<

I would like to note that most rivers and streams are only a handful of meters deep, opening up some "cheaty" ways of using textures or bump maps under clear layers to approximate rivers and streams.

there are some interesting solutions to water out there:
http://vertexasylum.com/2010/10/30/gpu-based-water-simulator-thingie/ (using wave simulation after a flow pass instead of particle simulation)

http://procworld.blogspot.ca/2013/10/water-bodies.html (2d heightmap lakes and oceans)
http://procworld.blogspot.com/2014/01/leveling-lakes.html (3d implementation of above)

While there are no easy ways to implement accurate rivers, in a GPU system, there should be ways to approximate them, or so I should think. Even if I'm completely wrong, perhaps this gave some else a different idea of how to implement it.
 
36ophiuchiDate: Sunday, 07.06.2015, 18:26 | Message # 2
Space Tourist
Group: Users
Pirate
Messages: 26
Status: Offline
Looks incredibly interesting. Right now, with random, flooded valleys criss-crossing the landscape, we are stuck with a very unrealistic solution.
 
SpaceEngineerDate: Sunday, 07.06.2015, 23:04 | Message # 3
Author of Space Engine
Group: Administrators
Russian Federation
Messages: 4800
Status: Offline
Quote nub ()
however, even not knowing exactly how GPU's work, I can't believe this is a viable method.

No. This is method for CPU. On GPU you don't have:

- Free access read + write arrays (unless you are using CUDA or OpenCL)
- Recursion
- Infinite cycles

So you can't easy program algorithms like "find the first level at which the valley's slope is 0".

The only way to generate rivers on GPU - is a flow erosion simulation. And this is really powerful way, giving very realistic results. But it is extremely slow for now. You can watch erosion in real time, but only for one chunk of the terrain, and... in real time. This man what you must wait few minutes until erosion process reaching desired level. I don't remember links now, but you can google for "intractive GPU erosion simulation" or like this.





 
SHWDate: Monday, 08.06.2015, 17:25 | Message # 4
Astronaut
Group: SE team
Pirate
Messages: 76
Status: Offline
Quote SpaceEngineer ()
On GPU you don't have:
- Free access read + write arrays

Actually, have in OpenGL 4.3, using Shader Storage Buffers.





Your mind is software. Program it.
Your body is a shell. Change it.
Death is a disease. Cure it.
 
  • Page 1 of 1
  • 1
Search: