• Unity
  • Unity - Normal maps and lighting support!

Related Discussions
...

Very awesome stuff from the Unity team! You guys gotta check it out :nerd:

I wonder if this will work with Spine assets?

Their rigging tools are coming along. But so far not as advanced as Spine's.

Thanks for the info. We will have a look at the 2d lighting changes.

Harald wrote

Thanks for the info. We will have a look at the 2d lighting changes.

Would be cool! I think this is one area spine is lacking the most. Everything else has been super!

If you're interested, the normal map stuff is at 24:00. Really impressive. I'm looking forward to trying out their light shapes on Spine assets too!

Since you mentioned normal maps:
Did you checkout the Spine shaders Spine - Sprite - PixelLit and Spine - Sprite - VertexLit, or have a look at the examples scene Spine Examples/Other Examples/Sprite Shaders? Spine supports normal maps with 3D lights for quite some time now. Or did I miss something?

We will of course implement support for these new 2D lights as well.

Harald wrote

Since you mentioned normal maps:
Did you checkout the Spine shaders Spine - Sprite - PixelLit and Spine - Sprite - VertexLit, or have a look at the examples scene Spine Examples/Other Examples/Sprite Shaders? Spine supports normal maps with 3D lights for quite some time now. Or did I miss something?

We will of course implement support for these new 2D lights as well.

Hi @[삭제됨]

Yep tried the sprite shaders from Todd Rivers.
http://esotericsoftware.com/forum/viewtopic.php?t=5838#p36889

3D lights work fine for spine objects. It's more to do with normal maps and how to solve the seams ? 😢

I tried enabling the "solve tangents" box, but it doesn't do anything for me. Rim lights look even worse.

I get an error from the material telling me it needs a mesh with tangents. I enabled the box, but it didn't help.

Any help would be appreciated
Thanks for the help! :confused: :tear:

Yep tried the sprite shaders from Todd Rivers.

I meant the Spine/Sprite shaders that come packaged with the Spine-Unity runtime. Have you tried those as well?

Your screenshot above shows that you are using Sprite/Pixel Lit instead of Spine/Sprite/Pixel Lit.

Harald wrote

Yep tried the sprite shaders from Todd Rivers.

I meant the Spine/Sprite shaders that come packaged with the Spine-Unity runtime. Have you tried those as well?

Your screenshot above shows that you are using Sprite/Pixel Lit instead of Spine/Sprite/Pixel Lit.

Hi @[삭제됨]

Yea I tried it and it's still the same issue.

Is there an email I can send a movie of the game playing? I recorded a bunch of angles, it seems like the tangents on the leg are inversed? but I'm not sure if that's the case? Its probably better that you look at the video with the rest of the team.

Is there a way to flip the mesh tangents of a specific body part?

If your tangents are inversed, there is likely something wrong with the input normal.

Try changing the Fixed Normal Direction or changing Fixed Normal Space from View-Space to Model-Space, or tick Adjust Back-face Tangents.

Harald wrote

If your tangents are inversed, there is likely something wrong with the input normal.

Try changing the Fixed Normal Direction or changing Fixed Normal Space from View-Space to Model-Space, or tick Adjust Back-face Tangents.

Yea I've tried that to no luck. I can send you guys a movie I recorded, which email is best? When I go BEHIND the character, the normal maps work as expected.

Honestly I just want a rim light. Do you have suggestions on how to get one another way? :bigeyed: This shader's rim light isn't that great anyways, it's more like an outline instead of reacting to directional lights.

Also why is there the warning of missing tangents? Am I missing a checkbox during export?

Thanks!

You could send us the video together with a reproduction package (a minimal project which still shows the problem), to contact@esotericsoftware.com - the video alone will not help too much on its own I asume.

18일 후
Harald wrote

You could send us the video together with a reproduction package (a minimal project which still shows the problem), to contact@esotericsoftware.com - the video alone will not help too much on its own I asume.

Ok. I'll prep a package for you guys! Thanks 🙂


@[삭제됨]

I sent you guys an email just now 🙂

It's got a Unity scene with the spine character in it.

The subject of the email is "[ UNITY \ SPINE ] Lighting , Normal Map Scene"

Thanks a lot for the help! 🙂

Thanks for the email - we received everything and are now able to see your problem.

Your normal map is authored with incorrect orientation - the red channel is inverted and +red points left instead of right. The green channel is correct, +green pointing up.

See the Unity normal map sample for proper orientation:
https://docs.unity3d.com/Manual/StandardShaderMaterialParameterNormalMap.html
You can also check out the stretchyman-normals.png file in the Spine Examples.

Regarding the directional rim light support: it should be possible to create a directional rim light with one of the built-in lights, or does this not work for you?

10일 후

Hi Harald.

Ok I'll give it a shot!
Thanks for the help! 🙂


Harald wrote

Thanks for the email - we received everything and are now able to see your problem.

Your normal map is authored with incorrect orientation - the red channel is inverted and +red points left instead of right. The green channel is correct, +green pointing up.

