Thanks for helping out again Jamez0r!
Jamez0r escreveuHow can I have an outline on a lit spine character? I'm using outlines to interact with npcs/items.
I'm using the URP/2D/Spine/Sprite shader from the Shader package.
For this purpose we added the outline-only shader for URP. You would then render the same existing skeleton mesh again using the the RenderExistingMesh
example component. This is demonstrated in the Outline Shaders URP
that comes with the Spine Universal RP
package.
The best way would be to use a single shader with a second pass, which I admittedly didn't know was supported in URP, hence the workaround with the separate shader. We've got an issue ticket here to add outline support to all URP shaders using the second pass:
https://github.com/EsotericSoftware/spine-runtimes/issues/1824
Jamez0r escreveu
I'm curious how the spine "Outline" shader works - does it do edge sampling on the mesh or something?
This question was asked some time ago on this thread here:
Outline Shader Reproduction In Shader Graph
In short: it samples the texture's alpha value at 4 or 8 neighbour texels, offsetting the sample position by outline width. Depending on how many opaque texels there are (actually it's using the sum of alpha values of these neighbours), it will draw a more transparent or more opaque outline. When using 8-neighbourhood, e.g. 1 opaque texel (at a corner) will result in a rather transparent outline pixel, 3 opaque texels (at a straight line) will result in fully opaque outline pixel.
Jamez0r escreveuOr does it draw an outline around all of the pieces, but then render the actual character on top (so you only see the outline around the entire character's silhouette?)
The normal outline shaders use render order to draw the outline behind the normal skeleton mesh.
In the two pass non-URP shader Spine/Outline/OutlineOnly-ZWrite
, a first DepthOnly
z-write pass is used to "mask" inner regions, and then the normal outline pass is drawn, failing z-test at these inner pixels and thus only rendering the outer outline.