# Character to walk on Complex Meshes - Using Normals?

Hey Guys,

had this idea the other day and thought id simply drop by and ask if anything similar has ever been done in VVVV. before i start digging deeper…

Is it possible to let an Object ( Character, Camera ) to follow the surface of a complex closed Volume mesh. (not a plane )

It should be by sampling surrounding Normal directions and calculating a mean angle, but this sounds like it could be hard to sample and result in bad performance.

This image from the unity forum explains the question quite well:

I would sample from the depth buffer if your character is going to be onscreen all the time. Otherwise you can also make an extra ‘sensor’ camera that renders your scene at 1px.

Maybe DepthPipetTransform (DX11.Texture 2d) in dx11 pack gives you an inspiration for a start…

Wow what an elegant solution :) thx this gives me a great starting point!

I’d do filtering with a geometry shader to append only triangles around the character, select the character’s closest triangle from its streamout with a compute shader and readback that triangle’s positions and normals to do the remaining math on cpu.

@microdee this is how i would have imagined it to work! of course not really sure how to go about the details… This would be the solution if i wanted a freely walking third person camera. Not sure which direction this is going yet.

everyoneishappy’s solutions is very interesting aswell, the force separation of camera/character interaction seems like a cool Core Gameplay/interaction mechanic. It also seems very Touchscreen friendly.

The interactions im going for are, Object exploration (antman perspective) and creating landmarks on objects easily. A mixture of both ( map + view ) seems interesting aswell.

Are there any Geometry Shader / compute shader examples i can explore? Still pretty lost on this topic

Is it possible what follows?
Considering the character position as a point, it should be then possible to calculate if that point lies on a plane\polygon. Once you have the polygon you have also its normal.
I understand though this is CPU job - or DX11 instead gives us this chance?

Edit:
One should also think about a nice interpolation between different polygon normals\angles: it would be probably useful to know also the surrounding polygons…

Edit2:
It is also possible to consider a simplified mesh as track, unless obviously it is needed a perfect correspondence.

Hey,
The mesh looks realtively low poly. So eventually a ray intersection could be performed.

either with the existing intersect nodes