- Змінено
Outlines on characters Spine 4.1
Hi Harald
I'm reluctant to upgrade to 4.1 to test it out myself, because I have over 100 spine 4.0 assets that would require migrating.
Can I ask?
I was wondering if the outline was added back into the URP sprite shader for 4.1?
Or do we still use 2 spine characters on top of each other? (1st layer character is the original URP shader and the 2nd layer character is the outline shader)
Thanks for the help!
Unfortunately the 4.1 and 4.2-beta Spine URP shaders still require a second mesh on top of the first one to render the outline (as shown in the example scene Outline Shaders URP
that comes with the Spine URP shaders package).
We have an issue ticket here which deals with supporting the outline feature without duplicating the mesh here:
https://github.com/EsotericSoftware/spine-runtimes/issues/1824
Unfortunately we didn't get to this ticket yet.
Ok thanks for the update Harald.
I'll hold off from upgrading then.
Spine has been a joy to use in every department except this. Getting an outline to work for skeletons that client provided has been the biggest challenge so far for something that seems trivial on a surface level. I'd pay for a multipass URP outline shader.
Thanks for your kind words and sorry for the troubles. However, I don't quite see why it's a challenge currently. You just need to use the RenderExistingMesh
component and have the outline shader assigned at the material there, as demonstrated in the example scene com.esotericsoftware.spine.urp-shaders/Examples/Outline Shaders URP.unity
which comes with the URP shaders package. Or did you encounter other issues?
Harald написавThanks for your kind words and sorry for the troubles. However, I don't quite see why it's a challenge currently. You just need to use the
RenderExistingMesh
component and have the outline shader assigned at the material there, as demonstrated in the example scenecom.esotericsoftware.spine.urp-shaders/Examples/Outline Shaders URP.unity
which comes with the URP shaders package. Or did you encounter other issues?
In my current project, there are 5 separate skeletons (different poses/views) per 6 different, unique characters. Outline is used to display character selection and character status effects, all characters are playable. So I have to create 30 duplicate GameObjects with RenderExistingMesh component and I also have to create 30 different outline materials, since my understanding is that materials can't be shared between different skeletons/atlases.
In the case of a multi-pass shader, I wouldn't have to create and configure 30 different outline gameobjects and I also wouldn't have to keep their animations in sync with the actual character mesh, which would simplify the implementation significantly.
It's simple to do for a single skeleton, but it's hard to scale. Correct me if I'm doing something wrong.
T.Fly() написавIn the case of a multi-pass shader, I wouldn't have to create and configure 30 different outline gameobjects and I also wouldn't have to keep their animations in sync with the actual character mesh, which would simplify the implementation significantly.
Please see my previous reply, you can use the RenderExistingMesh
component to re-render the same skeleton mesh, there is no need to keep anything in sync manually.
T.Fly() написавSo I have to create 30 duplicate GameObjects with RenderExistingMesh component and I also have to create 30 different outline materials, since my understanding is that materials can't be shared between different skeletons/atlases.
Even with a multi-pass material, you would likely want to switch between a non-outlined material version and a version with the added outline. Otherwise a render pass is wasted drawing a completely transparent outline (if e.g. material parameter outline opacity is set to 0), which is usually not what you want. Unfortunately render passes cannot be disabled via Material parameters, these need to be different shaders. So the benefit of a multi-pass shader would not save you a lot of setup work from that point of view.
If you need to setup 30 materials in the same way, you could create a script for that (or add it to your own outline script), which checks e.g. upon Awake
if the GameObject with RenderExistingMesh
component and the Outline Material have been created already, and otherwise create them for you. This should do all the setup work for you.
T.Fly() написавIt's simple to do for a single skeleton, but it's hard to scale.
It scales linearly, but I admit, if you would create 30 GameObjects and materials manually this would be unnecessary work.
Harald написавPlease see my previous reply, you can use the
RenderExistingMesh
component to re-render the same skeleton mesh, there is no need to keep anything in sync manually.
Now that I've corrected the setup, it does indeed sync nicely. I was referencing the wrong mesh.
Harald написавEven with a multi-pass material, you would likely want to switch between a non-outlined material version and a version with the added outline. Otherwise a render pass is wasted drawing a completely transparent outline (if e.g. material parameter outline opacity is set to 0), which is usually not what you want. Unfortunately render passes cannot be disabled via Material parameters, these need to be different shaders. So the benefit of a multi-pass shader would not save you a lot of setup work from that point of view.
The game is not performance critical, so I'd trade performance for ease of setup.
Harald написавIf you need to setup 30 materials in the same way, you could create a script for that (or add it to your own outline script), which checks e.g. upon
Awake
if the GameObject withRenderExistingMesh
component and the Outline Material have been created already, and otherwise create them for you. This should do all the setup work for you.
Indeed, I've been working on that today.
Glad to hear the RenderExistingMesh
component now works for you.
T.Fly() написавThe game is not performance critical, so I'd trade performance for ease of setup.
Noted, thanks for the input.