0
Not a bug

[Beta 0.22] Shadows are broken with vertex offset is active

Marc 11 years ago updated by Freya Holmér (Developer) 11 years ago 17
I've been working on a simple foliage shader for grass and noticed that after I added vertex animation the shadows are not casting in the right direction, they seem to be following another vector direction (maybe a reset one?).  It's not easy to see in this example. I would suggest quickly remaking this shader to see the result.

Image 137

Image 138
Are you on deferred or forward rendering?
SF doesn't support deferred yet, you need to use forward for your vertex animated / transparent shadow casters
i tried setting to forward. the result is also bad.  I see that it's cutting out properly, but It's not updating the shadow pixels in the same direction as the albedo pixels.  so you get the is crazy look of "invisible" leaves over the rendered leaves.


Are you sure both the camera and the project is set to forward?
it was not.  I just fixed that and it got a little worse.  now my shadows have a strange dithering effect going on.  BTW - i was in DX11 mode and turned that off as well.

I should say though - after doing this I can clearly see that my vertex animation is set to move in sin along the X but the shadows are moving in sin along the Z.  To clear that up - in this image the leaves are moving left to right but the shadows are move back and forth.

You shouldn't get this issue though, strange.

If you open the example scene in SF, do you get the same issue on the plant there?

The dithering is probably due to the shadow bias settings in your directional light.
as a side note - it's hard to tell because I'm relying on vertex colour to attenuate it, but it seems that if I use a built-in plane it works fine.
Shouldn't be a problem using vertex color. How does the example scene look?
it looks fine in the example scene.  it really seems like the mesh has some other shadow caster that's not matching it.  the movement seems to be much larger.
I just tried your example shader with my mesh and I get the same problem.  but if i use your mesh with my shader it works like a charm.  I guess the problem i'm having is in my mesh. hmmmm.
ok, so after some more testing, I can confirm that your mesh is also broken. But it was only seemed to occure when I put several instances of it in a bunch.   I just added a new modifier to the shader and recompiled it and for some reason it's working now.  Something fishy is going on.  I'm not 100% convinced that it's building it properly.
Thanks for testing further :)
Which mesh is broken how?
In what way did you "put instances in a bunch"?
Which modifier did you add?
I simply duplicated and dragged the mesh around the scene. as for the extra node, what all I did was add a lerp to assign which source the vertex channel should use because you use blue and I use green.  it was just to make my life easier while testing the two meshes.  Once I added that it started working, then I removed it and it was still working.  The other thing I did was re-export my mesh with scaling that was closer to what it should be, but I don't remember at what point I did that and if it had anything to do with it working.
Hm, alright, strange. I have no idea what could have caused this.

Mind if I close this thread, or do we have any more leads to go on?
nothing right now.  Go ahead and close it.  I'll just let you know if it happens again
Alright! Thanks for the help trying to figure it out :)