Stevepunk

  • 26 мар 2016
  • Регистрация: 9 мар 2016

    They are features of the standard shader in Unity. But Spine models are not compatible with this shader.
    When a spine model is built in unity and the standard shader is applied, any rotation of the object is ignored when calculating the way the light hits the object.

    There are some shaders that the spine team are working on to add normal maps which respect the rotation of objects but I'm not sure if the other maps from the standard shader will be included (specular, depth, metallic, etc).

    At this point in time I'm regretting my purchase of spine as it completely breaks unity's lighting and spine's magelight project seems to be forever "on the horizon".

    Here's a video from over a year ago that looks good but there doesn't seem to have been any progress on this..

    Pharan написал

    @[удалено]
    I think you're in the wrong thread.
    But to answer. No, it doesn't replace other sprite shaders. You could use Spritelamp's shaders if it offers any. Or any other Sprite shaders.
    In fact, another user shared his shaders: Sprite Shaders for Unity
    Those shaders were meant for for Unity sprites, but can also be used for Spine skeletons.

    I've already answered you about specifics in that other thread.

    No I'm quite appreciative of the attachments and the video describing how they work (as per the OP).

    However a large drawback of Spine is that it is not compatible with Unity Shaders as you claim.
    It does not communicate the rotation of objects to Unity and thus lighting appears to come from all the wrong angles on a model.

    The attachments are a really great feature but worthless with the Unity Shader incompatibility 😢

    ToddRivers написал

    Hmm sorry I think I might've uploaded a broken SkeletonRenderer.cs.
    I do have go this all working locally so it is possible, but yeah Spines unity runtime needs to be changed to build proper tangents - without them bump lighting just can't work.
    Could you try downloading the shaders package from the first post again? I've added my current skeletonrenderer and tangent solver to it. Hopefully that should sort things, its def working for me now finally!

    Also I've added a 'SpineFlipper' component I've been using to flip spine animations in the editor, which you should be doing instead of rotating the sprite 180 around the Yaixs or giving it negative scale. (Just add the component to a gameobject with a SkeletonAnimation and then you can set the two flip flags to flip animation in the scene view).

    @Pharan I've also found a bug with the BoneFollower component which means it doesn work properly when the skeleon is flipped. I can share my fix with you if you want?

    I've re-downloaded the attachment from the original post and started a new project as the original one seems to have coloured all of the textures a flat bright pink.

    I've imported spine-unity and SpriteShaders.unitypackage.

    I've baked a dragon from the Examples folder and changed the shader on the dragon's material the Game/Sprite Pixel Lit.

    I've included a directional light and am getting the same results as before.

    However, I haven't been able to find this window:
     Loading Image

    The script "Skeleton Animation" doesn't seem to exist in my project:

    These are the scripts I can add as components to the prefab:

    Ok I've switched to an example scene which includes the dragon as a spine object rather than a baked unity object.
    This time I get the Skeleton Animation component appearing and I have selected the 2 required options.
    However, the lighting is still incorrect. This is most obvious on the tail where some segments are lit from below and some from above:

    Also, the rear leg is lit from above but the rear foot is lit from below.


    26 Mar 2016, 11:31


    Here's a video of spine lighting from over a year ago by the developer.
    There seems to have been no progress in over a year on this 😢

    This is the effect I'm wanting.
    How do I achieve it?


    26 Mar 2016, 12:48


    I've exported a brand new version of SpineBoy with atlas rotation turned off.
    When I light him up in Unity the lighting is now correct on all body parts!

    Success!

    Actually, not quite..

    As soon as I select an animation, the lighting doesn't update correctly based upon the new rotations 😢

    As you can see, his rear leg appears to be lit from the bottom by the bright blue/white light (really it's being lit from the top right).

    But he does look really good with just a couple of lights.
    It's a real shame that spine isn't compatible with unity shaders and lighting
    (unity shaders are one of, if not the most important, parts of unity - without shaders nothing would be drawn to the screen - I can't comprehend how an animation modelling system wouldn't be compatible with the core process of drawing things to the screen - it kind of defeats the purpose)

    Thanks Todd for all your hard work on writing custom shaders for spine, but really spine should be compatible with any of the other custom shaders for unity and most certainly the default shaders..

    I could go one but there's no point.
    I'll just get a refund on Spine and if they ever fix their tool to be compatible with Unity I will purchase it again.

    I'm having the same problem. I have tried both export and texturepacker and I have tried both .atlas and .atlas.txt.

    Even after the error message I get the option to search and I select the .atlas.txt file and I still have the error???

    I've replaced SkeletonRenderer.cs and included SpineTangentSolver.cs but it doesn't seem to change anything..
    Huge thanks to you Todd. You've done a lot to help and you're not even part of the spine team :clap: , but this really shouldn't be necessary.
    3rd party tools shouldn't be breaking core parts of unity..

    The problem seems to be related to the way that spine rotates the images (maybe in local space instead of tangent space??), as non-spine images don't have this problem when rotated.

    I can rotate the sprite map and the angle is known by the unity lighting engine and the lighting on the surface is updated correctly.

    However for spine models using the spine system (even the ones that are then built in unity), any rotation on objects is done in a way that the unity lighting system doesn't recognise.
    Even if I manually rotate spine models in unity (even ones built in unity), the lighting doesn't update to respect the rotation..

    However if I use unity's standard bone animation I can use standard or custom shaders and unity's lighting respects the rotation of the object.

    If this is not fixed I'll probably just give up and go back to the standard unity animation system.

    Spine did seem like the most popular system for unity animation but it completely breaks other parts of Unity.. 🙁

    Pharan написал

    Have you tried packing the texture with rotation off?

    These are the default example models in the spine/unity runtime.
    One I tried by baking in unity and one I tried with the default spine mesh and they both have the same issue.

    I assumed the examples should at least work without repacking but I can try that..

    I've tried this shader with the pixel lit option and the Spine Dragon.
    Unfortunately some of the parts appear to be lit from the wrong angle.

    First the normals as generated by the latest version of Sprite Dlight:

    Next the results with a directional light pointing to the left:

    Some of the parts seem to be lit from the left or from below instead of from the right..
    I've downloaded the c# script which presumably fixes this problem though I'm not sure where to locate it in my project..

    I just realised I can bake to unity's default standards after watching this video which means I can use standard shaders.
    This will save a massive amount of time!

    [EDIT:]
    Ok so I've tried using the standard shaders on a baked character but I'm getting some strange behaviour.

    I've baked a lightmap for the goblin using sprite dlight..

    But the results I'm getting are strange..

    The point light is to the right so the lighting on the shield is correct (although it refuses to light from the top and bottom (only from left or right).
    Despite the head being the same orientation in the atlas, it will only light from the left when the point light is on the bottom left.
    On the body top and bottom lighting are reversed and side to side lighting doesn't work at all.
    The left and right lighting works on the fist but the upper arm seems to have reversed lighting also.

    Honestly, I'm at a loss here.
    When the image is flipped (negative x scale), the same problems remain.

    [EDIT2]
    I did a test on the individual parts and normal mapping just to rule out any problems there (they share the exact same material as the goblin character).
    As you can see with a point light on the X they are lighting correctly (even when rotated), but the goblin below still has erratic lighting.

    Here's an example where I've rotated the planes to show the lighting remains correct.

    So the problem with flipped/rotated normals seems to be the way in which spine rotates the objects.
    As for the problem with normals only lighting on 1 axis I'm at a loss..

    Any update on standard shaders for spine models?

    eg. normal/depth/specular/emissive maps

    This is really appreciated.
    Spine seems to be the preferred animation tool for Unity users but it also adds a lot of complexity not previously present (especially in shaders - it replaces other sprite shaders such as the spritelamp one that handles occlusion, normal maps, specular, emission, etc. and doesn't offer any of these features).

    Can't I just use any sprite shader with spine models, or does it have to be a shader specifically for spine?