anyuser / vectorshapes-unity

Library for drawing vector shapes in Unity.
MIT License
79 stars 15 forks source link

Add render mode where shape is in world space but stroke always faces the camera #1

Closed sttz closed 8 years ago

sttz commented 8 years ago

Quick 'n dirty implementation of an additional render mode where the shape behaves like a regular 3D object but the stroke always faces the camera.

The existing modes didn't work for me because I needed the stroke to scale with distance from the camera but still wanted the nice non-perspective stroke rendering.

This is done by first converting the stroke to view-space (multiply by MV), extruding it and then doing the projection last (multiply by P).

This is pretty rough, I haven't tested it with fills, implemented only the shader part and didn't add the mode to the CPU renderer. The result without any modifications to the CPU renderer was already close enough so I didn't look into a proper implementation.