Rimlight outline overlay?

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:

  1. 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

  1. 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?) :frowning:

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. :slight_smile:

Trying to obtain this effect, but which works on skinned meshes too:

I’m sorry I don’t have anything to help you with, but I just have to say…

“Oooh… rimlight… <3”

Thanks Tuah :slight_smile:

Doh… Spend couple of hours implementing that… First solution isn’t that easy as i think… Need to rewrite all lighting in shader…

you could just make an extra light, and have it affect only that player, then you can mess with it as much as you like. I might have misunderstood the purpose :slight_smile:

Purpose is to have cool rim lighted contour of important objects (monster, player for example) independently of that they are closed from view by obstacles or not.

Are you referring to the rim light, like that used in Marvel Nemesis and Def Jam?

twitchfactor it doesn’t matter. Just need to find the way on how to render this rimlight pass on top of all other objects with any builtin shader.

Tags {“Queue” = “Overlay”}

Try that? It’ll force it whichever pass or subshader you apply that to to be rendered after all other geometry.

Farfarer, thanks for the suggestion, but before i post this thread, i already knew what does “queue”=“overlay”.

Found one solution that works for me, but if guru’s one day will read this, i would like to know their opinion on how to achieve described results.