• Bugs
  • [UNITY] Shadow bugs and hidden objects

Related Discussions
...

Hello,

I found a couple of bugs. When using a directional light in Unity and the default SPINE Skeleton material.

1) When using lights in UNITY, the hidden object's shadows are still projected. The hand shouldn't be holding a gun. :x

2) Each PNG (with alpha), still shows the edge of the image file. You can see the semi transparent rectangles all around the body. Those are the individual PNG images.

Thanks
AlaNintendo

Are setting the color to transparent to hide images?
That's also not efficient since the GPU is still expending cycles to draw all those transparent pixels.

That also won't work on the shadows with the Skeleton shader.
It doesn't account for vertex alphas, since shadows use hard alphas anyway.

I'm not sure what the semitransparent rectangles are all about.
Does your scene have fog? I remember we disabled fog in the Skeleton shader a few updates ago. SkeletonLit might still have it though. In that case, it'll be disabled it.
Neither are supposed to work with fog at all since they're premultiply-alpha shaders, and both are supposed to be barebones.
Thanks for reporting!

You can change all this behavior by editing the shader code, or making your own.

Hi Pharan,

Yea I'm setting the gun's image transparency to 0 inside Spine. Hmm I shouldn't be doing that eh? I guess I need to find another way to hide the gun when I don't want it visible.

And yep you hit the nail on the head! The fog was what was causing the semi transparent boxes. Turning off fog, removed these semi-trans boxes.. but ......... so it means I can't use fog for the the game? darn . . . .

Thanks for the answers. I guess I need to learn how to write shaders now :think:

On a side note, I can't get other 3d object's to project shadows on top of the SPINE model. I assume this is intended as well right?

You can key hiding attachments by clicking on their visibility dot and pressing K, or clicking on the key icon next to the slot.
Semantically, this "keys the slot to be empty".
You can also do this at runtime by finding the slot and then setting mySlot.Attachment = null.

For fog, yes. Fog doesn't work properly in a fixed function premultiply alpha shader like the Skeleton shader. Another kind of shader (presumably straight alpha) probably works fine. But you lose some other benefits of pma shaders. Read more about that here if you're not familiar with the matter: Premultiply Alpha

I have no idea how receiving shadows works. Even ToddRivers' sprite shaders don't do it. I assume it's tricky.