See the Unity normal map sample for proper orientation:
https://docs.unity3d.com/Manual/StandardShaderMaterialParameterNormalMap.html
You can also check out the stretchyman-normals.png file in the Spine Examples.

Regarding the directional rim light support: it should be possible to create a directional rim light with one of the built-in lights, or does this not work for you?

@[삭제됨]
I love you man. That was the problem. :nerd:

Now if you could please suggest how I could get the body to cast shadows but not have the eyes, mouths, hair pieces etc cast onto itself. I'd be in your debt 😃

Glad to be of help 8) !

Now if you could please suggest how I could get the body to cast shadows but not have the eyes, mouths, hair pieces etc cast onto itself. I'd be in your debt 😃

Hm, I guess the solution would require either:
a) having the same Z-location (depth) of the non-shadow-casting pieces and some Z-distance at those that should cast shadows, or
b) you could use a SkeletonRenderSeparator (see the example scene Spine Examples/Other Examples/SkeletonRenderSeparator), and then separate the mesh into two parts: one that shall receive shadows and one that should not. Then disable shadow-receiving at the respective MeshRenderer at the SkeletonPartsRenderer.
c) If your character needs to receive shadows, you could potentially do the same but inverse, by separating only the shadow-casting parts with a SkeletonPartsRenderer and setting up the MeshRenderers accordingly. Maybe you might want to enable Write to depth of the Material only at the shadow caster parts.

These are just some rough ideas, I guess they require some more thought.

7일 후

@[삭제됨]
Hmmm ok .. I'll try those out to see what kind of results I can get. I'll report back when I make some progress.

I got another question. Do you have any idea how the green rim lighting was achieved around the characters? They aren't using rim lighting... at least not the method used with normal maps?

Thanks for the help!

Unity actually sorta showed a similar effect in the new 2d lighting system coming out so you'll probably not have to wait long to for a built in solution. As for common solutions for rim lighting two come in mind.

1) is a very intense normal map bevel and then a rim light (basically a light behind the character but in position to have the normals be effected)
2) its faked in a shader using an emissive property that adjusts to lighting around it.
3) a combination of 1 and 2 where a shader calculates a more intense version of whatever light ur adding but only applied to the rim (i believe unity may be doing something like that)

Thanks for answering, Anisoft.
My answer below is redundant know, but still posting since I already wrote it, perhaps it helps:

IndieDoroid wrote

I got another question. Do you have any idea how the green rim lighting was achieved around the characters? They aren't using rim lighting... at least not the method used with normal maps?

If they don't use normal maps (I would, do you know for sure they didn't?), then this could be done via an emission map covering just the desired parts in non-black color (your Spine shader provides a slot for it), which could be colored lighter/darker depending on the distance of the character to the closest back-light-source via a script. These will not react to the direction of light, but could look nice enough.

At least this is one way that comes to my mind. However, I would still implement it via normal maps, or via a special shader as Anisoft described in 3.

Do you have any video reference as well? You could analyse how the light direction affects the characters.

Anisoft wrote

Unity actually sorta showed a similar effect in the new 2d lighting system coming out so you'll probably not have to wait long to for a built in solution. As for common solutions for rim lighting two come in mind.

1) is a very intense normal map bevel and then a rim light (basically a light behind the character but in position to have the normals be effected)
2) its faked in a shader using an emissive property that adjusts to lighting around it.
3) a combination of 1 and 2 where a shader calculates a more intense version of whatever light ur adding but only applied to the rim (i believe unity may be doing something like that)

@Anisoft - Thanks for the thoughts. Yea it makes sense. I tried making a normal map .. but maybe my normal map isn't great.. It made everything look rounded and just not good looking IMO. The rim light was there, but it wasn't as pronounced and cartoon like as this example.

I guess I need to do more testing to find a sweet spot. I wonder if there's another way to achieve this effect.


Harald wrote

Thanks for answering, Anisoft.
My answer below is redundant know, but still posting since I already wrote it, perhaps it helps:

IndieDoroid wrote

I got another question. Do you have any idea how the green rim lighting was achieved around the characters? They aren't using rim lighting... at least not the method used with normal maps?

If they don't use normal maps (I would, do you know for sure they didn't?), then this could be done via an emission map covering just the desired parts in non-black color (your Spine shader provides a slot for it), which could be colored lighter/darker depending on the distance of the character to the closest back-light-source via a script. These will not react to the direction of light, but could look nice enough.

At least this is one way that comes to my mind. However, I would still implement it via normal maps, or via a special shader as Anisoft described in 3.

Do you have any video reference as well? You could analyse how the light direction affects the characters.

@[삭제됨]
Yep you can see the effect in action here:

I totally understand the logic of emission texture being affected via script and light distance. But that sounds painful to implement across a level.

The normal map makes sense too, but I haven't found a good way to make the normal map do this .. I guess I need to do more testing.

And yea, I'm not sure if that is or isn't a normal map. But I don't see any bump effect across the characters, which leads me to believe its not using normal maps.. I could be wrong of course. If someone else knows, feel free to chime in.