Sand Dune Simulator WIP

   5464   9   3
User Avatar
Member
54 posts
Joined: 3月 2015
Offline
Almost done but could probably use some refining and adjustment to speed it up.

Right now it's using a solver sop and inside the solver sop it's running some heightfield nodes and a couple opencl nodes. I'm thinking if I combine the opencl nodes that might speed it up? not sure though.

This was my first experience writing opencl and doing much with heightfields. Really awesome how easy houdini makes working with opencl.

fume dust trails were just quickly added after the fact, want to improve them if I do a render like this again.

https://youtu.be/3PXHpsQtdcU [youtu.be]
User Avatar
Member
1736 posts
Joined: 5月 2006
Offline
Awesome!
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
54 posts
Joined: 3月 2015
Offline
mestela
Awesome!

Thanks! do you run cgwiki?? if so thank you so much, I love your site.
User Avatar
Member
1736 posts
Joined: 5月 2006
Offline
Ah cheers! Yeah that's me. One day I'll add a opencl section...
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
710 posts
Joined: 7月 2005
Offline
This is so damn cool. Great job Barrett!
User Avatar
Member
54 posts
Joined: 3月 2015
Offline
Thanks! Working on it a bit more to speed it up. Running about 1 second a frame with 5 substeps on 1000x1000 grid now.

Few things I added
- Tiling option where it generates tiling sand patterns by keeping the edges in sync
- flow around collision objects where the 'wind' bends around them
- Wind Rose support where you can feed it a wind rose (used by meteorologists) to define wind direction probabilities over time.
Edited by Barrett Meeker - 2021年1月22日 21:23:10

Attachments:
TilingDunesA_v01_01.Redshift_ROP1.0005.png (3.3 MB)
DuneSimB_ObjectFlow.png (3.0 MB)

User Avatar
Member
54 posts
Joined: 3月 2015
Offline
Another sequence. Almost done with this I think. Needs a tiny bit more adjusting and finding the perfect parameters.

Right now I'm picking a random wind direction from the windrose, thinking about making that driven more by a noise function, or at least separating out the windrose direction update frequency from the steps so you could have it simulate with the same wind direction for x steps then change, might make for nicer sequences.

Also thinking about using some 3d noise to limit how much of the sand updates each step - right now every step updates moves every 'grain' which I think makes it a little noisier than necessary.

https://www.youtube.com/watch?v=Z3vBGfWCZX0&feature=youtu.be [www.youtube.com]
User Avatar
Member
8518 posts
Joined: 7月 2007
Online
very cool, so satisfying to watch
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
172 posts
Joined: 1月 2014
Offline
Very nice, HeightFields and Opencl combo is just amazing to work with.
I just played with the Abelian sandpile model, and it's pretty noisy in animation even inside a solver in certain cases.
Would be cool to see your setup.
Did you combine the openCL nodes eventually? Do you use "Write Back Kernel"?

Also, attaching another test just in case somebody finds it interesting.
https://vimeo.com/232272410 [vimeo.com]
Edited by Ivan L - 2021年1月29日 13:22:25
I contribute to the beauty of this world
User Avatar
Member
54 posts
Joined: 3月 2015
Offline
deviner
Very nice, HeightFields and Opencl combo is just amazing to work with.
I just played with the Abelian sandpile model, and it's pretty noisy in animation even inside a solver in certain cases.
Would be cool to see your setup.
Did you combine the openCL nodes eventually? Do you use "Write Back Kernel"?

Also, attaching another interesting test just in case somebody finds it interesting.
https://vimeo.com/232272410 [vimeo.com]

Yea I saw that on vimeo before I started mine, it's all vex but it runs pretty fast still. My approach is similar I based mine on a lot of the same papers he did. Big difference is his, and all the approaches I've seen in papers aren't multi-thread friendly they simulate one grain at a time. I just do them all at once, which probably creates more noise but works well enough

I still have it in a few node steps inside the solver. Could be optimized a bit more for sure but having more nodes makes it easier to use switches to adjust the solve etc.

I'm doing it in three main steps:
compute wind vector strength / wind shadows (opencl)
compute sand transport and save the transport as a _newsand delta (I should change this to use a writeback to add in the sand)
slump the sand

I've gone back and forth a lot on the best way to slump it. I've been using the sidefx slump node which has it's main routine in opencl as well. It has two modes though one 'smooth' mode and one grain mode which is slower and does it's own iteration loop. I stripped out the smooth mode to make it a little faster (cut out making temp planes etc.) but I think the grain mode actually works a little better so I use it some. I have it setup so I can use a combination of the two slump modes since the smooth mode is very fast anyway.

It would be fun from an interactive perspective if it was faster but it's running about 5 iterations / second for me so actually plenty fast for production. I plan to use it to generate terrain and textures for an unreal game.


I get noise too I've found a few things that can help:

  • I lower the per iteration sand delta - aka how much it adds and subtracts each iteration. For fast sims I use 0.35f change in height but for getting rid of noise I'll go down to 0.1 or 0.05. What you can do it run the sim for awhile at 0.35 then animate the delta down to smooth it out.

  • Adding a blur of 0.5 one or two places can sometimes help. I think 0.5 is based on the heightfield voxel size so it's sort of like poor man's anti-aliasing. I find adding it to my wind shadow calculation helps sometimes.

  • Blending sim frames together can help. I tried using a timeshift and blending in the previous frame or two, kinda works.

  • Upres blur + resim. Good way to get the base shapes down then add refinement on top.

  • Smooth Slump on top with a shallow repose angle 10-15, ~100 iterations and a small spread rate 0.1 - not part of the feedback loop but as a processing step before rendering each frame.
Edited by Barrett Meeker - 2021年1月26日 13:51:07
  • Quick Links