• RuntimesUnity
  • How properly blur SkeletonAnimation object in Unity URP using shader?

Hi
My goal is to apply a blur effect to objects with SkeletonAnimation and have the ability to animate this blur effect in and out at specific moments during the game. Each object should be handled independently to allow separate control of the blur effect.

I tried using a custom URP Sprite Unlit graph shader with blur logic (simple texture UV offset), but it only blurs the sprite within the mesh. The edges of the mesh remain sharp and unaffected.

My shader graph:

Sub graph:

Do you know how can I fully blur spine object?
Thanks

Related Discussions
...

To achieve a blur effect on a SkeletonAnimation object in Unity URP, you can use a post-processing approach rather than trying to apply the blur directly within the shader for the object. This is because blurring typically involves rendering the entire scene or object to a texture and then applying a blur filter to that texture, which is more effectively done as a post-process effect.

  1. Post-Processing Stack: Use Unity's Post-Processing Stack to apply a blur effect. You can create a custom post-processing effect that targets specific objects by using layers or tags to control which objects are affected by the blur.

  2. [removed]

  3. Skeleton Ghosting: Consider using the Skeleton Ghost example script from the Spine-Unity runtime, which can create a ghosting effect that might be adapted to simulate a blur.

  4. Custom Render Pass: Implement a custom render pass in URP that applies a blur effect to specific objects. This involves rendering the object to a separate render texture, applying a blur, and then compositing it back into the scene.

By using these methods, you can animate the blur effect in and out by controlling the intensity or enabling/disabling the effect at specific moments during gameplay.

    Spinebot

    Thanks for your answer. How can I include entire mesh with edges to my shader?
    This is my UV offset logic

    @ruksov Sorry for the confusion. I've removed the second item from the list, as it makes no sense.

    In general you always have the skeleton mesh as fixed drawing bounds. You can't blur outside the mesh triangles with a custom fragment shader which just changes the output pixel color. You would need to modify and expand the geometry to provide space for the extended blur area (which is not a good solution).

    The other suggested solutions in Spinebot's posting remain valid. You could use a post-processing effect or render the skeleton to a RenderTexture first (e.g. via the SkeletonRenderTexture example component) and then draw the RenderTexture to the screen using a blur shader. Note that the quad mesh drawing the RenderTexture also needs to be slightly larger than the normal tight fit by a few texels (by the blur radius), which might require some additional coding to extend the SkeletonRenderTexture class accordingly.

    So the easiest solution is likely a screen space post processing effect.