Scale mesh / geometry by amount of pixels

I’d like to be able to expand a geometry or mesh by, for example, 10 pixels.
It should expand the shape by a “border” of x Pixels like the red part in the picture:

Is there some way to achieve this?

The only practical way of doing this I could imagine is in postprocessing :thinking:

In 3D there are no pixels - so the border that will be “10 pixels wide” close to the camera will be smaller on the object that’s further away. Since postprocessing modifies a rendered scene (ie. basically draws stuff over a 2D picture of the scene) you can pass a screen resolution to the shader and calculate pixel-perfect values in the shader.

This example may help a bit (code) You can see that the resolution is passed to the shader as a uniform.

This may also help - but I’m not sure if it allows you to draw pixel-perfect borders :sweat_smile: