• Runtimes
  • Which way is best to draw skeleton with normal-map images?

Hey guys, I'm working on adding normal-map shading in my game. I need to draw my skeleton, but with the normal-map images instead of the regular images.

I see 3 potential ways of doing this:
1) Have a separate skeleton that uses the normal-map images that is animated the same as the regular skeleton (I'm assuming this is the least efficient way?)
2) Have only the single skeleton, but when I need to render the normal-map, somehow change the image-path directory from the regular-textureAtlas to the normalMap-textureAtlas (don't know if this is possible?)
3) Have the normal-map as a separate skin, and switch to that skin right before rendering (this would work, but may interfere with other usages of the skins feature)

Any suggestions? There might be an easy way to do #2 but I don't know the runtime quite that in-depth. I'm looking what would be the most efficient at run-time (don't mind doing some extra coding/overriding).

Thanks!!! 😉

Related Discussions
...
  • Изменено

Could you tell us what runtime you are using? We have a normal mapping sample here for libGDX spine-runtimes/NormalMapTest.java at 3.6

The basic idea: you export your diffuse texture atlas, then create a normal map atlas with the same image positions and shapes. At runtime, you use both the diffuse texture and the normal map texture in your shader. This approach is very easy, as it completely decouples normal mapping from the Spine runtime.

Hey Badlogic, thanks for your response 🙂

Sorry I should have mentioned - I'm indeed using Libgdx.

I'm setting up my lighting using deferred shading, so I see what you did in that example, but I can't quite use that.

I did test out using two skins : it was pretty simple, I basically created all of my normal-map images with the same name + "normal.png" (on separate .pngs, with same dimensions as the diffuse), and then copied the 'main' skin, and edited the image-path for each attachment, adding the "normal" part, so placement/rotation/etc was all maintained.

It worked well, and could be my final solution - I'm assuming switching skins twice per-frame isn't a big deal performance wise? (its just changing the image path for attachments, right?)

Switching skins twice per frame isn't terrible. I don't quite understand why using two texture units, one for diffuse, one for the normal map doesn't work with deferred shading. Pretty much any deferred pipeline I know and worked with works like that 😃