-
Notifications
You must be signed in to change notification settings - Fork 840
Remove BLEND keywords and replace with constant branch #1884
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
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
com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl
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.
We discussed about this : https://github.com/Unity-Technologies/Graphics/pull/1884/files#diff-0f3209dd5b092701c9a479cd175f56c9R434
It seems fine, no real impact on the VFX where it's still a #define
Specific to HDRP.
com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitTessellation.shader
Show resolved
Hide resolved
com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl
Show resolved
Hide resolved
@@ -431,13 +431,13 @@ public override void OnEnable() | |||
switch (blendMode) | |||
{ | |||
case BlendMode.Alpha: | |||
forwardDefines.WriteLine("#define _BLENDMODE_ALPHA"); | |||
forwardDefines.WriteLine("#define _BlendMode 0"); |
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.
hmm... wondering if we can define based on
#define BLENDMODE_ALPHA (0)
#define BLENDMODE_PREMULTIPLY (4)
#define BLENDMODE_ADDITIVE (1)
here
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 won't work as we don't have the include in hlsl all the time for vfx last I checked. I can see if I can make sure that is included or if I didn't look well enough :-)
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.
That said, while def it would look better, it is still hardcoded in a string, so won't save our ass in case of changes.
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.
FYI, this defines lands here
Unlit (not concerned) :
Indeed, there isn't any include before these define, we can potential feed these #define BLENDMODE_ALPHA (0)
within the same function, before the switch, not sure it's worth it.
Isn't there a enum which fits these value ? I could be a generated string.
#define BLENDMODE_ALPHA (0)
#define BLENDMODE_PREMULTIPLY (4)
#define BLENDMODE_ADDITIVE (1)
@FrancescoC-unity Can you confirm these defines are only needed for lit output ? The output which are including :
- Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl
- Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl
- Packages/com.unity.render-pipelines.high-definition/Runtime/Material/BuiltinUtilities.hlsl
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.
There is an enum on C# that generate an hlsl file with the defines, that hlsl file is included in Material/Material.hlsl
, however we cannot do our define after the include of Material.hlsl, otherwise it won't compile. So we need an additional include for that specific file.
Whether is worth it or not I guess I'll leave the decision to you guys, feels a bit overkill to me, but indeed it'd make it a tad more readable.
This would be needed for whatever includes Material.hlsl, so yes, I assume only lit output.
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, it is required for both lit and unlit transparent.
ok nevermind for now, this is something that can't change anyway to not break the universe, let's just add a comment on which enum it map for now.
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, unlit vfx doesn't use the blend mode as in HDRP, so does not need this as it does not include Material.hlsl
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.
This was verified btw running the test, if it was needed for Unlit too the test wouldn't have compiled
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, it is required for both lit and unlit transparent.
No, unlit vfx doesn't use the blend mode as in HDRP,
I confirm @FrancescoC-unity point, only needed for Lit HDR. For instance, it's needed using internal EvaluateAtmosphericScattering
For the fog evaluation, we are manually applying falloff using other defines : https://github.cds.internal.unity3d.com/unity/vfx-graphics/blob/vfx/staging/com.unity.render-pipelines.high-definition/Runtime/VFXGraph/Shaders/VFXCommon.hlsl#L154
If there is a compilation error in case of mistake, that's fine !
@@ -120,7 +120,8 @@ Shader "HDRP/AxF" | |||
|
|||
|
|||
// [ToggleUI] _EnableFogOnTransparent("Enable Fog", Float) = 1.0 | |||
// [ToggleUI] _EnableBlendModePreserveSpecularLighting("Enable Blend Mode Preserve Specular Lighting", Float) = 1.0 | |||
// We never set this as it is always 1, but its definition is needed when performing blending in Material.hlsl | |||
[HideInInspector][ToggleUI] _EnableBlendModePreserveSpecularLighting("Enable Blend Mode Preserve Specular Lighting", Float) = 1.0 |
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.
it is not true (at least for now as _BLENDMODE_PRESERVE_SPECULAR_LIGHTING is still a keyword)
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 am referencing the property not keyword here, beforehand the property was not used, here I instead just define it (the keyword is still used as it should)
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.
In any case it is actually not true anymore (is not needed anymore after some subsequent changes I made) so I will revert this bit tomorrow.
This reverts commit e3183f0.
* Fix warning in ShaderPassDecal.hlsl * Tooltip for microshadows (#2100) * Update Alembic version to stop Alembic complaining * Disable quad overdraw on ps4 (#2107) * disable quad overdraw on ps4 * update doc Co-authored-by: sebastienlagarde <sebastien@unity3d.com> * Enable the DXR Vertex Format test for RG (#2022) * Add option to enable pure specular planar reflection (optimization) (#2105) * - Added a rough refraction option on planar reflections. - Added a rough distortion frame setting and and info box on distortion materials. - Added tests to cover the new features. * review changes * removed PerceptualRoughnessToMipmapLevel_LODFlag which isn't required. * clean more code (remove OutputSmoothPlanarReflection) * missing one update * removed rough distortion * remove distortion test scene * Update DistortionUIBlock.cs * clean distortion * update documentation * address doc feedback * Update Upgrading-from-2020.1-to-2020.2.md * Update Upgrading-from-2020.1-to-2020.2.md * update test 2220 * update smoothness test * Create 2220_SmoothPlanarReflection.png * update reference screenshots Co-authored-by: Anis <anis@unity3d.com> * Implementing scalabity settings for planar resolutions (#2059) * - Added a rough refraction option on planar reflections. - Added a rough distortion frame setting and and info box on distortion materials. - Added tests to cover the new features. * review changes * Added scalability settings for the planar reflection resolution. * support migration. * renamed the resolution parameters for the planar reflections * removed PerceptualRoughnessToMipmapLevel_LODFlag which isn't required. * clean more code (remove OutputSmoothPlanarReflection) * missing one update * removed rough distortion * remove distortion test scene * Update DistortionUIBlock.cs * clean distortion * update documentation * address doc feedback * Update Upgrading-from-2020.1-to-2020.2.md * Update Upgrading-from-2020.1-to-2020.2.md * update test 2220 * Revert "renamed the resolution parameters for the planar reflections" This reverts commit 753af88. * cleanup migration code * update smoothness test * Create 2220_SmoothPlanarReflection.png * some cleanup * Revert "Revert "renamed the resolution parameters for the planar reflections"" This reverts commit fbf3572. * update doc Co-authored-by: sebastienlagarde <sebastien@unity3d.com> * Remove useless SampleSkyTexture function * Fix errors when resizing the compositor's output and when removing/adding the compositor (#2118) # Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md * Remove BLEND keywords and replace with constant branch (#1884) * Removing blend keyword. * Changelog * Update DecalProperties.hlsl * revert change in AxF shader * fix compile issue with ordering when using VT * update comment * Update Upgrading-from-2020.1-to-2020.2.md * update comment + optimized code version (in case of bad compiler) * update comment revert (wrong) optimization * remove unused multicopmile in test * candidate fix for VFX * Revert "candidate fix for VFX" This reverts commit e3183f0. * Another tentative fix * Try differently * Fix compile issue. * Another vfx fix attempt. * Latest flavour of fix. * Remove old defines * Fix hybrid * Update includes in ray tracing * Update Upgrading-from-2020.1-to-2020.2.md Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com> * Mixed cached shadow maps (Cached static + dynamic rendered every frame) (#1559) * UI for mixed cached shadows * Baby steps (# 1) * Baby steps (# 2) * Extrapolate the update request data into a function * Commit before blit code * Need to switch branch * Need to switch branch * Working as long the light does not move. * Fixed area light case * Make it render graph ready * Make sure we correctly update the freshly updated cached shadows * Raw update upon movement option (Missing API for threshold) * Threshold API * Add unity binary tag * New docs * Shader name change * Update docs * Fix bad merge * Update Shadows-in-HDRP.md * For now disable the directional light case. * Disable directional mixed. * Make it disabled under define * Remove docs * Implement rendergraph version * Remove superflous blit * Tentative fix for yamato. Co-authored-by: JordanL8 <lewis.jordan@hotmail.co.uk> * update meta file with wrong information Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com> Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com> Co-authored-by: Anis <anis@unity3d.com> Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com> Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com> Co-authored-by: JordanL8 <lewis.jordan@hotmail.co.uk>
Mostly all in the title. This should reduce build times when a mix of blend modes are used in the project.
There were some gotchas with VFX and shadergraph, but all are sorted in this PR.
Tests pass locally, but launching yamato anyway to be sure.