Skip to content

HDRP sub targets refactor #773

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

Merged
merged 38 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
60a327c
Moved sub-target upgrade code to migration files and refactored the H…
alelievr May 20, 2020
53c2f9a
Merge branch 'sg/master-stack' into HDRP/stack-targets-refactor
alelievr May 25, 2020
64d3581
Made property row labels flexible
alelievr May 26, 2020
021e99d
Fixed indent level of propertyRow
alelievr May 26, 2020
f3cf3d5
Added more control to indent level and clear foldout
alelievr May 26, 2020
abf7d0e
Merge remote-tracking branch 'origin/sg/flexible-property-row' into H…
alelievr May 26, 2020
2d9adfd
Refactored inspector GUI for HD lit and hair master node
alelievr May 26, 2020
3ac3ae8
Merge branch 'sg/master-stack' into HDRP/stack-targets-refactor
alelievr May 26, 2020
fe1c534
Fixed compilation
alelievr May 26, 2020
5d37b43
Moved fabric subtarget GUI to new system
alelievr May 26, 2020
1ccbcba
Converted Eye and stacklit settings to new GUI system
alelievr May 26, 2020
026cc02
Finished decal and unlit inspector settings
alelievr May 27, 2020
8a59d3a
Add missing unlit distortion only + remove unlitPass template + fix d…
alelievr May 28, 2020
69ee8dc
Testing new pass override system
alelievr May 28, 2020
bdf5717
Revert assets
alelievr May 28, 2020
e92a0f7
Merge branch 'sg/master-stack' into HDRP/shader-stacks-fixes
alelievr May 28, 2020
e47e884
Merge branch 'HDRP/shader-stacks-fixes' into HDRP/stack-targets-refac…
alelievr May 28, 2020
78ac3d0
Started to factorize passes for Unlit & fix distortion only in the in…
alelievr May 28, 2020
a3272d6
Shared all non DXR passes between shaders
alelievr May 29, 2020
0577738
Fixed unlit depth prepass
alelievr May 29, 2020
28fa70e
Fix lot of issues with shared render passes
alelievr Jun 3, 2020
5972b5f
Merge branch 'sg/master-stack' into HDRP/stack-targets-refactor-2
alelievr Jun 3, 2020
c3ed72e
Moved SSS property to target specific and converted all ray tracing p…
alelievr Jun 3, 2020
6d394ec
Fix missing normal space
alelievr Jun 3, 2020
ef2c086
Shared more code between passes
alelievr Jun 4, 2020
bcc24b6
Merge branch 'sg/master-stack' into HDRP/stack-targets-refactor-2
alelievr Jun 4, 2020
defe67d
Added file dependency and remove unused template path
alelievr Jun 4, 2020
5075eaa
Added target block context changes
alelievr Jun 4, 2020
89cd155
Removed all the commented code
alelievr Jun 4, 2020
f7ac830
Fix anisotropy indent level
alelievr Jun 5, 2020
0584da2
Merge branch 'sg/master-stack' into HDRP/stack-targets-refactor-2
alelievr Jun 5, 2020
4834837
Fixed yamato compilation issue
alelievr Jun 5, 2020
25cb3f7
Fixed stacklit and raytracing prepass shader issues
alelievr Jun 5, 2020
47f3789
Invert pass order
alelievr Jun 8, 2020
c99ad0b
Fixed shadow matte
alelievr Jun 8, 2020
50e9fe3
Enable virtual texturing in forward only
alelievr Jun 8, 2020
65b04f1
Wrong emplacement for virtual texture feedback
alelievr Jun 8, 2020
0ebf59f
Fixed unwanted require field list modification
alelievr Jun 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ namespace UnityEditor.Rendering.HighDefinition.ShaderGraph
{
sealed partial class DecalSubTarget : HDSubTarget, ILegacyTarget, IRequiresData<DecalData>
{
static string passTemplatePath => $"{HDUtils.GetHDRenderPipelinePath()}Editor/Material/Decal/ShaderGraph/DecalPass.template";

public DecalSubTarget() => displayName = "Decal";

public static string passTemplatePath => $"{HDUtils.GetHDRenderPipelinePath()}Editor/Material/Decal/ShaderGraph/DecalPass.template";

protected override string templatePath => passTemplatePath;
protected override string subTargetAssetGuid => "3ec927dfcb5d60e4883b2c224857b6c2";
protected override string customInspector => "Rendering.HighDefinition.DecalGUI";
protected override string renderType => HDRenderTypeTags.Opaque.ToString();
protected override string renderQueue => HDRenderQueue.GetShaderTagValue(HDRenderQueue.ChangeType(HDRenderQueue.RenderQueueType.Opaque, decalData.drawOrder, false));
protected override ShaderID shaderID => HDShaderUtils.ShaderID.SG_Lit;

// Material Data
DecalData m_DecalData;
Expand Down Expand Up @@ -84,8 +86,6 @@ protected override void AddInspectorPropertyBlocks(SubTargetPropertiesGUI blockL
blockList.AddPropertyBlock(new DecalPropertyBlock(decalData));
}

protected override ShaderID shaderID => HDShaderUtils.ShaderID.SG_Lit;

public override void CollectShaderProperties(PropertyCollector collector, GenerationMode generationMode)
{
Vector1ShaderProperty drawOrder = new Vector1ShaderProperty();
Expand Down Expand Up @@ -575,6 +575,7 @@ static class Descriptors
};
}
#endregion
// protected override IncludeCollection subShaderIncludes => "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Decal/Decal.hlsl";

#region Includes
static class DecalIncludes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,13 @@ public MaterialType materialType
get => m_MaterialType;
set => m_MaterialType = value;
}

