Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to 2018.1 #15

Closed
mikegeig opened this issue Apr 16, 2018 · 5 comments
Closed

Updating to 2018.1 #15

mikegeig opened this issue Apr 16, 2018 · 5 comments

Comments

@mikegeig
Copy link

Nice shaders! This isn't an "issue" but I wanted to let you know how to fix an error that pops up in 2018.1. We've changed this line:
float attenuation = LIGHT_ATTENUATION(input);
And you can update it to be:
UNITY_LIGHT_ATTENUATION(attenuation, input, input.posWorld.xyz);
Hope that helps someone. Cheers!

@traggett
Copy link
Owner

Ah awesome thanks for the tip! Hey do you work for Unity? I wondering if you could maybe help with a Sprite lighting problem I encountered when making these shaders..

So in order for normal maps to work on Sprite Renderers they obv need to caluclate the binormals correctly.
However! If a SpriteRenderer is set to 'Flip X' or 'Flip Y' then the binormals also need to be flipped but there appears now way of the shader knowing the sprite is flipped (the usual method is using unity_WorldTransformParams but unity_WorldTransformParams.w isn't set to -1).

I found a bug which says unity_WorldTransformParams.w is not changing for Sprites and its closed and marked By Design:
https://issuetracker.unity3d.com/issues/unity-worldtransformparams-dot-w-do-not-work-with-sprites

If it's by design then what is the design or method recommended for correctly calculating binormals for negatively scaled or flipped SpriteRenderers? Is they any way of the shaders knowing a Sprite is flipped?

Thanks a lot!

@jkampitakis
Copy link

Hello,
the first argument "attenuation" is unknown..
How can we fix this?

@traggett
Copy link
Owner

Hey, what version of Unity are you using?

@jkampitakis
Copy link

2018.1.6f1

I managed to make it work.

Thanks.

@traggett
Copy link
Owner

OK cool, let me know if you found a bug though!
Cheers :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants