Stencil projection demo

I had an interview recently and we discussed how would one project this spline representing a vehicles trajectory onto uneven terrain. I proposed something like stencil shadows instead of textures. This is a demo of that - there is a spline that can be moved, it’s above the terrain, and it projects a shadow basically.
It’s not the whole stencil shadow algorithm since it doesn’t compute any contours and such, but the way it writes to stencil is borrowed from there.


Very interesting way of doing it using shadows for quick realtime interaction.
And coupled with offscreen scene and a THREE.WebGLRenderTarget it still can be converted back to texture/mask for more complex shenanigans.

This is very usefull, thanks for sharing!