-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Implement per-light Specular property in DirectionalLight3D #83917
Implement per-light Specular property in DirectionalLight3D #83917
Conversation
Calinou
commented
Oct 25, 2023
•
edited
Loading
edited
- This closes DirectionalLight3D currently has no Specular property #80737.
- Supersedes Add Specular property to DirectionalLight3D #80742. Thanks @AndrewShobbrook for the original implementation 🙂
72a953a
to
7faedc2
Compare
7faedc2
to
b7c40ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me for RD. I expect a slight performance decrease when using DirectionalLights from this change as I think that part of the shader is relatively load/store bound. However, this was a missing feature so there is no way around it. I would avoid cherry picking this PR for that reason though
For compatibility, have you checked if the property is being sent from the CPU?
Can we do bitpacking or use FP16 in the future to reduce the performance impact? This particular value doesn't need much precision, as it's between 0.0 and 1.0 most of the time (rarely above 3.0). Half precision float would be fine, possibly even lower if it's converted from a fixed-point value. |
Bitpacking would most likely help as long as the bottleneck continues to be load/store related. You just need to find a property to pack with it |
Needs rebase before it can be merged |
b7c40ca
to
7758c72
Compare
7758c72
to
e42def1
Compare
Rebased and tested, it works as expected in Forward+/Mobile. I've also managed to fix it in Compatibility (both with shadows enabled and disabled): I was replacing the wrong argument in While testing this, I've also found that the Specular property doesn't do anything with any light type on vertex-shaded materials. This is an issue on all rendering methods. I believe it should be addressed separately as it'll require more shader changes. |
This is intentional. Neither metallic nor specular are used. |
Thanks! |
I meant the light's specular property, not the material's specular property (which is a derivative of its metallic behavior). Light3D Specular only affects the specular lobe (not other reflections), and it should be possible to make it affect vertex-shaded materials too. |