-
Notifications
You must be signed in to change notification settings - Fork 855
Added an SG node to get the Main light in HDRP and URP [22.1] #5086
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
Conversation
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. HDRP URP Shader Graph Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
It appears that you made a non-draft PR! |
...ender-pipelines.high-definition/Editor/Material/ShaderGraph/Nodes/HDSunLightDirectionNode.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoop.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderGraphFunctions.hlsl
Outdated
Show resolved
Hide resolved
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.
Working well on URP lit/unlit. This will be a great addition for unlit!
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.
LGTM. I think this solves some issues we have as well with users trying to do this with custom node.
I wonder about shadows. We see users do custom node for main light shadows as well. In URP this would be easy to support either as separate node or part of same node.
Sadly this is not as easy for HDRP, so this should probably be URP only |
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, tested on a XPipeline Project
com.unity.shadergraph/Editor/Data/Nodes/Input/Lighting/GetMainLightNode.cs
Outdated
Show resolved
Hide resolved
make it the actual direction
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.
Not sure that there was a thorough planning for this feature, in URP this is a pointless node as a user would still have to make a custom main light node to get the colour and shadows. This means a broken incomplete workflow which I'm not sure we want to go down.
If HDRP cannot provide this information then I ask why bother with this node if it only supports 1/3 for the data a user would want in URP and not a great experience on HDRP side?
Furthermore with the coming Forward+ in URP does it make sense to have this separation in shader graph, as the concept of a main light is a URP only thing and something made as a fast path for simple Forward games that only required a single directional light?
@Verasl There are certainly uses cases that would need colour and shadow information for URP, but these wouldn't be cross pipeline workflows. Regarding the main light concept, it's something we have in HDRP regardless of the shading mode. And for URP the node is a wrapper around GetMainLight already available in shaders so if there is a problem it should be handled there |
As a note: we have indeed get request for a cross pipeline way of getting main light direction. Indeed for URP itself users will prefer to access other light properties but for HDRP due to pre-exposure concept that can quicky create a wrong visual this is not recommended. |
Purpose of this PR
Added a ShaderGraph node to get the sun light direction for URP and HDRP.
Testing status
Tested the node in a shadergraph with a HDRP and URP target.
Tested on the preview material.
Verified the node preview output.
Tested with no directional light (gives 0 vector)
Verified the node follows these guidelines: https://confluence.unity3d.com/pages/viewpage.action?spaceKey=SHAD&title=Node+Style+Guide
Example in HDRP:
