-
Notifications
You must be signed in to change notification settings - Fork 840
Fix Refraction #2220
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
Fix Refraction #2220
Conversation
It appears that you made a non-draft PR! |
# Conflicts: # com.unity.render-pipelines.high-definition/Editor/Material/Lit/ShaderGraph/HDLitSubTarget.Migration.cs # com.unity.render-pipelines.high-definition/Editor/Material/Unlit/ShaderGraph/HDUnlitSubTarget.Migration.cs
# Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md
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.
Checking with Antoine, there's an issue with Blending Mode still getting displayed in material(and material being affected by it) when material is created with Refraction Model set None. After shadergraph Refraction Model is changed to anything from "none", materials should hide Blending Mode option, but that does not happen
…ion is enabled in SG)
…com/Unity-Technologies/Graphics into HDRP/fix/pre-refraction-shadergraph # Conflicts: # com.unity.render-pipelines.high-definition/Editor/Material/UIBlocks/LitShaderGraphGUI.cs
… project settings
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.
PR retargeted to master |
@@ -233,7 +233,8 @@ public static System.Collections.Generic.List<HDRenderQueue.RenderQueueType> Get | |||
} | |||
else | |||
{ | |||
result.Add(HDRenderQueue.RenderQueueType.PreRefraction); | |||
if (!hasRefraction) |
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.
thinking about that, what is happening if we are on prerefraction rendering pass and we select a refraction mode . In shader code it will work (refraction is just disabled), but in the UI. cc @TomasKiniulis
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.
I guess it is the same problem than for blend mode, we will need to always display the value but have a warning to say that it is not working. Thought?
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.
When I tested it was automatically setting the rendering pass to Default instead of Pre-Refraction
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.
@@ -69,6 +69,10 @@ To create a new Lit Material, navigate to your Project's Asset window, right-cli | |||
|
|||
Unity exposes this section if you select **Transparent** from the **Surface Type** drop-down. For information on the properties in this section, see the [Surface Type documentation](Surface-Type.md#TransparencyInputs). | |||
|
|||
:warning: When you enabled the **Refraction**, make sure to use the **Blend Mode** **Alpha**, otherwise the effect will not work as expected. A similar warning will be displayed in the material inspector if you enabled refraction with a **Blend Mode** different than **Alpha**. |
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.
No emojis ❗
Be aware that when you enable Refraction, make sure to set Blend Mode to Alpha, otherwise the effect does not work as expected. If you enable Refraction and use a Blend Mode other than Alpha, a warning displays in the material Inspector.
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.
No emojis ❗
noooo! (btw, do you know why? we have them in the inspector, why not in the doc?)
com.unity.render-pipelines.high-definition/Documentation~/Lit-Shader.md
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.
Rewrote a couple of bits
Purpose of this PR
Expose the refraction mode to the material inspector from SG. Note that the refraction mode is only displayed in the material when it's enabled in the shader graph:

Added a warning when using a blend mode different than Alpha and refraction is enabled:

Updated documentation accordingly:

Also fixed this issue:
Issue: In the ShaderGraph settings, we can set the rendering pass value to pre-refraction with refraction enabled, which should not be possible.
This PR fixes this issue and hides the pre-refraction option in the rendering pass field when refraction is enabled in the shader.
Note that this PR also include the code from Fix render queue migration to 10.x #2198 that was reverted from staging
Behavior changes in the refraction material UI: now the pre-refraction is always visible in the rendering pass field and a warning is displayed if refraction is enabled with pre-refraction rendering pass instead of the refraction block being hidden.
Testing status
Tested that pre-refraction is hidden when we enabled refraction in both the material and ShaderGraph.

I also ran DXR + HDRP_Tests, all green