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.