#Outline not rendering at all

1 messages · Page 1 of 1 (latest)

spiral cave
#

I made an outline shader, but it doesn't work at all, no matter what I set the outline colour or thickness to.

If I put the outline pass first, then it renders that instead. I'm rather new to writing shaders instead of using shader graph so if someone helps me that'd be very nice.

Also if there's anything that is bad performance wise let me know too

Gist: https://gist.github.com/DarkTerraYT/13e661a84d1ecae3c024f474c58b653c

Gist

GitHub Gist: instantly share code, notes, and snippets.

noble pivot
#

URP doesn't really allow multi-pass shaders. You should split it into two shaders/materials. Then assign both to the MeshRenderer and ignore the warning or duplicate the object.

Alternatively could bake the outline into the mesh itself and only use a single shader. If you paint the outline with different vertex colours (i.e. outline as R=0 and main model R=1) you can test for that in the shader, and still apply vertex displacement to adjust thickness or branch/lerp to apply outline colour.

spiral cave
#

Oh, well that sucks but okay

#

I was just tryna get it to be like btd6 where it does both in one material

cunning cargo
#
SRPDefaultUnlit    Use this LightMode tag value to draw an extra Pass when rendering objects. Application example: draw an object outline. This tag value is valid for both the Forward and the Deferred Rendering Paths.
URP uses this tag value as the default value when a Pass does not have a LightMode tag.
#

Oh and I don't think that's gonna work with transparent rendering/queue

noble pivot
#

Technically, yes. It is possible to use a pass with "LightMode"="UniversalForward" and a second without a lightmode or with SRPDefaultUnlit (which is the default in URP)
However unless newer versions have changed things, it breaks SRP Batching compatibility. So not recommended

cunning cargo
#

Yeah, I wouldn't recommend it either. But it's not impossible. And I think it's the only way to have an extra draw right after the original drawcall(aside from assigning extra materials to the renderer), instead of a separate pass entirely .
Unity should really give us a bit more control of what happens inside the default passes.

noble pivot
#

Since the shader is transparent and likely requires ZWrite On to prevent the outline appearing over the main pass, probably also want another pass before to prime the depth buffer. Is a common thing for ghost shaders, to prevent overlapping faces. Though might not be as noticeable with this model.
Related : https://www.cyanilux.com/faq/#transparent-depth-prepass
But don't think you can do three passes in URP without splitting it into multiple shaders/materials.