# Walking on Snow

**URL:** <https://forum.babylonjs.com/t/walking-on-snow/50520>\
**Category:** Demos and projects\
**Tags:** geometry, ray, update\
**Created:** [May 13, 2024, 5:06pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520 "2024-05-13T17:06:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [May 13, 2024, 5:06pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/1 "2024-05-13T17:06:40Z")

</div>

Hello 🙂

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

![snow](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/6/c/6c7ec00267d67604e8d8ccafddf9296a603dfba1.gif)

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 😂

➡ [Playground](https://playground.babylonjs.com/#4U4QH9#16)

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [May 13, 2024, 5:41pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/2 "2024-05-13T17:41:45Z")

</div>

Fantastic!

---

<div class="post-metadata">

**Author:** ![CodingCrusader](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/codingcrusader/32/29857_2.png) [@CodingCrusader](https://forum.babylonjs.com/u/CodingCrusader)\
**Post date:** [May 13, 2024, 7:37pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/3 "2024-05-13T19:37:23Z")

</div>

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

[“Yellow snow” by Avin Lambrero | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#IQV8D7#1)

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [May 14, 2024, 9:18am UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/4 "2024-05-14T09:18:34Z")

</div>

Ahah, indeed, quite close ! 😃

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [May 14, 2024, 12:01pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/5 "2024-05-14T12:01:03Z")

</div>

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](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/1/1/11bb3c065909647b356a79e217bc1e742f35626e.gif)

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

![snow3](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/a/1/a17bb48dad3bb602ae0734e1c9ca3a16299d1ea2.gif)

➡ [Playground](https://playground.babylonjs.com/#4U4QH9#17)

++  
Tricotou

---

<div class="post-metadata">

**Author:** ![CodingCrusader](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/codingcrusader/32/29857_2.png) [@CodingCrusader](https://forum.babylonjs.com/u/CodingCrusader)\
**Post date:** [May 14, 2024, 2:59pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/6 "2024-05-14T14:59:22Z")

</div>

I love it! It’s a great field of possibilities! 🙂[drifting dude](https://playground.babylonjs.com/#4U4QH9#18)

---

<div class="post-metadata">

**Author:** ![CodingCrusader](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/codingcrusader/32/29857_2.png) [@CodingCrusader](https://forum.babylonjs.com/u/CodingCrusader)\
**Post date:** [May 14, 2024, 6:15pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/7 "2024-05-14T18:15:25Z")

</div>

sorry, can not stop playing! 🙂 … a mud cure with various deep passages. ([demo](https://playground.babylonjs.com/#4U4QH9#19))

---

<div class="post-metadata">

**Author:** ![coolbloke1324](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/coolbloke1324/32/39625_2.png) [@coolbloke1324](https://forum.babylonjs.com/u/coolbloke1324)\
**Post date:** [May 23, 2024, 3:48pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/9 "2024-05-23T15:48:07Z")

</div>

That is very VERY cool!

---

<div class="post-metadata">

**Author:** ![regna](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/regna/32/23915_2.png) [@regna](https://forum.babylonjs.com/u/regna)\
**Post date:** [May 24, 2024, 4:48am UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/10 "2024-05-24T04:48:55Z")

</div>

Very cool 😮

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [October 22, 2024, 3:01pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/11 "2024-10-22T15:01:09Z")

</div>

Cool! 🥰

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

---

<div class="post-metadata">

**Author:** ![warren\_bf](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/warren_bf/32/4882_2.png) [@warren\_bf](https://forum.babylonjs.com/u/warren_bf)\
**Post date:** [February 20, 2025, 3:07pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/12 "2025-02-20T15:07:15Z")

</div>

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.](https://goldball.co)

---

<div class="post-metadata">

**Author:** ![Tricotou](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/tricotou/32/5844_2.png) [@Tricotou](https://forum.babylonjs.com/u/Tricotou)\
**Post date:** [February 20, 2025, 4:57pm UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/13 "2025-02-20T16:57:36Z")

</div>

> [@warren\_bf](#):
>
> It was pretty difficult to implement a fast realtime footprinting on large-size land.

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

---

<div class="post-metadata">

**Author:** ![warren\_bf](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/warren_bf/32/4882_2.png) [@warren\_bf](https://forum.babylonjs.com/u/warren_bf)\
**Post date:** [February 22, 2025, 1:55am UTC](https://forum.babylonjs.com/t/walking-on-snow/50520/14 "2025-02-22T01:55:22Z")

</div>

> [Tricotou](https://forum.babylonjs.com/u/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.
