Repository navigation
Custom directional lighting - #37
Merged
Cameron (Cameron-Micka) merged 11 commits intoJun 29, 2022
Merged
Cameron (Cameron-Micka) merged 11 commits into
Cameron (Cameron-Micka) merged 11 commits into
Conversation
…hicsTools-Unity into user/cameron-micka/light_masks
Cameron (Cameron-Micka)
requested review from
Chuks Okafor (ChuksOk),
Martin Wettig (Species521) and
Adedeji Ogundipe (breezinstein)
June 28, 2022 23:42
Contributor
|
I tried my best to break it, but it works flawlessly. Also DIstantLights and DirectionalLights with similar settings are completely indistinguishable. As expected it integrates well in Unity's object menu and with the other light types, this is a real improvement. At some point it would be nice to see a detailed performance comparison, but that might be a separate point in the docs later. |
This was referenced Oct 13, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Overview
One feature a few users have asked for is "custom directional lighting" especially for UI. Normally this is done with light masks. In URP light masks are cheaper than multiple passes, but looping though all available lights is expensive for mobile stereo devices.
As an alternative a custom directional light (

DistantLight) behavior has been made that can be used rather than the default Unity directional light. The shader GUI allows the user to choose if they want to use the current Unity directional light or custom distant light:A
DistantLightcan be used as a replacement for a UnityDirectionalLight. The main purpose ofDistantLights is to recreate important light sources for environments, i.e. the sun or moon. Unity'sDirectionalLightis still the default for all new materials.Example of two spheres, one being lit by a red Unity

DirectionalLightand another being lit by a blueDistantLight:Note, one
DistantLightis currently supported alongside the UnityDirectionalLight.Other improvements include:
DistantLight,HoverLight,ProximityLightto remove duplicate implementationChanges
Verification