Hi!
Which is the best way to render rimlight object outline on top of the others?
(To show contour of an object that has been overlapped)
I figured out that i can do it by:
- Rewriting all builtin unity surface shaders that i expect to use on my objects to a double-pass shaders in which 1st pass - is the normal shader pass (vertex+fragment analog of a surface shader program, cause Unity surface shaders doesn’t supply multipass) and second - is the rimlight outline pass, and replace shader in realtime with all necessary parameters.
That does the trick, BUT i don’t want to rewrite all surface shaders that i use on my objects with it’s vertex+fragment analogs. That’s a freaky solution…
OR
- Prepare 1 rimlight shader only for rimlight outline effect, and use Graphics.DrawMesh to draw object mesh 2nd time with this shader.
That’s a better solution i think, BUT Graphics.DrawMesh doesn’t work with skinned meshes (or i’ve missed something?)
In any case my rimlight shader contains ZTest Always to be drawn on top of all other objects.
And please note that i need to control properties of a rimlight material/shader at runtime from scripts for every single object.
Any other solution?
Thanks and sorry about my poor english. ![]()
Trying to obtain this effect, but which works on skinned meshes too:
