Harald escribióAnd in case you mean that: You currently cannot assign a normalmap attachment image in the Spine Editor. This is only done in the spine-unity runtime side.
Oh! Okay, this is very interesting. I will try to figure out how to create correct maps for my Spine assets using the Universal Render Pipeline/Spine/Sprite
shader. Thanks for the clarification! I've looked at the Stretchyman
Material a few times in the past, but I struggled a little on how to generate the .png file for each map. I'll look into it again though with my fingers crossed.
Harald escribióHmm, this is strange, I implemented it in a way which should light it as your first image shows, even when the light is placed behind (which was the whole point).
Ah. Sorry, I completely misread what you said in your previous post! My apologies! Yes, after I implemented what you suggested it worked fine for Skeleton Lit
. HUGE thanks! There was one hiccup with the dot product getting zeroed out when the normal
and lightDir
were on the same Z-Axis
, which made the object black/unlit. Since I will probably be only using point lights in my project, I changed the function to:
half3 LightingLambertLitFromBehind(half3 lightColor, half3 lightDir, half3 normal)
{
half mag1 = length(normal);
half mag2 = length(lightDir);
return lightColor * saturate(mag1 * mag2);
}
... which produced the desired effect. I'm not entirely sure what each variable does nor have I ever worked in HLSL, but it seemed to work for the time being. Hoping this code doesn't cause the world to catch on fire! :grinteeth:
Using specifically the Stretchyman's
Material in the URP 3D Shaders
example scene along with the Sprite
shader, I see what you mean with the asset looking a little strange while Lit From Behind
is enabled. The normalmap and its lighting definitely seems a little off when the light is behind the asset. For the time being I think I will stick with the Skeleton Lit
shader in the URP/Spine package without using a normal or an emission map. Once I figure out how to incorporate the Sprite
shader with the attached maps/textures, I will revisit the Sprite
shader you have provided and see if there is an alternative solution to the lighting that yields a symmetrical result if the asset has Lit From Behind
enabled.
I just tested it all out, depth of field, 3D lighting with 2D assets, URP and Spine, bam! It really works wonderfully for the time being. Thank you so, so much again, Harald, I really, really am grateful for all your help. If you are ever in Los Angeles, let me know and I will gladly buy you dinner! :grinteeth: