Walking on Snow

Hello :slight_smile:

I was working on updating some geometry, based on some Ray Casting process… And I ended up with this funny Playground, so I share :grin:

snow

It’s based on a very simple trick :

  • For each ground vertex you take a Ray from under the surface
  • You launch ray upward
  • If it collides under the snow surface (shoe), you move down the considered vertex to collided position.

Unfortunately, it’s not real time, there is some kind of lag between the animated mesh, and the updated ground… But I can ensure that this simple trick, when real time, fakes the stuff so badly well :joy:

:arrow_right: Playground

++
Tricotou

22 Likes

Fantastic!

1 Like

reminds me to the creation of Avin … writting your name into white snow! :smiley:

“Yellow snow” by Avin Lambrero | Babylon.js Playground (babylonjs.com)

3 Likes

Ahah, indeed, quite close ! :smiley:

Ok, I was really unhappy with this bad performances. It appears it came from Ray Casting on high poly mesh (dude). I optimized by Ray Casting only on some custom (invisible) shoe boxes :

snow2

Going from ~40 fps to >120 fps : Now I’m ok with this :grin:

snow3

:arrow_right: Playground

++
Tricotou

9 Likes

I love it! It’s a great field of possibilities! :slight_smile: drifting dude

1 Like

sorry, can not stop playing! :slight_smile: … a mud cure with various deep passages. (demo)

3 Likes

That is very VERY cool!

1 Like

Very cool :open_mouth:

1 Like

Cool! :smiling_face_with_three_hearts:

I can’t find my example of a similar effect… :crazy_face: I was drawing the foot prints on a texture and modifying the geometry of the ground in the vertex shader using that texture.

Thanks for sharing. I implemented footprinting on my snowfight game based on your idea. It was pretty difficult to implement a fast realtime footprinting on large-size land.
Goldball - Snowfight and Cups-And-Balls 3D.

2 Likes

Did you try to cut the snow land into chunks ? That way you can compute the ray on one chunk only, saving a lot of compute time for the ray collision

Tricotou: Did you try to cut the snow land into chunks ?

No. The snow surface is a single big Ground mesh for each land. Chunking snow surface causes unexpected boundary effects on every chunk. Instead, I applied optimized algorithm to find the exact area under an object on snow, which was pretty difficult to implement because the Ground mesh (for snow surface) in Babylon.js only maintains array of points for mesh. It requires complicated calculation to locate the index of array of mesh.