I would like to use a different material to render a weapon attachment image in a slot of my spine rig. Is this possible? The slot will have a weapon image just behind the normal weapon graphic slot ... but my shader will render the image in all white with an applied color to make a magical "glow" around the foreground weapon.


-- 14 Dec 2015 12:21 pm --

And actually ... the Spine editor happens to do exactly what I want as the visual for a an image selection .. it makes an outline of the image for a "halo" effect ... I don't suppose the technology that does that could be made available to the runtime? ;)
Bu mesaja eklenen dosyaları görüntülemek için gerekli yetkilere sahip değilsiniz.
Kullanıcı avatarı
  • Mesajlar: 34


If it's only one or a few attachments.
I think current workaround is to implement a similar logic as SpriteAttacher.cs does.

The skeleton doesn't have a reference to a Material but each individual Attachment does. But not directly.
In Spine-Unity, each Attachment points to an System.Object RendererObject (upcast AtlasRegion) which points to an AtlasPage which points to its own System.Object RendererObject (upcast UnityEngine.Material).

So what you need to do is:
Get the Attachment object.
Switch out its Object RendererObject reference to a faux-AtlasRegion and AtlasPage that points to the correct material.

Note that SpriteAttacher generates a new Attachment from scratch.
You only need to generate the fake AtlasRegion and AtlasPage so that it can point to the right Material.

Interesting part of the runtime...

As for the glowy thing, Nate uses an FBO and stuff. (Unity implements FBO access as RenderTextures)
I have a suspicion that per-attachment rendering in the Spine editor is very different and makes that much easier compared to in the runtimes, especially Spine-Unity which builds the whole mesh all at once.

I could be wrong.

-- 15 Dec 2015 2:23 pm --

Oh, if you needed to attach a NEW attachment, you may need to stick an extra slot in there in the editor, and then do a deep copy of the original Attachment object.
Kullanıcı avatarı
  • Mesajlar: 5366

Dön Unity