kbm

Hello,

we've been unable to solve a major problem regarding Spine and our game.

We are using Spine to make 2D-animations that we display in a 3D-game. Each frame, we rotate the 2D-spine-objects towards the player position so that we get a kind of "old-school" look like the enemies in old games such as "Doom" or "Wolfenstein".

We always seem to run into one problem: Lighting.
We've been using the Spine "Uber"-Shaders that were posted here on the forums (not sure if they're a part of the official runtime now), with the following settings:

shader-settings.png


Setting the lighting mode to vertex lit in tandem with "write to depth" on (for e.g. fog effects) and "fixed normals" at 0, 1, 0, allows us to use Unity light sources (directional lights and spotlights) to light the spine objects. In this example GIF, the original creature graphic is yellow, the sunlight-source is set to pink/red and the spotlight is green.



This kind of works, but is flawed in one big way: When we move the player camera vertically, the lighting shifts from dark to bright and vice versa. See this GIF for illustration:



What I want, and hopefully someone can give me a hint, is, basically: I want to change the shader (settings) in such a way that, no matter the vertical angle of the player camera, the lighting on the spine-model stays the same. I only want the position of the spine-model and the light source to matter in the lighting.

This probably has something to do with the "fixed normals" setting, basically I want the normal to be unaffected by the player camera angle. But - alas - I don't understand how to fix this my self, I tried "hacking" the shader files already but didn't understand enough about them, and any settings I tried on the shader itself, failed.

Is my goal here understandable? Possible to do?
Any help VERY much appreciated as we're in a total deadend regarding this right now.
Thanks in advance!
You do not have the required permissions to view the files attached to this post.
kbm
  • Posts: 53

Mario

This is a bit above my paygrade, but I've forwarded it to Harri, our Unity wizard, to comment on when he's back from vacation!
User avatar
Mario

Mario
  • Posts: 2272

kbm

badlogic wrote:This is a bit above my paygrade, but I've forwarded it to Harri, our Unity wizard, to comment on when he's back from vacation!
Yeah, I thought this might be a tough nut to crack. any sort of hint by someone more knowledgable would be super appreciated..thanks for forwarding!
kbm
  • Posts: 53

Harald

Sorry for the late reply!

Changing the material parameter Fixed Normal Space from View-Space to Model-Space should privide the desired result. Then the normal is generated based on the orientation of the GameObject, and not based on the camera's forward direction.
User avatar
Harald

Harri
  • Posts: 1711

kbm

Harald wrote:Sorry for the late reply!

Changing the material parameter Fixed Normal Space from View-Space to Model-Space should privide the desired result. Then the normal is generated based on the orientation of the GameObject, and not based on the camera's forward direction.
Thanks a bunch, that worked! :grinteeth: :grinteeth: :grinteeth: Awesome!
kbm
  • Posts: 53

Harald

Great to hear, thanks for getting back to us! :)
User avatar
Harald

Harri
  • Posts: 1711


Return to Unity