[SerializeField]
bool m_SubsurfaceScattering = false;
public bool subsurfaceScattering
{
get => m_SubsurfaceScattering;
set => m_SubsurfaceScattering = value;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ Pass
// Perform alpha test very early to save performance (a killed pixel will not sample textures)
// TODO: split graph evaluation to grab just alpha dependencies first? tricky..
#ifdef _ALPHATEST_ON
$DoAlphaTest: DoAlphaTest(surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold);
$DoAlphaTest: GENERIC_ALPHA_TEST(surfaceDescription.Alpha, surfaceDescription.AlphaClipThreshold);
$DoAlphaTestPrepass: GENERIC_ALPHA_TEST(surfaceDescription.Alpha, surfaceDescription.AlphaClipThresholdDepthPrepass);
$DoAlphaTestPostpass: GENERIC_ALPHA_TEST(surfaceDescription.Alpha, surfaceDescription.AlphaClipThresholdDepthPostpass);
$DoAlphaTestShadow: GENERIC_ALPHA_TEST(surfaceDescription.Alpha, surfaceDescription.AlphaClipThresholdShadow);
#endif

$DepthOffset: ApplyDepthOffsetPositionInput(V, surfaceDescription.DepthOffset, GetViewForwardDir(), GetWorldToHClipMatrix(), posInput);
Expand All @@ -264,7 +267,10 @@ Pass

#ifdef _ALPHATEST_ON
// Used for sharpening by alpha to mask
$DoAlphaTest: builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThreshold;
$DoAlphaTest: builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThreshold;
$DoAlphaTestPrepass: builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThresholdDepthPrepass;
$DoAlphaTestPostpass: builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThresholdDepthPostpass;
$DoAlphaTestShadow: builtinData.alphaClipTreshold = surfaceDescription.AlphaClipThresholdShadow;
#endif

// override sampleBakedGI:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
systemData.alphaTestDepthPostpass = eyeMasterNode.m_AlphaTestDepthPostpass;
systemData.sortPriority = eyeMasterNode.m_SortPriority;
systemData.doubleSidedMode = eyeMasterNode.m_DoubleSidedMode;
systemData.zWrite = eyeMasterNode.m_ZWrite;
systemData.transparentZWrite = eyeMasterNode.m_ZWrite;
systemData.transparentCullMode = eyeMasterNode.m_transparentCullMode;
systemData.zTest = eyeMasterNode.m_ZTest;
systemData.supportLodCrossFade = eyeMasterNode.m_SupportLodCrossFade;
Expand All @@ -49,8 +49,8 @@ public bool TryUpgradeFromMasterNode(IMasterNode1 masterNode, out Dictionary<Blo
lightingData.receiveSSRTransparent = eyeMasterNode.m_ReceivesSSRTransparent;
lightingData.specularOcclusionMode = eyeMasterNode.m_SpecularOcclusionMode;
lightingData.overrideBakedGI = eyeMasterNode.m_overrideBakedGI;
lightingData.subsurfaceScattering = eyeMasterNode.m_SubsurfaceScattering;

eyeData.subsurfaceScattering = eyeMasterNode.m_SubsurfaceScattering;
eyeData.materialType = (EyeData.MaterialType)eyeMasterNode.m_MaterialType;
target.customEditorGUI = eyeMasterNode.m_OverrideEnabled ? eyeMasterNode.m_ShaderGUIOverride : "";

Expand Down Expand Up @@ -84,9 +84,9 @@ bool AdditionalSlotMaskTests(EyeMasterNode1.SlotMask slotMask)
case EyeMasterNode1.SlotMask.SpecularOcclusion:
return lightingData.specularOcclusionMode == SpecularOcclusionMode.Custom;
case EyeMasterNode1.SlotMask.DiffusionProfile:
return lightingData.subsurfaceScattering;
return eyeData.subsurfaceScattering;
case EyeMasterNode1.SlotMask.SubsurfaceMask:
return lightingData.subsurfaceScattering;
return eyeData.subsurfaceScattering;
case EyeMasterNode1.SlotMask.AlphaClipThreshold:
return systemData.alphaTest;
default:
Expand Down
Loading