Scaling elements of a an asset depending on distance to camera in Vertexshader?

Hello,

We’re wondering if it is possible to scale each element of an object when the further you get from an object. It has to scale the elements at their own pivot to make sure the elements position are roughly kept consistent.

We are looking for a similar effect to “Preserve Area” when using Nanite.

Any ideas would be appreciated :slight_smile:

This is pretty trivial. You need to be able to tell each vertex what its pivot is. This can be done easily with baked vertex color data.
Then, you take the difference between the pivot and the absolute world position of the vertex. This will give you a vector that can scale the mesh into and away from its pivot point.
Control the offset along the vector by using the depth buffer, or by comparing the distance from the vertex position and the camera position.

2 Likes

Thanks, will give that a shot and see where it goes : )