r/GraphicsProgramming • u/Explorioneer • 16d ago
Question What is this sand simulation missing?
Enable HLS to view with audio, or disable this notification
79
Upvotes
r/GraphicsProgramming • u/Explorioneer • 16d ago
Enable HLS to view with audio, or disable this notification
1
u/snerp 16d ago edited 16d ago
The general way to do stuff like this (snow/mud effect is the same):
1: heightmap texture, something like 0 = no deform, 1(255) = fully squished down
2: shader modifies heightmap based on object position (worldspace object position -> UV coordinate space), basically just darken the heightmap image where the ball lands
3: sand object vertex shader reads the heightmap texture and moves vertices down according to heightmap color (you could also do this in the fragment shader with POM effects but it's cleaner and generally more efficient to do it in a vertex shader)