Compare commits
8 Commits
ea3e83157c
...
3.0.1-pre
| Author | SHA1 | Date | |
|---|---|---|---|
| 35dc7b15a6 | |||
| d19322b768 | |||
| 961db806e9 | |||
| 10331b93ff | |||
| abdf6196ed | |||
| 410af63578 | |||
| 5a282e0812 | |||
| b205c1523d |
@@ -26,6 +26,16 @@ namespace Misaki.HdrpToon.Editor
|
||||
return (PBRMode)material.GetInteger(SurfaceOptions.PBR_MODE);
|
||||
}
|
||||
|
||||
public static MaterialType GetMaterialType(this Material material)
|
||||
{
|
||||
if (!material.HasProperty(SurfaceOptions.MATERIAL_TYPE))
|
||||
{
|
||||
return MaterialType.Standard;
|
||||
}
|
||||
|
||||
return (MaterialType)material.GetInteger(SurfaceOptions.MATERIAL_TYPE);
|
||||
}
|
||||
|
||||
public static bool HasFeature(this Material material, SurfaceFeature feature)
|
||||
{
|
||||
if (!material.HasProperty(SurfaceOptions.SURFACE_FEATURE))
|
||||
@@ -36,5 +46,10 @@ namespace Misaki.HdrpToon.Editor
|
||||
var value = (SurfaceFeature)material.GetInteger(SurfaceOptions.SURFACE_FEATURE);
|
||||
return (value & feature) != 0;
|
||||
}
|
||||
|
||||
public static bool IsHairBlendingTarget(this Material material)
|
||||
{
|
||||
return material.GetShaderPassEnabled(UtsShaderPassName.HAIR_BLENDING_TARGET_PASS_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,14 @@ namespace Misaki.HdrpToon.Editor
|
||||
Highlight = 1 << 6,
|
||||
Rimlight = 1 << 7,
|
||||
MatCap = 1 << 8,
|
||||
AngelRing = 1 << 9,
|
||||
Emission = 1 << 10,
|
||||
Outline = 1 << 11,
|
||||
TessellationLegacy = 1 << 12,
|
||||
Stocking = 1 << 9,
|
||||
AngelRing = 1 << 10,
|
||||
Emission = 1 << 11,
|
||||
Outline = 1 << 12,
|
||||
TessellationHDRP = 1 << 13,
|
||||
SceneLight = 1 << 14,
|
||||
EnvironmentalLightEffectiveness = 1 << 15,
|
||||
MetaverseSettings = 1 << 16,
|
||||
Advance = 1 << 17,
|
||||
}
|
||||
}
|
||||
|
||||
55
Editor/MeterialEditor/UIScopes/AdvanceScope.cs
Normal file
55
Editor/MeterialEditor/UIScopes/AdvanceScope.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Misaki.ShaderGUI;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
using static Misaki.HdrpToon.UtsShaderPropertyName.Advance;
|
||||
|
||||
namespace Misaki.HdrpToon.Editor
|
||||
{
|
||||
public class AdvanceScope : MaterialUIScope<ShaderGUIExpandable>
|
||||
{
|
||||
private static class Properties
|
||||
{
|
||||
public static MaterialProperty diffuseMin;
|
||||
|
||||
public static MaterialProperty lightIntensityMultiplier;
|
||||
public static MaterialProperty clampLightColor;
|
||||
|
||||
public static MaterialProperty lightLoopMode;
|
||||
}
|
||||
|
||||
private static class Styles
|
||||
{
|
||||
public static readonly GUIContent diffuseMinText = new("Minimal diffuse contribution", "Specifies the minimum contribution of the base color to the diffuse light. Keep it 0 to make sure energy conservation.");
|
||||
|
||||
public static readonly GUIContent lightIntensityMultiplierText = new("Light Intensity Multiplier", "Specifies the intensity multiplier of the light.");
|
||||
public static readonly GUIContent clampLightColorText = new("Clamp Light Color", "Specifies whether to clamp the light color.");
|
||||
|
||||
public static readonly GUIContent lightLoopModeText = new("Light Loop Mode", "Specifies the light loop mode.");
|
||||
}
|
||||
|
||||
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Advance;
|
||||
|
||||
protected override GUIContent Header => EditorGUIUtility.TrTextContent("Advance Settings");
|
||||
|
||||
public override void LoadMaterialProperties()
|
||||
{
|
||||
Properties.diffuseMin = FindProperty(MINIMAL_DIFFUSE_CONTRIBUTION);
|
||||
|
||||
Properties.lightIntensityMultiplier = FindProperty(LIGHT_INTENSITY_MULTIPLIER);
|
||||
Properties.clampLightColor = FindProperty(CLAMP_LIGHT_COLOR);
|
||||
|
||||
Properties.lightLoopMode = FindProperty(LIGHT_LOOP_MODE);
|
||||
}
|
||||
|
||||
protected override void DrawContent()
|
||||
{
|
||||
editor.ShaderProperty(Properties.diffuseMin, Styles.diffuseMinText);
|
||||
|
||||
editor.ShaderProperty(Properties.lightIntensityMultiplier, Styles.lightIntensityMultiplierText);
|
||||
editor.ShaderProperty(Properties.clampLightColor, Styles.clampLightColorText);
|
||||
|
||||
editor.ShaderProperty(Properties.lightLoopMode, Styles.lightLoopModeText);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Editor/MeterialEditor/UIScopes/AdvanceScope.cs.meta
Normal file
2
Editor/MeterialEditor/UIScopes/AdvanceScope.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3acfee7f0a1007e4bb2a3b42a6282d52
|
||||
@@ -17,6 +17,10 @@ namespace Misaki.HdrpToon.Editor
|
||||
public static MaterialProperty indirectDiffuseMatCapMap;
|
||||
public static MaterialProperty indirectDiffuseMatCapLod;
|
||||
|
||||
public static MaterialProperty indirectDiffuseRampMap;
|
||||
public static MaterialProperty indirectDiffuseRampIndex;
|
||||
public static MaterialProperty indirectDiffuseRampPosition;
|
||||
|
||||
public static MaterialProperty indirectDiffuseIntensity;
|
||||
public static MaterialProperty ssaoWeight;
|
||||
public static MaterialProperty ssgiWeight;
|
||||
@@ -35,6 +39,9 @@ namespace Misaki.HdrpToon.Editor
|
||||
|
||||
public static readonly GUIContent indirectDiffuseMatCapMapText = new("MatCap Map", "The material capture map for indirect diffuse evaluation, with the additional setting for controlling the LOD offset when sampling the indirect diffuse material capture map.");
|
||||
|
||||
public static readonly GUIContent indirectDiffuseRampMapText = new("Ramp Map", "The ramp map for indirect diffuse evaluation, with the additional setting for controlling the sampling index of the ramp map.");
|
||||
public static readonly GUIContent indirectDiffuseRampPositionText = new("Ramp Position", "The ramp position for indirect diffuse evaluation.");
|
||||
|
||||
public static readonly GUIContent indirectDiffuseIntensityText = new("Intensity", "The indirect diffuse color is added to the material color according to the intensity value.");
|
||||
public static readonly GUIContent ssaoWeightText = new("SSAO Weight", "The weight of SSAO.");
|
||||
public static readonly GUIContent ssgiWeightText = new("SSGI Weight", "The weight of SSGI.");
|
||||
@@ -53,6 +60,10 @@ namespace Misaki.HdrpToon.Editor
|
||||
Properties.indirectDiffuseMatCapMap = FindProperty("_IndirectDiffuseMatCapMap");
|
||||
Properties.indirectDiffuseMatCapLod = FindProperty("_IndirectDiffuseMatCapLod");
|
||||
|
||||
Properties.indirectDiffuseRampMap = FindProperty("_IndirectDiffuseRampMap");
|
||||
Properties.indirectDiffuseRampIndex = FindProperty("_IndirectDiffuseRampIndex");
|
||||
Properties.indirectDiffuseRampPosition = FindProperty("_IndirectDiffuseRampPosition");
|
||||
|
||||
Properties.indirectDiffuseIntensity = FindProperty("_IndirectDiffuseIntensity");
|
||||
Properties.ssaoWeight = FindProperty("_SSAOWeight");
|
||||
Properties.ssgiWeight = FindProperty("_SSGIWeight");
|
||||
@@ -64,6 +75,36 @@ namespace Misaki.HdrpToon.Editor
|
||||
Properties.ssrWeight = FindProperty("_SSRWeight");
|
||||
}
|
||||
|
||||
private static void DrawIndirectDiffuseHeader()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
using var indentLevelScope = new EditorGUI.IndentLevelScope(-1);
|
||||
EditorGUILayout.LabelField("Indirect Diffuse", EditorStyles.boldLabel);
|
||||
}
|
||||
|
||||
private void DrawIndirectDiffuseProperties()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
editor.ShaderProperty(Properties.indirectDiffuseIntensity, Styles.indirectDiffuseIntensityText);
|
||||
editor.ShaderProperty(Properties.ssaoWeight, Styles.ssaoWeightText);
|
||||
}
|
||||
|
||||
private void DrawIndirectSpecularProperties()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
editor.ShaderProperty(Properties.indirectReflectionIntensity, Styles.indirectReflectionIntensityText);
|
||||
editor.ShaderProperty(Properties.ssrWeight, Styles.ssrWeightText);
|
||||
}
|
||||
|
||||
private static void DrawIndirectSpecularHeader()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
using (var indentLevelScope = new EditorGUI.IndentLevelScope(-1))
|
||||
{
|
||||
EditorGUILayout.LabelField("Indirect Specular", EditorStyles.boldLabel);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void DrawContent()
|
||||
{
|
||||
editor.ShaderProperty(Properties.indirectDiffuseMode, Styles.indirectDiffuseModeText);
|
||||
@@ -74,41 +115,43 @@ namespace Misaki.HdrpToon.Editor
|
||||
|
||||
if (indirectDiffuseMode != IndirectDiffuseMode.Off)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
using (var indentLevelScope = new EditorGUI.IndentLevelScope(-1))
|
||||
DrawIndirectDiffuseHeader();
|
||||
|
||||
switch (indirectDiffuseMode)
|
||||
{
|
||||
EditorGUILayout.LabelField("Indirect Diffuse", EditorStyles.boldLabel);
|
||||
case IndirectDiffuseMode.IBL:
|
||||
editor.ShaderProperty(Properties.ssgiWeight, Styles.ssgiWeightText);
|
||||
break;
|
||||
case IndirectDiffuseMode.Matcap:
|
||||
editor.TexturePropertySingleLine(Styles.indirectDiffuseMatCapMapText, Properties.indirectDiffuseMatCapMap, Properties.indirectDiffuseMatCapLod);
|
||||
break;
|
||||
case IndirectDiffuseMode.Ramp:
|
||||
editor.TexturePropertySingleLine(Styles.indirectDiffuseRampMapText, Properties.indirectDiffuseRampMap, Properties.indirectDiffuseRampIndex);
|
||||
editor.ShaderProperty(Properties.indirectDiffuseRampPosition, Styles.indirectDiffuseRampPositionText);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (indirectDiffuseMode == IndirectDiffuseMode.Matcap)
|
||||
{
|
||||
editor.TexturePropertySingleLine(Styles.indirectDiffuseMatCapMapText, Properties.indirectDiffuseMatCapMap, Properties.indirectDiffuseMatCapLod);
|
||||
}
|
||||
|
||||
editor.ShaderProperty(Properties.indirectDiffuseIntensity, Styles.indirectDiffuseIntensityText);
|
||||
editor.ShaderProperty(Properties.ssaoWeight, Styles.ssaoWeightText);
|
||||
|
||||
if (indirectDiffuseMode == IndirectDiffuseMode.IBL)
|
||||
{
|
||||
editor.ShaderProperty(Properties.ssgiWeight, Styles.ssgiWeightText);
|
||||
}
|
||||
DrawIndirectDiffuseProperties();
|
||||
}
|
||||
|
||||
if (indirectSpecularMode != (int)IndirectSpecularMode.Off)
|
||||
if (indirectSpecularMode != IndirectSpecularMode.Off)
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
using (var indentLevelScope = new EditorGUI.IndentLevelScope(-1))
|
||||
DrawIndirectSpecularHeader();
|
||||
|
||||
switch (indirectSpecularMode)
|
||||
{
|
||||
EditorGUILayout.LabelField("Indirect Specular", EditorStyles.boldLabel);
|
||||
case IndirectSpecularMode.IBL:
|
||||
break;
|
||||
case IndirectSpecularMode.Matcap:
|
||||
editor.TexturePropertySingleLine(Styles.indirectSpecularMatCapMapText, Properties.indirectSpecularMatCapMap, Properties.indirectSpecularMatCapLod);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (indirectSpecularMode == IndirectSpecularMode.Matcap)
|
||||
{
|
||||
editor.TexturePropertySingleLine(Styles.indirectSpecularMatCapMapText, Properties.indirectSpecularMatCapMap, Properties.indirectSpecularMatCapLod);
|
||||
}
|
||||
|
||||
editor.ShaderProperty(Properties.indirectReflectionIntensity, Styles.indirectReflectionIntensityText);
|
||||
editor.ShaderProperty(Properties.ssrWeight, Styles.ssrWeightText);
|
||||
DrawIndirectSpecularProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
public static MaterialProperty rimLightColor;
|
||||
public static MaterialProperty rimLightIntensity;
|
||||
|
||||
public static MaterialProperty albedoAffectRimLight;
|
||||
public static MaterialProperty screenSpaceRimLight;
|
||||
public static MaterialProperty rimLightLevel;
|
||||
public static MaterialProperty rimLightClipping;
|
||||
@@ -28,6 +29,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
public static readonly GUIContent rimLightColorText = new("Rim Light Color", "Specifies the color of rim light.");
|
||||
public static readonly GUIContent rimLightIntensityText = new("Rim Light Strength", "Specifies Rim Light strength.");
|
||||
|
||||
public static readonly GUIContent albedoAffectRimLightText = new("Albedo Affect Rim Light", "Enable to let the albedo color affect the rim light color. The alpha channel of rim light color will be the blending weight.");
|
||||
public static readonly GUIContent screenSpaceRimLightText = new("Screen Space Rim Light", "Enable to make the rim light width constant in screen space.");
|
||||
public static readonly GUIContent rimLightLevelText = new("Rim Light Level", "Specifies Rim Light power intensity.");
|
||||
public static readonly GUIContent rimLightClippingText = new("Rim Light Clipping", "Enable to Clip the rim light at specific level");
|
||||
@@ -46,6 +48,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
Properties.rimLightColor = FindProperty(RIM_LIGHT_COLOR);
|
||||
Properties.rimLightIntensity = FindProperty(RIM_LIGHT_INTENSITY);
|
||||
|
||||
Properties.albedoAffectRimLight = FindProperty(ALBEDO_AFFECT_RIM_LIGHT);
|
||||
Properties.screenSpaceRimLight = FindProperty(SCREEN_SPACE_RIM_LIGHT);
|
||||
Properties.rimLightLevel = FindProperty(RIM_LIGHT_LEVEL);
|
||||
Properties.rimLightClipping = FindProperty(RIM_LIGHT_CLIPPING);
|
||||
@@ -60,6 +63,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
editor.ShaderProperty(Properties.rimLightColor, Styles.rimLightColorText);
|
||||
editor.ShaderProperty(Properties.rimLightIntensity, Styles.rimLightIntensityText);
|
||||
|
||||
editor.ShaderProperty(Properties.albedoAffectRimLight, Styles.albedoAffectRimLightText);
|
||||
editor.ShaderProperty(Properties.screenSpaceRimLight, Styles.screenSpaceRimLightText);
|
||||
editor.ShaderProperty(Properties.rimLightLevel, Styles.rimLightLevelText);
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace Misaki.HdrpToon.Editor
|
||||
public static MaterialProperty sdfShadowLevel;
|
||||
public static MaterialProperty sdfSmoothLevel;
|
||||
public static MaterialProperty sdfHighlightStrength;
|
||||
|
||||
public static MaterialProperty hairBlendingFactor;
|
||||
}
|
||||
|
||||
private static class Styles
|
||||
@@ -59,6 +61,8 @@ namespace Misaki.HdrpToon.Editor
|
||||
public static readonly GUIContent shadingRampMaskMapText = new("Shading Ramp Mask Map", "A texture that contains the mask for the shading ramp map.");
|
||||
|
||||
public static readonly GUIContent sdfHighlightStrengthText = new("SDF Highlight Strength", "Control the strength of the highlight in the SDF shading map.");
|
||||
|
||||
public static readonly GUIContent hairBlendingFactorText = new("Hair Blending Factor", "The blending factor for hair shading.");
|
||||
}
|
||||
|
||||
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.ShadingColor;
|
||||
@@ -108,6 +112,8 @@ namespace Misaki.HdrpToon.Editor
|
||||
Properties.sdfShadowLevel = FindProperty("_SDFShadowLevel");
|
||||
Properties.sdfSmoothLevel = FindProperty("_SDFShadowSmoothLevel");
|
||||
Properties.sdfHighlightStrength = FindProperty("_SDFHighlightStrength");
|
||||
|
||||
Properties.hairBlendingFactor = FindProperty("_HairBlendingFactor");
|
||||
}
|
||||
|
||||
protected override void DrawContent()
|
||||
@@ -144,6 +150,12 @@ namespace Misaki.HdrpToon.Editor
|
||||
editor.ShaderProperty(Properties.sdfHighlightStrength, Styles.sdfHighlightStrengthText);
|
||||
}
|
||||
|
||||
if (materials.All(material => material.GetMaterialType() == MaterialType.FrontHair))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
editor.ShaderProperty(Properties.hairBlendingFactor, Styles.hairBlendingFactorText);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
editor.TextureScaleOffsetProperty(Properties.baseColorMap);
|
||||
}
|
||||
|
||||
22
Editor/MeterialEditor/UIScopes/StockingScope.cs
Normal file
22
Editor/MeterialEditor/UIScopes/StockingScope.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Misaki.ShaderGUI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Misaki.HdrpToon.Editor
|
||||
{
|
||||
public class StockingScope : MaterialUIScope<ShaderGUIExpandable>
|
||||
{
|
||||
protected override ShaderGUIExpandable ExpandableBit => ShaderGUIExpandable.Stocking;
|
||||
|
||||
protected override GUIContent Header => throw new System.NotImplementedException();
|
||||
|
||||
public override void LoadMaterialProperties()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
protected override void DrawContent()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Editor/MeterialEditor/UIScopes/StockingScope.cs.meta
Normal file
2
Editor/MeterialEditor/UIScopes/StockingScope.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e91add2c76ce49448b768421496d94d
|
||||
@@ -12,28 +12,30 @@ namespace Misaki.HdrpToon.Editor
|
||||
{
|
||||
private static class Properties
|
||||
{
|
||||
public static MaterialProperty NormalMap;
|
||||
public static MaterialProperty NormalMapScale;
|
||||
public static MaterialProperty normalMap;
|
||||
public static MaterialProperty normalMapScale;
|
||||
|
||||
public static MaterialProperty MaskMap;
|
||||
public static MaterialProperty Metallic;
|
||||
public static MaterialProperty MetallicRemapMin;
|
||||
public static MaterialProperty MetallicRemapMax;
|
||||
public static MaterialProperty AORemapMin;
|
||||
public static MaterialProperty AORemapMax;
|
||||
public static MaterialProperty Smoothness;
|
||||
public static MaterialProperty SmoothnessRemapMin;
|
||||
public static MaterialProperty SmoothnessRemapMax;
|
||||
public static MaterialProperty maskMap;
|
||||
public static MaterialProperty metallic;
|
||||
public static MaterialProperty metallicRemapMin;
|
||||
public static MaterialProperty metallicRemapMax;
|
||||
public static MaterialProperty aoRemapMin;
|
||||
public static MaterialProperty aoRemapMax;
|
||||
public static MaterialProperty smoothness;
|
||||
public static MaterialProperty smoothnessRemapMin;
|
||||
public static MaterialProperty smoothnessRemapMax;
|
||||
|
||||
public static MaterialProperty AnisotropyMap;
|
||||
public static MaterialProperty Anisotropy;
|
||||
public static MaterialProperty KKColor;
|
||||
public static MaterialProperty BSDFContribution;
|
||||
public static MaterialProperty anisotropyMap;
|
||||
public static MaterialProperty anisotropy;
|
||||
public static MaterialProperty kkColor;
|
||||
public static MaterialProperty bsdfContribution;
|
||||
|
||||
public static MaterialProperty SpecularColorMap;
|
||||
public static MaterialProperty SpecularColor;
|
||||
public static MaterialProperty SpecularFeather;
|
||||
public static MaterialProperty SpecularStep;
|
||||
public static MaterialProperty specularColorMap;
|
||||
public static MaterialProperty specularColor;
|
||||
public static MaterialProperty specularFeather;
|
||||
public static MaterialProperty specularStep;
|
||||
|
||||
public static MaterialProperty hairBlendingMap;
|
||||
|
||||
public static MaterialProperty emissiveColorLDR;
|
||||
public static MaterialProperty emissiveColorMap;
|
||||
@@ -45,21 +47,23 @@ namespace Misaki.HdrpToon.Editor
|
||||
|
||||
private static class Styles
|
||||
{
|
||||
public static readonly GUIContent NormalMapText = new("Normal Map", "A texture that dictates the bumpiness of the material.");
|
||||
public static readonly GUIContent MaskMapText = new("Mask Map", "A texture that dictates the physical properties of the material. R channel for metallic, G channel for ambient occlusion, A channel for smoothness");
|
||||
public static readonly GUIContent MetallicText = new("Metallic", "Specifies the metallic value of the material.");
|
||||
public static readonly GUIContent MetallicRemap = new("Metallic Remap", "Remap the max and min value of metallic");
|
||||
public static readonly GUIContent AORemap = new("AO Remap", "Remap the max and min value of ambient occlusion");
|
||||
public static readonly GUIContent SmoothnessText = new("Smoothness", "Specifies the smoothness of the material.");
|
||||
public static readonly GUIContent SmoothnessRemapText = new("Smoothness Remap", "Remap the max and min value of smoothness");
|
||||
public static readonly GUIContent normalMapText = new("Normal Map", "A texture that dictates the bumpiness of the material.");
|
||||
public static readonly GUIContent maskMapText = new("Mask Map", "A texture that dictates the physical properties of the material. R channel for metallic, G channel for ambient occlusion, A channel for smoothness");
|
||||
public static readonly GUIContent metallicText = new("Metallic", "Specifies the metallic value of the material.");
|
||||
public static readonly GUIContent metallicRemap = new("Metallic Remap", "Remap the max and min value of metallic");
|
||||
public static readonly GUIContent aoRemap = new("AO Remap", "Remap the max and min value of ambient occlusion");
|
||||
public static readonly GUIContent smoothnessText = new("Smoothness", "Specifies the smoothness of the material.");
|
||||
public static readonly GUIContent smoothnessRemapText = new("Smoothness Remap", "Remap the max and min value of smoothness");
|
||||
|
||||
public static readonly GUIContent AnisotropyMapText = new("Anisotropy Map", "Specifies the anisotropy map of the material.");
|
||||
public static readonly GUIContent anisotropyMapText = new("Anisotropy Map", "Specifies the anisotropy map of the material.");
|
||||
|
||||
public static readonly GUIContent KKColorText = new("KK specular Color", "Specifies the color of KK specular.");
|
||||
public static readonly GUIContent BSDFContributionText = new("BSDF Contribution", "BSDF smoothness contribution, 1 means KK Hair smoothness will fully contribute bsdf calculation");
|
||||
public static readonly GUIContent kkColorText = new("KK specular Color", "Specifies the color of KK specular.");
|
||||
public static readonly GUIContent bsdfContributionText = new("BSDF Contribution", "BSDF smoothness contribution, 1 means KK Hair smoothness will fully contribute bsdf calculation");
|
||||
|
||||
public static readonly GUIContent SpecularColorMapText = new("Specular Color Map", "Specifies the specular color map of the material.");
|
||||
public static readonly GUIContent SpecRemap = new("Specular Remap", "Feather and step value of Toon Specular");
|
||||
public static readonly GUIContent specularColorMapText = new("Specular Color Map", "Specifies the specular color map of the material.");
|
||||
public static readonly GUIContent specRemap = new("Specular Remap", "Feather and step value of Toon Specular");
|
||||
|
||||
public static readonly GUIContent hairBlenderMapText = new("Hair Blending Map", "Specifies the hair blending map of the material.");
|
||||
|
||||
public static readonly GUIContent emissiveColorText = new("Emissive Color", "The color and color map to set for emissive effect.");
|
||||
public static readonly GUIContent albedoAffectEmissiveText = new("Albedo Affect Emissive", "Enable to affect emissive color with base color");
|
||||
@@ -73,28 +77,30 @@ namespace Misaki.HdrpToon.Editor
|
||||
|
||||
public override void LoadMaterialProperties()
|
||||
{
|
||||
Properties.NormalMap = FindProperty("_NormalMap");
|
||||
Properties.NormalMapScale = FindProperty("_NormalScale");
|
||||
Properties.normalMap = FindProperty("_NormalMap");
|
||||
Properties.normalMapScale = FindProperty("_NormalScale");
|
||||
|
||||
Properties.MaskMap = FindProperty("_MaskMap");
|
||||
Properties.Metallic = FindProperty("_Metallic");
|
||||
Properties.MetallicRemapMin = FindProperty("_MetallicRemapMin");
|
||||
Properties.MetallicRemapMax = FindProperty("_MetallicRemapMax");
|
||||
Properties.AORemapMin = FindProperty("_AORemapMin");
|
||||
Properties.AORemapMax = FindProperty("_AORemapMax");
|
||||
Properties.SmoothnessRemapMin = FindProperty("_SmoothnessRemapMin");
|
||||
Properties.SmoothnessRemapMax = FindProperty("_SmoothnessRemapMax");
|
||||
Properties.Smoothness = FindProperty("_Smoothness");
|
||||
Properties.maskMap = FindProperty("_MaskMap");
|
||||
Properties.metallic = FindProperty("_Metallic");
|
||||
Properties.metallicRemapMin = FindProperty("_MetallicRemapMin");
|
||||
Properties.metallicRemapMax = FindProperty("_MetallicRemapMax");
|
||||
Properties.aoRemapMin = FindProperty("_AORemapMin");
|
||||
Properties.aoRemapMax = FindProperty("_AORemapMax");
|
||||
Properties.smoothnessRemapMin = FindProperty("_SmoothnessRemapMin");
|
||||
Properties.smoothnessRemapMax = FindProperty("_SmoothnessRemapMax");
|
||||
Properties.smoothness = FindProperty("_Smoothness");
|
||||
|
||||
Properties.AnisotropyMap = FindProperty("_AnisotropyMap");
|
||||
Properties.Anisotropy = FindProperty("_Anisotropy");
|
||||
Properties.KKColor = FindProperty("_KKColor");
|
||||
Properties.BSDFContribution = FindProperty("_BSDFContribution");
|
||||
Properties.anisotropyMap = FindProperty("_AnisotropyMap");
|
||||
Properties.anisotropy = FindProperty("_Anisotropy");
|
||||
Properties.kkColor = FindProperty("_KKColor");
|
||||
Properties.bsdfContribution = FindProperty("_BSDFContribution");
|
||||
|
||||
Properties.SpecularColorMap = FindProperty("_SpecularColorMap");
|
||||
Properties.SpecularColor = FindProperty("_SpecularColor");
|
||||
Properties.SpecularFeather = FindProperty("_ToonSpecularFeather");
|
||||
Properties.SpecularStep = FindProperty("_ToonSpecularStep");
|
||||
Properties.specularColorMap = FindProperty("_SpecularColorMap");
|
||||
Properties.specularColor = FindProperty("_SpecularColor");
|
||||
Properties.specularFeather = FindProperty("_ToonSpecularFeather");
|
||||
Properties.specularStep = FindProperty("_ToonSpecularStep");
|
||||
|
||||
Properties.hairBlendingMap = FindProperty("_HairBlendingMap");
|
||||
|
||||
Properties.emissiveColorLDR = FindProperty(EMISSIVE_COLOR_LDR);
|
||||
Properties.emissiveColorMap = FindProperty(EMISSIVE_COLOR_MAP);
|
||||
@@ -106,44 +112,55 @@ namespace Misaki.HdrpToon.Editor
|
||||
|
||||
protected override void DrawContent()
|
||||
{
|
||||
editor.KeywordTexturePropertySingleLine(Styles.NormalMapText, Properties.NormalMap, Properties.NormalMapScale);
|
||||
editor.KeywordTexturePropertySingleLine(Styles.normalMapText, Properties.normalMap, Properties.normalMapScale);
|
||||
|
||||
if (materials.All(mat => mat.GetPBRMode() != PBRMode.Off))
|
||||
{
|
||||
if (editor.KeywordTexturePropertySingleLine(Styles.MaskMapText, Properties.MaskMap))
|
||||
if (editor.KeywordTexturePropertySingleLine(Styles.maskMapText, Properties.maskMap))
|
||||
{
|
||||
editor.MinMaxShaderProperty(Properties.MetallicRemapMin, Properties.MetallicRemapMax, 0, 1, Styles.MetallicRemap);
|
||||
editor.MinMaxShaderProperty(Properties.AORemapMin, Properties.AORemapMax, 0, 1, Styles.AORemap);
|
||||
editor.MinMaxShaderProperty(Properties.SmoothnessRemapMin, Properties.SmoothnessRemapMax, 0, 1, Styles.SmoothnessRemapText);
|
||||
editor.MinMaxShaderProperty(Properties.metallicRemapMin, Properties.metallicRemapMax, 0, 1, Styles.metallicRemap);
|
||||
editor.MinMaxShaderProperty(Properties.aoRemapMin, Properties.aoRemapMax, 0, 1, Styles.aoRemap);
|
||||
editor.MinMaxShaderProperty(Properties.smoothnessRemapMin, Properties.smoothnessRemapMax, 0, 1, Styles.smoothnessRemapText);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (materials.All(mat => mat.GetPBRMode() != PBRMode.KKHair))
|
||||
if (materials.All(mat =>
|
||||
{
|
||||
editor.ShaderProperty(Properties.Metallic, Styles.MetallicText);
|
||||
var pbrMode = mat.GetPBRMode();
|
||||
return pbrMode != PBRMode.Hair && pbrMode != PBRMode.Toon;
|
||||
}))
|
||||
{
|
||||
editor.ShaderProperty(Properties.metallic, Styles.metallicText);
|
||||
}
|
||||
|
||||
editor.ShaderProperty(Properties.Smoothness, Styles.SmoothnessText);
|
||||
editor.ShaderProperty(Properties.smoothness, Styles.smoothnessText);
|
||||
}
|
||||
}
|
||||
|
||||
if (materials.All(mat => mat.GetPBRMode() == PBRMode.Anisotropy || mat.GetPBRMode() == PBRMode.KKHair))
|
||||
if (materials.All(mat => mat.GetPBRMode() == PBRMode.Anisotropy || mat.GetPBRMode() == PBRMode.Hair))
|
||||
{
|
||||
editor.KeywordTexturePropertySingleLine(Styles.AnisotropyMapText, Properties.AnisotropyMap, Properties.Anisotropy);
|
||||
if (materials.All(mat => mat.GetPBRMode() == PBRMode.KKHair))
|
||||
EditorGUILayout.Space();
|
||||
editor.KeywordTexturePropertySingleLine(Styles.anisotropyMapText, Properties.anisotropyMap, Properties.anisotropy);
|
||||
if (materials.All(mat => mat.GetPBRMode() == PBRMode.Hair))
|
||||
{
|
||||
editor.ShaderProperty(Properties.KKColor, Styles.KKColorText);
|
||||
editor.ShaderProperty(Properties.BSDFContribution, Styles.BSDFContributionText);
|
||||
editor.ShaderProperty(Properties.kkColor, Styles.kkColorText);
|
||||
editor.ShaderProperty(Properties.bsdfContribution, Styles.bsdfContributionText);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Anisotropy Map only ST");
|
||||
editor.TextureScaleOffsetProperty(Properties.AnisotropyMap);
|
||||
editor.TextureScaleOffsetProperty(Properties.anisotropyMap);
|
||||
}
|
||||
else if (materials.All(mat => mat.GetPBRMode() == PBRMode.Toon))
|
||||
{
|
||||
editor.KeywordTexturePropertySingleLine(Styles.SpecularColorMapText, Properties.SpecularColorMap, Properties.SpecularColor);
|
||||
editor.MinMaxShaderProperty(Properties.SpecularFeather, Properties.SpecularStep, 0, 1, Styles.SpecRemap);
|
||||
EditorGUILayout.Space();
|
||||
editor.KeywordTexturePropertySingleLine(Styles.specularColorMapText, Properties.specularColorMap, Properties.specularColor);
|
||||
editor.MinMaxShaderProperty(Properties.specularFeather, Properties.specularStep, 0, 1, Styles.specRemap);
|
||||
}
|
||||
|
||||
if (materials.All(mat => mat.IsHairBlendingTarget()))
|
||||
{
|
||||
editor.TexturePropertySingleLine(Styles.hairBlenderMapText, Properties.hairBlendingMap);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
editor.ShaderProperty(Properties.transparentMode, Styles.transparentModeText);
|
||||
|
||||
editor.ShaderProperty(Properties.alphaClipEnable, Styles.alphaClipEnableText);
|
||||
if (Properties.alphaClipEnable.floatValue == 1.0f)
|
||||
if (Properties.alphaClipEnable.GetBooleanValue())
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
editor.ShaderProperty(Properties.alphaClip, Styles.alphaClipText);
|
||||
@@ -90,7 +90,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
{
|
||||
foreach (var material in materials)
|
||||
{
|
||||
material.SetShaderPassEnabled(UtsShaderPassName.HAIR_BLENDING_TARGET_PASS_NAME, Properties.hairBlendingTarget.floatValue == 1.0f);
|
||||
material.SetShaderPassEnabled(UtsShaderPassName.HAIR_BLENDING_TARGET_PASS_NAME, Properties.hairBlendingTarget.GetBooleanValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Misaki.ShaderGUI;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Misaki.HdrpToon.Editor
|
||||
{
|
||||
@@ -8,6 +9,28 @@ namespace Misaki.HdrpToon.Editor
|
||||
{
|
||||
private GUIStyle _headerStyle;
|
||||
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
material.SetShaderPassEnabled(UtsShaderPassName.HAIR_SHADOW_CASTER_PASS_NAME, (MaterialType)material.GetInteger("_Material_Type") == MaterialType.FrontHair);
|
||||
material.SetShaderPassEnabled(UtsShaderPassName.HAIR_BLENDING_TARGET_PASS_NAME, material.GetInteger("_HairBlendingTarget") == 1);
|
||||
|
||||
if (material.GetInteger("_AlphaCutoffEnable") > 0.0f)
|
||||
{
|
||||
material.SetInt("_ZTestGBuffer", (int)CompareFunction.Equal);
|
||||
}
|
||||
else
|
||||
{
|
||||
material.SetInt("_ZTestGBuffer", (int)CompareFunction.LessEqual);
|
||||
}
|
||||
|
||||
//if (surfaceType == SurfaceType.Opaque)
|
||||
//{
|
||||
material.SetInt("_ZTestDepthEqualForOpaque", (int)CompareFunction.Equal);
|
||||
//}
|
||||
//else
|
||||
// material.SetInt(kZTestDepthEqualForOpaque, (int)material.GetTransparentZTest());
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
if (!initialized)
|
||||
@@ -32,6 +55,7 @@ namespace Misaki.HdrpToon.Editor
|
||||
AddUIScope(new RimLightScope());
|
||||
AddUIScope(new AngelRingScope());
|
||||
AddUIScope(new OutlineScope());
|
||||
AddUIScope(new AdvanceScope());
|
||||
|
||||
Initialize(materialEditor, properties);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ The HDRP Toon Shader is designed to provide a high-quality toon shading effect f
|
||||
## Example
|
||||
Here are some examples of the HDRP Toon Shader in action:
|
||||
|
||||

|
||||

|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Misaki.HdrpToon
|
||||
public const string SHADING_MODE = "_Shading_Mode";
|
||||
public const string PBR_MODE = "_PBR_Mode";
|
||||
public const string SURFACE_FEATURE = "_SurfaceFeatures";
|
||||
public const string MATERIAL_TYPE = "_Material_Type";
|
||||
}
|
||||
|
||||
public static class SurfaceInputs
|
||||
@@ -25,8 +26,9 @@ namespace Misaki.HdrpToon
|
||||
{
|
||||
public const string RIM_LIGHT_COLOR = "_RimLightColor";
|
||||
public const string RIM_LIGHT_INTENSITY = "_RimLightIntensity";
|
||||
public const string RIM_LIGHT_LEVEL = "_RimLightLevel";
|
||||
public const string ALBEDO_AFFECT_RIM_LIGHT = "_AlbedoAffectRimLight";
|
||||
public const string SCREEN_SPACE_RIM_LIGHT = "_Screen_Space_Rim_Light";
|
||||
public const string RIM_LIGHT_LEVEL = "_RimLightLevel";
|
||||
|
||||
public const string LIGHT_BASE_RIM_LIGHT = "_Light_Base_Rim_Light";
|
||||
public const string LIGHT_DIRECTION_RIM_LIGHT_LEVEL = "_LightDirectionRimLightLevel";
|
||||
@@ -69,5 +71,15 @@ namespace Misaki.HdrpToon
|
||||
public const string OUTLINE_FADE_OUT = "_OutlineFadeOut";
|
||||
public const string USE_SMOOTHED_NORMAL = "_UseSmoothedNormal";
|
||||
}
|
||||
|
||||
public static class Advance
|
||||
{
|
||||
public const string MINIMAL_DIFFUSE_CONTRIBUTION = "_Minimal_Diffuse_Contribution";
|
||||
|
||||
public const string LIGHT_INTENSITY_MULTIPLIER = "_LightIntensityMultiplier";
|
||||
public const string CLAMP_LIGHT_COLOR = "_ClampLightColor";
|
||||
|
||||
public const string LIGHT_LOOP_MODE = "_Light_Loop_Mode";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace Misaki.HdrpToon
|
||||
Off,
|
||||
Standard,
|
||||
Anisotropy,
|
||||
KKHair,
|
||||
Hair,
|
||||
Fabric,
|
||||
Toon
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace Misaki.HdrpToon
|
||||
public enum SurfaceFeature
|
||||
{
|
||||
None = 0,
|
||||
RimLight = 1 << 0,
|
||||
Stocking = 1 << 1,
|
||||
Stocking = 1 << 0,
|
||||
RimLight = 1 << 1,
|
||||
AngelRing = 1 << 2
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
// Misaki.HdrpToon.SurfaceFeature: static fields
|
||||
//
|
||||
#define SURFACEFEATURE_NONE (0)
|
||||
#define SURFACEFEATURE_RIM_LIGHT (1)
|
||||
#define SURFACEFEATURE_STOCKING (2)
|
||||
#define SURFACEFEATURE_STOCKING (1)
|
||||
#define SURFACEFEATURE_RIM_LIGHT (2)
|
||||
#define SURFACEFEATURE_ANGEL_RING (4)
|
||||
|
||||
|
||||
|
||||
@@ -2,86 +2,8 @@ Shader "HDRP/Toon"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_HeightMap("HeightMap", 2D) = "black" {}
|
||||
// Caution: Default value of _HeightAmplitude must be (_HeightMax - _HeightMin) * 0.01
|
||||
// Those two properties are computed from the ones exposed in the UI and depends on the displaement mode so they are separate because we don't want to lose information upon displacement mode change.
|
||||
[HideInInspector] _HeightAmplitude("Height Amplitude", Float) = 0.02 // In world units. This will be computed in the UI.
|
||||
[HideInInspector] _HeightCenter("Height Center", Range(0.0, 1.0)) = 0.5 // In texture space
|
||||
|
||||
[Enum(MinMax, 0, Amplitude, 1)] _HeightMapParametrization("Heightmap Parametrization", Int) = 0
|
||||
// These parameters are for vertex displacement/Tessellation
|
||||
_HeightOffset("Height Offset", Float) = 0
|
||||
// MinMax mode
|
||||
_HeightMin("Heightmap Min", Float) = -1
|
||||
_HeightMax("Heightmap Max", Float) = 1
|
||||
// Amplitude mode
|
||||
_HeightTessAmplitude("Amplitude", Float) = 2.0 // in Centimeters
|
||||
_HeightTessCenter("Height Center", Range(0.0, 1.0)) = 0.5 // In texture space
|
||||
|
||||
// These parameters are for pixel displacement
|
||||
_HeightPoMAmplitude("Height Amplitude", Float) = 2.0 // In centimeters
|
||||
|
||||
_DetailMap("DetailMap", 2D) = "linearGrey" {}
|
||||
_DetailAlbedoScale("_DetailAlbedoScale", Range(0.0, 2.0)) = 1
|
||||
_DetailNormalScale("_DetailNormalScale", Range(0.0, 2.0)) = 1
|
||||
_DetailSmoothnessScale("_DetailSmoothnessScale", Range(0.0, 2.0)) = 1
|
||||
|
||||
_TangentMap("TangentMap", 2D) = "bump" {}
|
||||
_TangentMapOS("TangentMapOS", 2D) = "white" {}
|
||||
_Anisotropy("Anisotropy", Range(-1.0, 1.0)) = 0
|
||||
_AnisotropyMap("AnisotropyMap", 2D) = "white" {}
|
||||
[ToggleUI] _Use_Anisotropy("Use Anisotropy", int) = 0
|
||||
_KKColor("BaseColor", Color) = (1,1,1,1)
|
||||
_BSDFContribution("_BSDFContribution", Range(0.0,1.0)) = 0
|
||||
|
||||
[HideInInspector] _DiffusionProfile("Obsolete, kept for migration purpose", Int) = 0
|
||||
[HideInInspector] _DiffusionProfileAsset("Diffusion Profile Asset", Vector) = (0, 0, 0, 0)
|
||||
[HideInInspector] _DiffusionProfileHash("Diffusion Profile Hash", Float) = 0
|
||||
_SubsurfaceMask("Subsurface Radius", Range(0.0, 1.0)) = 1.0
|
||||
_SubsurfaceMaskMap("Subsurface Radius Map", 2D) = "white" {}
|
||||
_TransmissionMask("Transmission Mask", Range(0.0, 1.0)) = 1.0
|
||||
_Thickness("Thickness", Range(0.0, 1.0)) = 1.0
|
||||
_ThicknessMap("Thickness Map", 2D) = "white" {}
|
||||
_ThicknessRemap("Thickness Remap", Vector) = (0, 1, 0, 0)
|
||||
|
||||
_IridescenceThickness("Iridescence Thickness", Range(0.0, 1.0)) = 1.0
|
||||
_IridescenceThicknessMap("Iridescence Thickness Map", 2D) = "white" {}
|
||||
_IridescenceThicknessRemap("Iridescence Thickness Remap", Vector) = (0, 1, 0, 0)
|
||||
_IridescenceMask("Iridescence Mask", Range(0.0, 1.0)) = 1.0
|
||||
_IridescenceMaskMap("Iridescence Mask Map", 2D) = "white" {}
|
||||
|
||||
_CoatMask("Coat Mask", Range(0.0, 1.0)) = 0.0
|
||||
_CoatMaskMap("CoatMaskMap", 2D) = "white" {}
|
||||
|
||||
[ToggleUI] _EnergyConservingSpecularColor("_EnergyConservingSpecularColor", Float) = 1.0
|
||||
_SpecularColor("SpecularColor", Color) = (1, 1, 1, 1)
|
||||
_SpecularColorMap("SpecularColorMap", 2D) = "white" {}
|
||||
_ToonSpecularStep("Toon Specular Step", Range(0.0, 1.0)) = 0.5
|
||||
_ToonSpecularFeather("Toon Specular Feather", Range(0.0, 1.0)) = 0.0
|
||||
|
||||
// Following options are for the GUI inspector and different from the input parameters above
|
||||
// These option below will cause different compilation flag.
|
||||
[Enum(Off, 0, From Ambient Occlusion, 1, From Bent Normals, 2)] _SpecularOcclusionMode("Specular Occlusion Mode", Int) = 1
|
||||
|
||||
_DistortionVectorMap("DistortionVectorMap", 2D) = "black" {}
|
||||
[ToggleUI] _DistortionEnable("Enable Distortion", Float) = 0.0
|
||||
[ToggleUI] _DistortionDepthTest("Distortion Depth Test Enable", Float) = 1.0
|
||||
[Enum(Add, 0, Multiply, 1, Replace, 2)] _DistortionBlendMode("Distortion Blend Mode", Int) = 0
|
||||
[HideInInspector] _DistortionSrcBlend("Distortion Blend Src", Int) = 0
|
||||
[HideInInspector] _DistortionDstBlend("Distortion Blend Dst", Int) = 0
|
||||
[HideInInspector] _DistortionBlurSrcBlend("Distortion Blur Blend Src", Int) = 0
|
||||
[HideInInspector] _DistortionBlurDstBlend("Distortion Blur Blend Dst", Int) = 0
|
||||
[HideInInspector] _DistortionBlurBlendMode("Distortion Blur Blend Mode", Int) = 0
|
||||
_DistortionScale("Distortion Scale", Float) = 1
|
||||
_DistortionVectorScale("Distortion Vector Scale", Float) = 2
|
||||
_DistortionVectorBias("Distortion Vector Bias", Float) = -1
|
||||
_DistortionBlurScale("Distortion Blur Scale", Float) = 1
|
||||
_DistortionBlurRemapMin("DistortionBlurRemapMin", Float) = 0.0
|
||||
_DistortionBlurRemapMax("DistortionBlurRemapMax", Float) = 1.0
|
||||
|
||||
//TODO: Use custom rendering data.
|
||||
[ToggleUI] _UseShadowThreshold("_UseShadowThreshold", Float) = 0.0
|
||||
[ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
|
||||
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
_AlphaCutoffShadow("_AlphaCutoffShadow", Range(0.0, 1.0)) = 0.5
|
||||
_AlphaCutoffPrepass("_AlphaCutoffPrepass", Range(0.0, 1.0)) = 0.5
|
||||
_AlphaCutoffPostpass("_AlphaCutoffPostpass", Range(0.0, 1.0)) = 0.5
|
||||
@@ -100,8 +22,6 @@ Shader "HDRP/Toon"
|
||||
_ATDistance("Transmittance Absorption Distance", Float) = 1.0
|
||||
[ToggleUI] _TransparentWritingMotionVec("_TransparentWritingMotionVec", Float) = 0.0
|
||||
|
||||
// Stencil state
|
||||
|
||||
// Forward
|
||||
[HideInInspector] _StencilRef("_StencilRef", Int) = 2 // StencilLightingUsage.RegularLighting
|
||||
[HideInInspector] _StencilWriteMask("_StencilWriteMask", Int) = 3 // StencilMask.Lighting
|
||||
@@ -127,7 +47,6 @@ Shader "HDRP/Toon"
|
||||
[HideInInspector] _AlphaDstBlend("__alphaDst", Float) = 0.0
|
||||
[HideInInspector][ToggleUI] _ZWrite("__zw", Float) = 1.0
|
||||
[HideInInspector][ToggleUI] _TransparentZWrite("_TransparentZWrite", Float) = 0.0
|
||||
//[Enum(Off, 0, Front, 1, Back, 2)] _CullMode("__cullmode", Float) = 2.0
|
||||
[HideInInspector] _CullModeForward("__cullmodeForward", Float) = 2.0 // This mode is dedicated to Forward to correctly handle backface then front face rendering thin transparent
|
||||
[HideInInspector] _TransparentCullMode("_TransparentCullMode", Int) = 2 // Back culling by default
|
||||
[HideInInspector] _ZTestDepthEqualForOpaque("_ZTestDepthEqualForOpaque", Int) = 4 // Less equal
|
||||
@@ -143,58 +62,13 @@ Shader "HDRP/Toon"
|
||||
[Enum(Flip, 0, Mirror, 1, None, 2)] _DoubleSidedNormalMode("Double sided normal mode", Float) = 1
|
||||
[HideInInspector] _DoubleSidedConstants("_DoubleSidedConstants", Vector) = (1, 1, -1, 0)
|
||||
|
||||
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5)] _UVBase("UV Set for base", Float) = 0
|
||||
[Enum(WorldSpace, 0, ObjectSpace, 1)] _ObjectSpaceUVMapping("Mapping space", Float) = 0.0
|
||||
_TexWorldScale("Scale to apply on world coordinate", Float) = 1.0
|
||||
[HideInInspector] _InvTilingScale("Inverse tiling scale = 2 / (abs(_BaseColorMap_ST.x) + abs(_BaseColorMap_ST.y))", Float) = 1
|
||||
[HideInInspector] _UVMappingMask("_UVMappingMask", Color) = (1, 0, 0, 0)
|
||||
[Enum(TangentSpace, 0, ObjectSpace, 1)] _NormalMapSpace("NormalMap space", Float) = 0
|
||||
|
||||
// Following enum should be material feature flags (i.e bitfield), however due to Gbuffer encoding constrain many combination exclude each other
|
||||
// so we use this enum as "material ID" which can be interpreted as preset of bitfield of material feature
|
||||
// The only material feature flag that can be added in all cases is clear coat
|
||||
[Enum(Subsurface Scattering, 0, Standard, 1, Anisotropy, 2, Iridescence, 3, Specular Color, 4, Translucent, 5)] _MaterialID("MaterialId", Int) = 1 // MaterialId.Standard
|
||||
[ToggleUI] _TransmissionEnable("_TransmissionEnable", Float) = 1.0
|
||||
|
||||
[Enum(None, 0, Vertex displacement, 1, Pixel displacement, 2)] _DisplacementMode("DisplacementMode", Int) = 0
|
||||
[ToggleUI] _DisplacementLockObjectScale("displacement lock object scale", Float) = 1.0
|
||||
[ToggleUI] _DisplacementLockTilingScale("displacement lock tiling scale", Float) = 1.0
|
||||
[ToggleUI] _DepthOffsetEnable("Depth Offset View space", Float) = 0.0
|
||||
|
||||
[ToggleUI] _EnableGeometricSpecularAA("EnableGeometricSpecularAA", Float) = 0.0
|
||||
_SpecularAAScreenSpaceVariance("SpecularAAScreenSpaceVariance", Range(0.0, 1.0)) = 0.1
|
||||
_SpecularAAThreshold("SpecularAAThreshold", Range(0.0, 1.0)) = 0.2
|
||||
|
||||
_PPDMinSamples("Min sample for POM", Range(1.0, 64.0)) = 5
|
||||
_PPDMaxSamples("Max sample for POM", Range(1.0, 64.0)) = 15
|
||||
_PPDLodThreshold("Start lod to fade out the POM effect", Range(0.0, 16.0)) = 5
|
||||
_PPDPrimitiveLength("Primitive length for POM", Float) = 1
|
||||
_PPDPrimitiveWidth("Primitive width for POM", Float) = 1
|
||||
[HideInInspector] _InvPrimScale("Inverse primitive scale for non-planar POM", Vector) = (1, 1, 0, 0)
|
||||
|
||||
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail("UV Set for detail", Float) = 0
|
||||
[HideInInspector] _UVDetailsMappingMask("_UVDetailsMappingMask", Color) = (1, 0, 0, 0)
|
||||
[ToggleUI] _LinkDetailsWithBase("LinkDetailsWithBase", Float) = 1.0
|
||||
|
||||
[Enum(Use Emissive Color, 0, Use Emissive Mask, 1)] _EmissiveColorMode("Emissive color mode", Float) = 1
|
||||
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5)] _UVEmissive("UV Set for emissive", Float) = 0
|
||||
_TexWorldScaleEmissive("Scale to apply on world coordinate", Float) = 1.0
|
||||
[HideInInspector] _UVMappingMaskEmissive("_UVMappingMaskEmissive", Color) = (1, 0, 0, 0)
|
||||
|
||||
// Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
|
||||
// value that exist to identify if the GI emission need to be enabled.
|
||||
// In our case we don't use such a mechanism but need to keep the code quiet. We declare the value and always enable it.
|
||||
// TODO: Fix the code in legacy unity so we can customize the beahvior for GI
|
||||
_EmissionColor("Color", Color) = (1, 1, 1)
|
||||
|
||||
// HACK: GI Baking system relies on some properties existing in the shader ("_MainTex", "_Cutoff" and "_Color") for opacity handling, so we need to store our version of those parameters in the hard-coded name the GI baking system recognizes.
|
||||
_MainTex("Base Map", 2D) = "white" {}
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
|
||||
[ToggleUI] _SupportDecals("Support Decals", Float) = 1.0
|
||||
[ToggleUI] _AddPrecomputedVelocity("AddPrecomputedVelocity", Float) = 0.0
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -203,16 +77,17 @@ Shader "HDRP/Toon"
|
||||
// -----------------------------------------------------------------------
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
//NOTE: UTS properties
|
||||
//TODO: Move more properties here for better organization
|
||||
|
||||
// Surface Options
|
||||
[Popup] _TransparentEnabled("Transparent Mode", Integer) = 0
|
||||
[ToggleUI] _AlphaCutoffEnable("Alpha Cutoff Enable", Float) = 0.0
|
||||
[Popup(_ALPHATEST_ON)] _AlphaCutoffEnable("Alpha Cutoff Enable", Integer) = 0.0
|
||||
_AlphaCutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
|
||||
[Enum(Off, 0, Front, 1, Back, 2)] _CullMode("Cull Mode", Integer) = 2
|
||||
[KeywordEnum(Standard, SDF)] _Shading_Mode("Shading mode", Integer) = 0
|
||||
[KeywordEnum(Standard, FrontHair, Face, Eye)] _Material_Type("Material Type", Integer) = 0
|
||||
[KeywordEnum(Off, Standard, Anisotropy, KKHair, Toon)] _PBR_Mode("PBR Mode", Integer) = 0
|
||||
[KeywordEnum(Off, Standard, Anisotropy, Hair, Fabric, Toon)] _PBR_Mode("PBR Mode", Integer) = 0
|
||||
[PassPopup(HairBlendingTarget)] _HairBlendingTarget("Hair Blending Target", Integer) = 0
|
||||
[EnumFlagsUI(Misaki.HdrpToon.SurfaceFeature, Misaki.HdrpToon)]_SurfaceFeatures("Surface Features", Integer) = 0
|
||||
|
||||
@@ -244,13 +119,15 @@ Shader "HDRP/Toon"
|
||||
_SDFShadowSmoothLevel("SDFShadowSmoothLevel", Range(0.0, 0.1)) = 0.02
|
||||
_SDFHighlightStrength("SDFHighlightStrength", Range(0.0, 1.0)) = 0.75
|
||||
|
||||
_HairBlendingFactor("HairBlendingFactor", Range(0.0, 1.0)) = 0.5
|
||||
|
||||
// Shadow
|
||||
[Popup] _Receive_Light_Shadow("Receive Light Shadow", Integer) = 0
|
||||
[Popup] _Receive_Screen_Space_Shadow("Receive Screen Space Shadow", Integer) = 0
|
||||
[Popup] _Receive_Hair_Shadow("Receive Hair Shadow", Integer) = 0
|
||||
|
||||
_ShadowDistanceBias("ShadowBias", Range(0.0, 5.0)) = 0.0
|
||||
_ShadowNormalBias("ShadowNormalBias", Range(0.0, 5.0)) = 0.0
|
||||
_ShadowNormalBias("ShadowNormalBias", Range(-5.0, 5.0)) = 0.0
|
||||
//_Tweak_SystemShadowsLevel("Tweak_SystemShadowsLevel", Range(-0.5, 0.5)) = 0
|
||||
|
||||
// Surface Inputs
|
||||
@@ -268,9 +145,18 @@ Shader "HDRP/Toon"
|
||||
_AlphaRemapMax("AlphaRemapMax", Float) = 1.0
|
||||
_AORemapMin("AORemapMin", Float) = 0.0
|
||||
_AORemapMax("AORemapMax", Float) = 1.0
|
||||
[ToggleUI] _Use_SSSLut("Use SSSLut", Integer) = 0
|
||||
_SSSLutMap("SSSLutMap", 2D) = "white" {}
|
||||
_SSSIntensity("SSSIntensity", Range(0.0, 3.0)) = 1.0
|
||||
|
||||
_Anisotropy("Anisotropy", Range(-1.0, 1.0)) = 0
|
||||
_AnisotropyMap("AnisotropyMap", 2D) = "white" {}
|
||||
|
||||
_KKColor("BaseColor", Color) = (1,1,1,1)
|
||||
_BSDFContribution("_BSDFContribution", Range(0.0,1.0)) = 0
|
||||
|
||||
[ToggleUI] _EnergyConservingSpecularColor("_EnergyConservingSpecularColor", Float) = 1.0
|
||||
_SpecularColor("SpecularColor", Color) = (1, 1, 1, 1)
|
||||
_SpecularColorMap("SpecularColorMap", 2D) = "white" {}
|
||||
_ToonSpecularStep("Toon Specular Step", Range(0.0, 1.0)) = 0.5
|
||||
_ToonSpecularFeather("Toon Specular Feather", Range(0.0, 1.0)) = 0.0
|
||||
|
||||
_HairBlendingMap("HairBlendingMap", 2D) = "black" {}
|
||||
|
||||
@@ -285,8 +171,6 @@ Shader "HDRP/Toon"
|
||||
[ToggleUI] _AlbedoAffectEmissive("Albedo Affect Emissive", Float) = 0.0
|
||||
_EmissiveExposureWeight("Emissive Pre Exposure", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
[Enum(WorldSpace, 0, ObjectSpace, 1)] _ObjectSpaceUVMappingEmissive("Mapping space", Float) = 0.0
|
||||
|
||||
// Ambient
|
||||
[KeywordEnum(Off, IBL, MatCap, Ramp)]_Indirect_Diffuse_Mode("_Indirect_Diffuse_Mode", Integer) = 1
|
||||
[KeywordEnum(Off, IBL, MatCap)]_Indirect_Specular_Mode("_Indirect_Specular_Mode", Integer) = 1
|
||||
@@ -301,16 +185,17 @@ Shader "HDRP/Toon"
|
||||
_IndirectSpecularMatCapMap("IndirectSpecularMatCapMap", 2D) = "black" {}
|
||||
_IndirectSpecularMatCapLod("IndirectSpecularMatCapMapLOD", Range(-5, 5)) = 0.0
|
||||
|
||||
_IndirectDiffuseRampMap("_IndirectDiffuseRampMap", 2DArray) = "black" {}
|
||||
_IndirectDiffuseRampIndex("IndirectDiffuseRampIndex", Integer) = 0
|
||||
_IndirectDiffuseRampPosition("IndirectDiffuseRampPosition", Range(0, 1)) = 0.5
|
||||
|
||||
_IndirectSpecularIntensity("Indirect Specular Intensity", Range(0, 5)) = 1.0
|
||||
_SSRWeight("SSR Weight", Range(0.0, 1.0)) = 1.0
|
||||
|
||||
// Rim Light
|
||||
//_Set_HighColorMask("Set_HighColorMask", 2D) = "white" {}
|
||||
//_Tweak_HighColorMaskLevel("Tweak_HighColorMaskLevel", Range(-1, 1)) = 0
|
||||
//[Toggle(_)] _RimLight("RimLight", Float) = 0
|
||||
|
||||
_RimLightColor("Rim Light Color", Color) = (1, 1, 1, 1)
|
||||
_RimLightIntensity("Rim Light Intensity", Range(0, 10)) = 1
|
||||
[ToggleUI] _AlbedoAffectRimLight("Albedo Affect Rim Light", Integer) = 0
|
||||
[Popup] _Screen_Space_Rim_Light ("Screen Space Rim Light", Integer) = 0
|
||||
_RimLightLevel("RimLight Level", Range(0, 1)) = 0.1
|
||||
[ToggleUI] _RimLightClipping("Rim Light Clipping", Float) = 0.25
|
||||
@@ -353,171 +238,27 @@ Shader "HDRP/Toon"
|
||||
_OutlineFadeOut("Outline Fade Out", Float) = 100
|
||||
[ToggleUI] _UseSmoothedNormal("Use Smoothed Normal", Float) = 0
|
||||
|
||||
// Advance
|
||||
_LightIntensityMultiplier("Light_Intensity_Multiplier" , Range(0, 3)) = 1
|
||||
[ToggleUI] _ClampLightColor("VRChat : SceneLights HiCut_Filter", Float) = 0
|
||||
_Minimal_Diffuse_Contribution("Minimal_Diffuse_Contribution", Range(0, 1)) = 0.05
|
||||
[KeywordEnum(Single, Full, Custom)] _Light_Loop_Mode ("Light Loop Mode", Float) = 1
|
||||
|
||||
|
||||
//TODO: Clear hdrp default properties
|
||||
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3)] _UVDetail("UV Set for detail", Float) = 0
|
||||
[HideInInspector] _UVDetailsMappingMask("_UVDetailsMappingMask", Color) = (1, 0, 0, 0)
|
||||
[ToggleUI] _LinkDetailsWithBase("LinkDetailsWithBase", Float) = 1.0
|
||||
|
||||
//TODO: End Section
|
||||
[Enum(Use Emissive Color, 0, Use Emissive Mask, 1)] _EmissiveColorMode("Emissive color mode", Float) = 1
|
||||
[Enum(UV0, 0, UV1, 1, UV2, 2, UV3, 3, Planar, 4, Triplanar, 5, Same as Base, 6)] _UVEmissive("UV Set for emissive", Float) = 0
|
||||
[Enum(WorldSpace, 0, ObjectSpace, 1)] _ObjectSpaceUVMappingEmissive("Mapping space", Float) = 0.0
|
||||
_TexWorldScaleEmissive("Scale to apply on world coordinate", Float) = 1.0
|
||||
[HideInInspector] _UVMappingMaskEmissive("_UVMappingMaskEmissive", Color) = (1, 0, 0, 0)
|
||||
|
||||
[Toggle(_)] _Cast_Hair_Shadow("CastHairShadow", Float) = 0
|
||||
|
||||
[HideInInspector] _utsTechnique("Technique", int) = 0 //DWF
|
||||
|
||||
[HideInInspector] _AutoRenderQueue("Automatic Render Queue ", int) = 1
|
||||
[Enum(Off, 0, StencilOut, 1, StencilMask, 2)] _StencilMode("StencilMode", int) = 0
|
||||
// these are set in UniversalToonGUI.cs in accordance with _StencilMode
|
||||
_StencilComp("Stencil Comparison", Float) = 8
|
||||
_StencilNo("Stencil No", Float) = 1
|
||||
_StencilOpPass("Stencil Operation", Float) = 0
|
||||
_StencilOpFail("Stencil Operation", Float) = 0
|
||||
|
||||
// DoubleShadeWithFeather
|
||||
// 0:_IS_CLIPPING_OFF 1:_IS_CLIPPING_MODE 2:_IS_CLIPPING_TRANSMODE
|
||||
// ShadingGradeMap
|
||||
// 0:_IS_TRANSCLIPPING_OFF 1:_IS_TRANSCLIPPING_ON
|
||||
[Enum(Off, 0, ON, 1, TRANSMODE, 2)] _ClippingMode("CliippingMode", int) = 0
|
||||
|
||||
[Enum(Off, 0, ONT, 1)] _ZWriteMode("ZWrite Mode", int) = 1 //OFF/ON
|
||||
[Enum(Off, 0, ONT, 1)] _ZOverDrawMode("ZOver Draw Mode", Float) = 0 //OFF/ON
|
||||
_SPRDefaultUnlitColorMask("SPRDefaultUnlit Path Color Mask", int) = 15
|
||||
[Enum(Off, 0, FRONT, 1, BACK, 2)] _SRPDefaultUnlitColMode("SPRDefaultUnlit Cull Mode", int) = 1 //OFF/FRONT/BACK
|
||||
// ClippingMask paramaters from Here.
|
||||
_ClippingMask("ClippingMask", 2D) = "white" {}
|
||||
//v.2.0.4
|
||||
[HideInInspector] _IsBaseMapAlphaAsClippingMask("IsBaseMapAlphaAsClippingMask", Float) = 0
|
||||
//
|
||||
[Toggle(_)] _Inverse_Clipping("Inverse_Clipping", Float) = 0
|
||||
_Clipping_Level("Clipping_Level", Range(0, 1)) = 0
|
||||
_Tweak_transparency("Tweak_transparency", Range(-1, 1)) = 0
|
||||
// ClippingMask paramaters to Here.
|
||||
|
||||
// _MainTex("BaseMap", 2D) = "white" {}
|
||||
[HideInInspector] _BaseMap("BaseMap", 2D) = "white" {}
|
||||
_BaseColor("BaseColor", Color) = (1, 1, 1, 1)
|
||||
//v.2.0.5 : Clipping/TransClipping for SSAO Problems in PostProcessing Stack.
|
||||
//If you want to go back the former SSAO results, comment out the below line.
|
||||
[HideInInspector] _Color("Color", Color) = (1, 1, 1, 1)
|
||||
|
||||
// _NormalMap("NormalMap", 2D) = "bump" {}
|
||||
_BumpScale("Normal Scale", Range(0, 1)) = 1
|
||||
[Toggle(_)] _Is_NormalMapToBase("Is_NormalMapToBase", Float) = 0
|
||||
|
||||
|
||||
// Eye Parallax
|
||||
[Toggle(_)] _Is_EyeParallax("_Is_EyeParallax", Float) = 0
|
||||
_EyeParallaxAmount("EyeParallaxAmount", Float) = 0.1
|
||||
|
||||
// Eyebrow Seethrough
|
||||
_HairBlendingFactor("EyeBrowBlendingFactor", Float) = 0.5
|
||||
|
||||
//v.2.0.6
|
||||
_BaseColor_Step("BaseColor_Step", Range(0, 1)) = 0.5
|
||||
_BaseShade_Feather("Base/Shade_Feather", Range(0.0001, 1)) = 0.0001
|
||||
_ShadeColor_Step("ShadeColor_Step", Range(0, 1)) = 0
|
||||
_1st2nd_Shades_Feather("1st/2nd_Shades_Feather", Range(0.0001, 1)) = 0.0001
|
||||
|
||||
//v.2.0.5
|
||||
_StepOffset("Step_Offset (ForwardAdd Only)", Range(-0.5, 0.5)) = 0
|
||||
[Toggle(_)] _Is_Filter_HiCutPointLightColor("PointLights HiCut_Filter (ForwardAdd Only)", Float) = 1
|
||||
//
|
||||
_Set_1st_ShadePosition("Set_1st_ShadePosition", 2D) = "white" {}
|
||||
_Set_2nd_ShadePosition("Set_2nd_ShadePosition", 2D) = "white" {}
|
||||
//v.2.0.6
|
||||
_Tweak_ShadingGradeMapLevel("Tweak_ShadingGradeMapLevel", Range(-0.5, 0.5)) = 0
|
||||
_BlurLevelSGM("Blur Level of ShadingGradeMap", Range(0, 10)) = 0
|
||||
|
||||
//
|
||||
_HighColor("HighColor", Color) = (0, 0, 0, 1)
|
||||
//v.2.0.4 HighColor_Tex
|
||||
_HighColor_Tex("HighColor_Tex", 2D) = "white" {}
|
||||
[Toggle(_)] _Is_LightColor_HighColor("Is_LightColor_HighColor", Float) = 1
|
||||
[Toggle(_)] _Is_NormalMapToHighColor("Is_NormalMapToHighColor", Float) = 0
|
||||
_HighColor_Power("HighColor_Power", Range(0, 1)) = 0
|
||||
[Toggle(_)] _Is_SpecularToHighColor("Is_SpecularToHighColor", Float) = 0
|
||||
[Toggle(_)] _Is_BlendAddToHiColor("Is_BlendAddToHiColor", Float) = 0
|
||||
[Enum(Multiply,0, Add,1)] _Is_BlendAddToRimColor("Is_BlendAddToRimColor", Float) = 1
|
||||
[Toggle(_)] _Is_UseTweakHighColorOnShadow("Is_UseTweakHighColorOnShadow", Float) = 0
|
||||
_TweakHighColorOnShadow("TweakHighColorOnShadow", Range(0, 1)) = 0
|
||||
|
||||
[Toggle(_)] _MatCap("MatCap", Float) = 0
|
||||
//v.2.0.6
|
||||
_BlurLevelMatcap("Blur Level of MatCap_Sampler", Range(0, 10)) = 0
|
||||
_MatCapColor("MatCapColor", Color) = (1, 1, 1, 1)
|
||||
[Toggle(_)] _Is_LightColor_MatCap("Is_LightColor_MatCap", Float) = 1
|
||||
[Toggle(_)] _Is_BlendAddToMatCap("Is_BlendAddToMatCap", Float) = 1
|
||||
_Tweak_MatCapUV("Tweak_MatCapUV", Range(-0.5, 0.5)) = 0
|
||||
_Rotate_MatCapUV("Rotate_MatCapUV", Range(-1, 1)) = 0
|
||||
//v.2.0.6
|
||||
[Toggle(_)] _CameraRolling_Stabilizer("Activate CameraRolling_Stabilizer", Float) = 0
|
||||
[Toggle(_)] _Is_NormalMapForMatCap("Is_NormalMapForMatCap", Float) = 0
|
||||
_NormalMapForMatCap("NormalMapForMatCap", 2D) = "bump" {}
|
||||
_BumpScaleMatcap("Scale for NormalMapforMatCap", Range(0, 1)) = 1
|
||||
_Rotate_NormalMapForMatCapUV("Rotate_NormalMapForMatCapUV", Range(-1, 1)) = 0
|
||||
[Toggle(_)] _Is_UseTweakMatCapOnShadow("Is_UseTweakMatCapOnShadow", Float) = 0
|
||||
_TweakMatCapOnShadow("TweakMatCapOnShadow", Range(0, 1)) = 0
|
||||
//MatcapMask
|
||||
_Set_MatcapMask("Set_MatcapMask", 2D) = "white" {}
|
||||
_Tweak_MatcapMaskLevel("Tweak_MatcapMaskLevel", Range(-1, 1)) = 0
|
||||
[Toggle(_)] _Inverse_MatcapMask("Inverse_MatcapMask", Float) = 0
|
||||
//v.2.0.5
|
||||
[Toggle(_)] _Is_Ortho("Orthographic Projection for MatCap", Float) = 0
|
||||
|
||||
//
|
||||
//v.2.0.7 Emissive
|
||||
[KeywordEnum(SIMPLE, ANIMATION)] _EMISSIVE("EMISSIVE MODE", Float) = 0
|
||||
_Base_Speed("Base_Speed", Float) = 0
|
||||
_Scroll_EmissiveU("Scroll_EmissiveU", Range(-1, 1)) = 0
|
||||
_Scroll_EmissiveV("Scroll_EmissiveV", Range(-1, 1)) = 0
|
||||
_Rotate_EmissiveUV("Rotate_EmissiveUV", Float) = 0
|
||||
[Toggle(_)] _Is_PingPong_Base("Is_PingPong_Base", Float) = 0
|
||||
[Toggle(_)] _Is_ColorShift("Activate ColorShift", Float) = 0
|
||||
[HDR]_ColorShift("ColorSift", Color) = (0, 0, 0, 1)
|
||||
_ColorShift_Speed("ColorShift_Speed", Float) = 0
|
||||
[Toggle(_)] _Is_ViewShift("Activate ViewShift", Float) = 0
|
||||
[HDR]_ViewShift("ViewSift", Color) = (0, 0, 0, 1)
|
||||
[Toggle(_)] _Is_ViewCoord_Scroll("Is_ViewCoord_Scroll", Float) = 0
|
||||
//
|
||||
//GI Intensity
|
||||
_Light_Intensity_Multiplier("Light_Intensity_Multiplier" , Range(0, 1)) = 0.25
|
||||
//For VR Chat under No effective light objects
|
||||
_Unlit_Intensity("Unlit_Intensity", Range(0, 4)) = 0
|
||||
//v.2.0.5
|
||||
[Toggle(_)] _Is_Filter_LightColor("VRChat : SceneLights HiCut_Filter", Float) = 0
|
||||
//Built-in Light Direction
|
||||
[Toggle(_)] _Is_BLD("Advanced : Activate Built-in Light Direction", Float) = 0
|
||||
_Offset_X_Axis_BLD(" Offset X-Axis (Built-in Light Direction)", Range(-1, 1)) = -0.05
|
||||
_Offset_Y_Axis_BLD(" Offset Y-Axis (Built-in Light Direction)", Range(-1, 1)) = 0.09
|
||||
[Toggle(_)] _Inverse_Z_Axis_BLD(" Inverse Z-Axis (Built-in Light Direction)", Float) = 1
|
||||
|
||||
[Toggle(_)] _BaseColorVisible("Channel mask", Float) = 1
|
||||
[Toggle(_)] _BaseColorOverridden("Channel mask", Float) = 0
|
||||
_BaseColorMaskColor("chennel mask color", Color) = (1, 1, 1, 1)
|
||||
|
||||
[Toggle(_)] _FirstShadeVisible("Channel mask", Float) = 1
|
||||
[Toggle(_)] _FirstShadeOverridden("Channel mask", Float) = 0
|
||||
_FirstShadeMaskColor("chennel mask color", Color) = (0, 1, 1, 1)
|
||||
|
||||
[Toggle(_)] _SecondShadeVisible("Channel mask", Float) = 1
|
||||
[Toggle(_)] _SecondShadeOverridden("Channel mask", Float) = 0
|
||||
_SecondShadeMaskColor("chennel mask color", Color) = (0, 0, 1, 1)
|
||||
|
||||
[Toggle(_)] _HighlightVisible("Channel mask", Float) = 1
|
||||
[Toggle(_)] _HighlightOverridden("Channel mask", Float) = 0
|
||||
_HighlightMaskColor("Channel mask color", Color) = (1, 1, 0, 1)
|
||||
|
||||
[Toggle(_)] _AngelRingVisible("Channel mask", Float) = 1
|
||||
[Toggle(_)] _AngelRingOverridden("Channel mask", Float) = 0
|
||||
_AngelRingMaskColor("Channel mask color", Color) = (0, 1, 0, 1)
|
||||
|
||||
[Toggle(_)] _RimLightVisible("Channel mask", Float) = 1
|
||||
[Toggle(_)] _RimLightOverridden("Channel mask", Float) = 0
|
||||
_RimLightMaskColor("Channel mask color", Color) = (1, 0, 1, 1)
|
||||
|
||||
[Toggle(_)] _ComposerMaskMode("", Float) = 0
|
||||
[Enum(None, 0, BaseColor, 1, FirstShade, 2, SecondShade,3, Highlight, 4, AngelRing, 5, RimLight, 6)] _ClippingMatteMode("Clipping Matte Mode", int) = 0
|
||||
|
||||
[KeywordEnum(NONE, SINGLE, FULL)] _Light_Loop_Mode ("Light Loop Mode", Float) = 2
|
||||
//
|
||||
// to here parameters for UTS>
|
||||
[HideInInspector] _DiffusionProfile("Obsolete, kept for migration purpose", Int) = 0
|
||||
[HideInInspector] _DiffusionProfileAsset("Diffusion Profile Asset", Vector) = (0, 0, 0, 0)
|
||||
[HideInInspector] _DiffusionProfileHash("Diffusion Profile Hash", Float) = 0
|
||||
}
|
||||
|
||||
HLSLINCLUDE
|
||||
@@ -528,15 +269,7 @@ Shader "HDRP/Toon"
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Variant
|
||||
//-------------------------------------------------------------------------------------
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
#pragma shader_feature_local _DEPTHOFFSET_ON
|
||||
#pragma shader_feature_local _DOUBLESIDED_ON
|
||||
#pragma shader_feature_local _ _VERTEX_DISPLACEMENT _PIXEL_DISPLACEMENT
|
||||
#pragma shader_feature_local _VERTEX_DISPLACEMENT_LOCK_OBJECT_SCALE
|
||||
#pragma shader_feature_local _DISPLACEMENT_LOCK_TILING_SCALE
|
||||
#pragma shader_feature_local _PIXEL_DISPLACEMENT_LOCK_OBJECT_SCALE
|
||||
#pragma shader_feature_local _TESSELLATION_PHONG
|
||||
|
||||
#pragma shader_feature_local _NORMALMAP_TANGENT_SPACE
|
||||
#pragma shader_feature_local _ _REQUIRE_UV2 _REQUIRE_UV3
|
||||
@@ -550,10 +283,6 @@ Shader "HDRP/Toon"
|
||||
//enable GPU instancing support
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options renderinglayer
|
||||
// enable debug shado
|
||||
// #pragma multi_compile _ UTS_DEBUG_SELFSHADOW
|
||||
// #pragma multi_compile _ UTS_DEBUG_SHADOWMAP
|
||||
// #pragma multi_compile _ UTS_DEBUG_SHADOWMAP_NO_OUTLINE
|
||||
|
||||
//-------------------------------------------------------------------------------------
|
||||
// Define
|
||||
@@ -610,6 +339,7 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
// Note: Require _ObjectId and _PassValue variables
|
||||
|
||||
// We reuse depth prepass for the scene selection, allow to handle alpha correctly as well as tessellation and vertex animation
|
||||
@@ -694,7 +424,7 @@ Shader "HDRP/Toon"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl"
|
||||
|
||||
#include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/ShaderPass/UtsShaderPassGBuffer.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassGBuffer.hlsl"
|
||||
#pragma vertex Vert
|
||||
#pragma fragment Frag
|
||||
|
||||
@@ -713,6 +443,7 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
// Lightmap memo
|
||||
// DYNAMICLIGHTMAP_ON is used when we have an "enlighten lightmap" ie a lightmap updated at runtime by enlighten.This lightmap contain indirect lighting from realtime lights and realtime emissive material.Offline baked lighting(from baked material / light,
|
||||
// both direct and indirect lighting) will hand up in the "regular" lightmap->LIGHTMAP_ON.
|
||||
@@ -745,6 +476,8 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#define SHADERPASS SHADERPASS_SHADOWS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
|
||||
@@ -764,7 +497,7 @@ Shader "HDRP/Toon"
|
||||
Tags{ "LightMode" = "DepthForwardOnly" }
|
||||
|
||||
Cull[_CullMode]
|
||||
|
||||
AlphaToMask [_AlphaCutoffEnable]
|
||||
// To be able to tag stencil with disableSSR information for forward
|
||||
Stencil
|
||||
{
|
||||
@@ -778,6 +511,12 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local_fragment _MASKMAP
|
||||
#pragma shader_feature_local _NORMALMAP
|
||||
#pragma shader_feature_local_fragment _NORMALMAP_TANGENT_SPACE
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
// In deferred, depth only pass don't output anything.
|
||||
// In forward it output the normal buffer
|
||||
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
||||
@@ -817,6 +556,7 @@ Shader "HDRP/Toon"
|
||||
}
|
||||
|
||||
Cull[_CullMode]
|
||||
AlphaToMask [_AlphaCutoffEnable]
|
||||
|
||||
ZWrite On
|
||||
|
||||
@@ -824,6 +564,9 @@ Shader "HDRP/Toon"
|
||||
#pragma multi_compile _ WRITE_NORMAL_BUFFER
|
||||
#pragma multi_compile _ WRITE_MSAA_DEPTH
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
|
||||
#define SHADERPASS SHADERPASS_MOTION_VECTORS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
|
||||
@@ -886,6 +629,9 @@ Shader "HDRP/Toon"
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
|
||||
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
||||
#define CUTOFF_TRANSPARENT_DEPTH_PREPASS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
@@ -913,6 +659,9 @@ Shader "HDRP/Toon"
|
||||
ZTest [_ZTestTransparent]
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#pragma multi_compile _ DEBUG_DISPLAY
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
@@ -959,28 +708,31 @@ Shader "HDRP/Toon"
|
||||
|
||||
Pass
|
||||
{
|
||||
|
||||
Name "ForwardOnly"
|
||||
Tags { "LightMode" = "ForwardOnly" }
|
||||
|
||||
ZWrite [_ZWriteMode]
|
||||
ZTest [_ZTestMode]
|
||||
ZTest [_ZTestDepthEqualForOpaque]
|
||||
Cull [_CullMode]
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
Stencil {
|
||||
|
||||
Blend [_SrcBlend] [_DstBlend], [_AlphaSrcBlend] [_AlphaDstBlend]
|
||||
// ForwardOpaque | ForwardTransparent
|
||||
Blend 1 One OneMinusSrcAlpha // VT feedback | VT feedback <- if VT is off, all targets below are shifted by 1
|
||||
Blend 2 One [_DstBlend2] // diffuse lighting | motion vector
|
||||
Blend 3 One [_DstBlend2] // SSS buffer | before refraction <- This target (or the one above if VT off) needs blending in transparent but not in opaque
|
||||
Blend 4 One OneMinusSrcAlpha // | before refraction alpha
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref[_StencilNo]
|
||||
|
||||
Comp[_StencilComp]
|
||||
Pass[_StencilOpPass]
|
||||
Fail[_StencilOpFail]
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
HLSLPROGRAM
|
||||
//#pragma multi_compile _ UTS_DEBUG_SHADOWMAP_BINALIZATION
|
||||
#pragma multi_compile _ DEBUG_DISPLAY
|
||||
#pragma multi_compile _ LIGHTMAP_ON
|
||||
#pragma multi_compile _ DIRLIGHTMAP_COMBINED
|
||||
@@ -1002,23 +754,17 @@ Shader "HDRP/Toon"
|
||||
#if !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(DEBUG_DISPLAY)
|
||||
#define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST
|
||||
#endif
|
||||
// used in ShadingGradeMap
|
||||
#pragma shader_feature _IS_TRANSCLIPPING_OFF _IS_TRANSCLIPPING_ON
|
||||
#pragma shader_feature _IS_ANGELRING_OFF _IS_ANGELRING_ON
|
||||
// used in Shadow calculation
|
||||
#pragma shader_feature _ UTS_USE_RAYTRACING_SHADOW
|
||||
// used in DoubleShadeWithFeather
|
||||
#pragma shader_feature _IS_CLIPPING_OFF _IS_CLIPPING_MODE _IS_CLIPPING_TRANSMODE
|
||||
// controlling mask rendering
|
||||
#pragma shader_feature _ _IS_CLIPPING_MATTE
|
||||
|
||||
#pragma shader_feature _EMISSIVE_SIMPLE _EMISSIVE_ANIMATION
|
||||
|
||||
#pragma shader_feature ENABLE_UTS_HAIR_SHAOW
|
||||
#pragma shader_feature ENABLE_UTS_HAIR_BLENDING
|
||||
|
||||
#pragma shader_feature_local_fragment _LIGHT_LOOP_MODE_SINGLE _LIGHT_LOOP_MODE_FULL _LIGHT_LOOP_MODE_CUSTOM
|
||||
|
||||
#pragma shader_feature_local_fragment _SHADING_MODE_STANDARD _SHADING_MODE_SDF
|
||||
#pragma shader_feature_local_fragment _MATERIAL_TYPE_STANDARD _MATERIAL_TYPE_FRONTHAIR _MATERIAL_TYPE_FACE _MATERIAL_TYPE_EYE
|
||||
#pragma shader_feature_local_fragment _PBR_MODE_OFF _PBR_MODE_STANDARD _PBR_MODE_ANISOTROPY _PBR_MODE_HAIR _PBR_MODE_TOON
|
||||
#pragma shader_feature_local_fragment _PBR_MODE_OFF _PBR_MODE_STANDARD _PBR_MODE_ANISOTROPY _PBR_MODE_HAIR _PBR_MODE_FABRIC _PBR_MODE_TOON
|
||||
|
||||
#pragma shader_feature_local_fragment _USE_SHADING_RAMP_MAP_ON
|
||||
|
||||
@@ -1043,6 +789,9 @@ Shader "HDRP/Toon"
|
||||
|
||||
#pragma shader_feature_local_fragment _OUTLINECOLORMAP
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
|
||||
#define PUNCTUAL_SHADOW_MEDIUM
|
||||
#define DIRECTIONAL_SHADOW_MEDIUM
|
||||
#define AREA_SHADOW_MEDIUM
|
||||
@@ -1052,10 +801,6 @@ Shader "HDRP/Toon"
|
||||
#define USE_FPTL_LIGHTLIST
|
||||
#endif
|
||||
|
||||
#if !defined(_SURFACE_TYPE_TRANSPARENT) && !defined(DEBUG_DISPLAY)
|
||||
#define SHADERPASS_FORWARD_BYPASS_ALPHA_TEST
|
||||
#endif
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/Lighting.hlsl"
|
||||
|
||||
@@ -1103,6 +848,9 @@ Shader "HDRP/Toon"
|
||||
ColorMask 0
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#define SHADERPASS SHADERPASS_DEPTH_ONLY
|
||||
#define CUTOFF_TRANSPARENT_DEPTH_POSTPASS
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
@@ -1150,11 +898,10 @@ Shader "HDRP/Toon"
|
||||
Tags { "LightMode" = "Outline" }
|
||||
|
||||
Cull Front
|
||||
Blend Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
HLSLPROGRAM
|
||||
|
||||
|
||||
#define AREA_SHADOW_LOW
|
||||
#define SHADERPASS SHADERPASS_FORWARD
|
||||
#define SHADOW_LOW
|
||||
@@ -1168,13 +915,6 @@ Shader "HDRP/Toon"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Debug/DebugDisplay.hlsl"
|
||||
#endif
|
||||
|
||||
// The light loop (or lighting architecture) is in charge to:
|
||||
// - Define light list
|
||||
// - Define the light loop
|
||||
// - Setup the constant/data
|
||||
// - Do the reflection hierarchy
|
||||
// - Provide sampling function for shadowmap, ies, cookie and reflection (depends on the specific use with the light loops like index array or atlas or single and texture format (cubemap/latlong))
|
||||
|
||||
#define HAS_LIGHTLOOP
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl"
|
||||
@@ -1185,8 +925,6 @@ Shader "HDRP/Toon"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/LitData.hlsl"
|
||||
|
||||
|
||||
|
||||
#include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Common/UtsHead.hlsl"
|
||||
#include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/ShaderPass/HDRPToonOutline.hlsl"
|
||||
|
||||
@@ -1212,6 +950,9 @@ Shader "HDRP/Toon"
|
||||
HLSLPROGRAM
|
||||
|
||||
#define SHADERPASS SHADERPASS_SHADOWS
|
||||
|
||||
#pragma shader_feature_local _ALPHATEST_ON
|
||||
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
|
||||
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitDepthPass.hlsl"
|
||||
|
||||
@@ -50,6 +50,57 @@ float3 UtsComputeDiffuseColor(float3 baseColor, float metallic)
|
||||
return UtsComputeDiffuseColor(baseColor, metallic, 0.0);
|
||||
}
|
||||
|
||||
float Random(float2 uv)
|
||||
{
|
||||
return frac(sin(dot(uv, float2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float unity_noise_interpolate (float a, float b, float t)
|
||||
{
|
||||
return (1.0-t)*a + (t*b);
|
||||
}
|
||||
|
||||
float ValueNoise (float2 uv)
|
||||
{
|
||||
float2 i = floor(uv);
|
||||
float2 f = frac(uv);
|
||||
f = f * f * (3.0 - 2.0 * f);
|
||||
|
||||
uv = abs(frac(uv) - 0.5);
|
||||
float2 c0 = i + float2(0.0, 0.0);
|
||||
float2 c1 = i + float2(1.0, 0.0);
|
||||
float2 c2 = i + float2(0.0, 1.0);
|
||||
float2 c3 = i + float2(1.0, 1.0);
|
||||
float r0 = Random(c0);
|
||||
float r1 = Random(c1);
|
||||
float r2 = Random(c2);
|
||||
float r3 = Random(c3);
|
||||
|
||||
float bottomOfGrid = unity_noise_interpolate(r0, r1, f.x);
|
||||
float topOfGrid = unity_noise_interpolate(r2, r3, f.x);
|
||||
float t = unity_noise_interpolate(bottomOfGrid, topOfGrid, f.y);
|
||||
return t;
|
||||
}
|
||||
|
||||
float SimpleNoise(float2 UV, float Scale)
|
||||
{
|
||||
float t = 0.0;
|
||||
|
||||
float freq = pow(2.0, float(0));
|
||||
float amp = pow(0.5, float(3-0));
|
||||
t += ValueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
|
||||
|
||||
freq = pow(2.0, float(1));
|
||||
amp = pow(0.5, float(3-1));
|
||||
t += ValueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
|
||||
|
||||
freq = pow(2.0, float(2));
|
||||
amp = pow(0.5, float(3-2));
|
||||
t += ValueNoise(float2(UV.x*Scale/freq, UV.y*Scale/freq))*amp;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
#define SampleRampSignalLine(texture, u) (SAMPLE_TEXTURE2D_LOD(texture, s_linear_clamp_sampler, float2(u, 0.5), 0))
|
||||
|
||||
// Exposure
|
||||
|
||||
@@ -124,11 +124,11 @@ UTSSurfaceData GetUTSSurfaceData(FragInputs input, float3 V)
|
||||
|
||||
float4 normalLocal = float4(0, 0, 1.0, 1.0);
|
||||
#if _NORMALMAP
|
||||
if (_Use_SSSLut)
|
||||
{
|
||||
normalLocal = SAMPLE_TEXTURE2D_LOD(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap), _SSSIntensity);
|
||||
}
|
||||
else
|
||||
// if (_Use_SSSLut)
|
||||
// {
|
||||
// normalLocal = SAMPLE_TEXTURE2D_LOD(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap), _SSSIntensity);
|
||||
// }
|
||||
// else
|
||||
{
|
||||
normalLocal = SAMPLE_TEXTURE2D(_NormalMap, sampler_NormalMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap));
|
||||
normalLocal.rgb = UnpackNormalScale(normalLocal, _NormalScale);
|
||||
@@ -173,11 +173,13 @@ UTSSurfaceData GetUTSSurfaceData(FragInputs input, float3 V)
|
||||
smoothness *=_BSDFContribution;
|
||||
#endif
|
||||
|
||||
#ifdef _PBR_Mode_TOON
|
||||
// TODO: Specular color is not handle correctly.
|
||||
#ifdef _PBR_MODE_TOON
|
||||
metallic = 0.0;
|
||||
specularColor = _SpecularColor;
|
||||
#ifdef _SPECULARCOLORMAP
|
||||
specularColor = SAMPLE_TEXTURE2D(_SpecularColorMap, sampler_SpecularColorMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)).rgb * _SpecularColor;
|
||||
specularColor *= SAMPLE_TEXTURE2D(_SpecularColorMap, sampler_SpecularColorMap, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)).rgb;
|
||||
#endif
|
||||
specularColor = GetSpecularColor(output.baseColor, metallic);
|
||||
#endif
|
||||
|
||||
output.metallic = metallic;
|
||||
@@ -190,7 +192,8 @@ UTSSurfaceData GetUTSSurfaceData(FragInputs input, float3 V)
|
||||
output.geomNormalWS = input.tangentToWorld[2];
|
||||
output.tangentWS = Orthonormalize(input.tangentToWorld[0].rgb, normalWS);
|
||||
|
||||
output.subsurfaceColor = SAMPLE_TEXTURE2D(_SSSLutMap, s_linear_clamp_sampler, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)) * _SSSIntensity;
|
||||
// output.subsurfaceColor = SAMPLE_TEXTURE2D(_SSSLutMap, s_linear_clamp_sampler, TRANSFORM_TEX(input.texCoord0, _BaseColorMap)) * _SSSIntensity;
|
||||
output.subsurfaceColor = 0.0;
|
||||
|
||||
output.anisotropy = anisotropy;
|
||||
|
||||
@@ -203,12 +206,19 @@ UtsBSDFData ConvertUTSSurfaceDataToUTSBSDFData(UTSSurfaceData surfaceData)
|
||||
|
||||
output.surfaceFeatures = surfaceData.surfaceFeatures;
|
||||
|
||||
output.diffuseColor = UtsComputeDiffuseColor(surfaceData.baseColor, surfaceData.metallic, 0.05);
|
||||
output.firstShadingDiffuseColor = UtsComputeDiffuseColor(surfaceData.firstShadingColor, surfaceData.metallic, 0.05);
|
||||
output.secondShadingDiffuseColor = UtsComputeDiffuseColor(surfaceData.secondShadingColor, surfaceData.metallic, 0.05);
|
||||
#if _PBR_MODE_TOON
|
||||
float m = Max3(surfaceData.specularColor.r, surfaceData.specularColor.g, surfaceData.specularColor.b);
|
||||
#else
|
||||
float m = surfaceData.metallic;
|
||||
#endif
|
||||
output.diffuseColor = UtsComputeDiffuseColor(surfaceData.baseColor, m, _Minimal_Diffuse_Contribution);
|
||||
output.firstShadingDiffuseColor = UtsComputeDiffuseColor(surfaceData.firstShadingColor, m, _Minimal_Diffuse_Contribution);
|
||||
output.secondShadingDiffuseColor = UtsComputeDiffuseColor(surfaceData.secondShadingColor, m, _Minimal_Diffuse_Contribution);
|
||||
|
||||
#if _PBR_MODE_OFF
|
||||
output.fresnel0 = surfaceData.baseColor;
|
||||
output.fresnel0 = 0.22;
|
||||
#elif _PBR_MODE_TOON
|
||||
output.fresnel0 = surfaceData.specularColor;
|
||||
#else
|
||||
output.fresnel0 = ComputeFresnel0(surfaceData.baseColor, surfaceData.metallic, 0.22);
|
||||
#endif
|
||||
|
||||
@@ -295,7 +295,7 @@ void UtsGetSurfaceAndBuiltinData(FragInputs input, float3 V, inout PositionInput
|
||||
#else
|
||||
float alphaCutoff = _AlphaCutoff;
|
||||
#endif
|
||||
|
||||
// clip(-0.1);
|
||||
GENERIC_ALPHA_TEST(alphaValue, alphaCutoff);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
#ifndef UTS_SURFACE_FEATURE_EVALUATION
|
||||
#define UTS_SURFACE_FEATURE_EVALUATION
|
||||
|
||||
void UtsEvaluateLighting_Stocking(FragInputs input, PositionInputs posInput, float3 normalWS, float3 V, inout AggregateLighting aggregateLighting)
|
||||
{
|
||||
float NdotV = saturate(dot(normalize(V), normalWS));
|
||||
|
||||
NdotV = pow(NdotV, 2.0);
|
||||
|
||||
// TODO: Move sparkle to bsdf evaluation?
|
||||
// float sparkle = Random(posInput.positionNDC.xy);
|
||||
// sparkle = step(0.995, sparkle);
|
||||
// float noise = SimpleNoise(posInput.positionNDC.xy, 500.0);
|
||||
// sparkle = noise < sparkle ? 1.0 : 0.0;
|
||||
|
||||
aggregateLighting.direct.diffuse *= NdotV;
|
||||
// aggregateLighting.direct.specular = saturate(aggregateLighting.direct.specular + sparkle * (1.0 - NdotV) * 0.5);
|
||||
}
|
||||
|
||||
DirectLighting UtsEvaluateLighting_RimLight(PositionInputs posInput, UtsBSDFData bsdfData, PreLightData preLightData
|
||||
#if _LIGHT_BASE_RIM_LIGHT_ON
|
||||
, float3 L, float3 lightColor
|
||||
@@ -11,6 +27,7 @@ DirectLighting UtsEvaluateLighting_RimLight(PositionInputs posInput, UtsBSDFData
|
||||
ZERO_INITIALIZE(DirectLighting, lighting);
|
||||
|
||||
float3 rimLightColor = _RimLightColor.rgb * _RimLightIntensity;
|
||||
rimLightColor = lerp(rimLightColor, rimLightColor * bsdfData.diffuseColor.rgb, _AlbedoAffectRimLight * _RimLightColor.a);
|
||||
|
||||
#if _SCREEN_SPACE_RIM_LIGHT_ON
|
||||
float3 normalVS = normalize(mul((float3x3)UNITY_MATRIX_V, bsdfData.geomNormalWS));
|
||||
|
||||
@@ -679,8 +679,8 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
lightDirection = lerp(lightDirection, customLightDirection, _Is_BLD);
|
||||
float3 originalLightColor = customMainLight.lightColor.rgb;
|
||||
|
||||
originalLightColor = lerp(originalLightColor, clamp(originalLightColor, ConvertFromEV100(_ToonEvAdjustmentValueMin ), ConvertFromEV100(_ToonEvAdjustmentValueMax)), _ToonEvAdjustmentCurve) * _Light_Intensity_Multiplier;
|
||||
float3 lightColor = lerp(max(defaultLightColor, originalLightColor), max(defaultLightColor, saturate(originalLightColor)), max(_Is_Filter_LightColor, _ToonLightHiCutFilter));
|
||||
originalLightColor = lerp(originalLightColor, clamp(originalLightColor, ConvertFromEV100(_ToonEvAdjustmentValueMin ), ConvertFromEV100(_ToonEvAdjustmentValueMax)), _ToonEvAdjustmentCurve) * _LightIntensityMultiplier;
|
||||
float3 lightColor = lerp(max(defaultLightColor, originalLightColor), max(defaultLightColor, saturate(originalLightColor)), max(_ClampLightColor, _ToonLightHiCutFilter));
|
||||
|
||||
float4 _1st_ShadeMap_var = lerp(SAMPLE_TEXTURE2D(_1st_ShadeMap, sampler_BaseColorMap,TRANSFORM_TEX(Set_UV0, _1st_ShadeMap)), _MainTex_var, _Use_BaseAs1st);
|
||||
float3 _1st_Shade_var = lerp((_1st_ShadeMap_var.rgb * _1st_ShadeColor.rgb), ((_1st_ShadeMap_var.rgb * _1st_ShadeColor.rgb) * lightColor), _Is_LightColor_1st_Shade);
|
||||
|
||||
@@ -75,7 +75,7 @@ void UTS_MainLight(LightLoopContext lightLoopContext, FragInputs input, UTSLight
|
||||
float3 originalLightColor = mainLightColor.rgb;
|
||||
|
||||
originalLightColor = lerp(originalLightColor, clamp(originalLightColor, ConvertFromEV100(_ToonEvAdjustmentValueMin), ConvertFromEV100(_ToonEvAdjustmentValueMax)), _ToonEvAdjustmentCurve);
|
||||
float3 lightColor = lerp(max(defaultLightColor, originalLightColor), max(defaultLightColor, saturate(originalLightColor)), max(_Is_Filter_LightColor, _ToonLightHiCutFilter)) * _Light_Intensity_Multiplier;
|
||||
float3 lightColor = lerp(max(defaultLightColor, originalLightColor), max(defaultLightColor, saturate(originalLightColor)), max(_ClampLightColor, _ToonLightHiCutFilter)) * _LightIntensityMultiplier;
|
||||
|
||||
////// Lighting:
|
||||
float3 halfDirection = normalize(utsData.viewDirection + lightDirection);
|
||||
|
||||
@@ -11,13 +11,6 @@ void UTS_OtherLights(LightLoopContext lightLoopContext, FragInputs input, UTSLig
|
||||
|
||||
// We dont have to calculate lighting here if we are using sdf shadow
|
||||
#ifndef _SDFShadow
|
||||
#ifdef _IS_CLIPPING_MATTE
|
||||
if (_ClippingMatteMode != 0)
|
||||
{
|
||||
|
||||
return float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
#endif // _IS_CLIPPING_MATTE
|
||||
|
||||
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize();
|
||||
// input.positionSS is SV_Position
|
||||
@@ -32,7 +25,7 @@ void UTS_OtherLights(LightLoopContext lightLoopContext, FragInputs input, UTSLig
|
||||
#endif
|
||||
|
||||
float3 lightDirection = utsLightData.lightDirection;
|
||||
float3 additionalLightColor = utsLightData.lightColor * _Light_Intensity_Multiplier;
|
||||
float3 additionalLightColor = utsLightData.lightColor * _LightIntensityMultiplier;
|
||||
|
||||
PreLightData preLightData = GetPreLightData(V, posInput, bsdfData);
|
||||
|
||||
@@ -70,7 +63,7 @@ void UTS_OtherLights(LightLoopContext lightLoopContext, FragInputs input, UTSLig
|
||||
}
|
||||
|
||||
float pureIntensity = max(0.001, (0.299 * additionalLightColor.r + 0.587 * additionalLightColor.g + 0.114 * additionalLightColor.b));
|
||||
float3 lightColor = max(float3(0.0, 0.0, 0.0), lerp(addPassLightColor, lerp(float3(0.0, 0.0, 0.0), min(addPassLightColor, addPassLightColor / pureIntensity), notDirectional), _Is_Filter_LightColor));
|
||||
float3 lightColor = max(float3(0.0, 0.0, 0.0), lerp(addPassLightColor, lerp(float3(0.0, 0.0, 0.0), min(addPassLightColor, addPassLightColor / pureIntensity), notDirectional), _ClampLightColor));
|
||||
float3 halfDirection = normalize(viewDirection + lightDirection); // has to be recalced here.
|
||||
//v.2.0.5:
|
||||
_1st_ShadeColor_Step = saturate(_1st_ShadeColor_Step + _StepOffset);
|
||||
|
||||
@@ -34,8 +34,9 @@ float GetColorAttenuation(float3 lightColor)
|
||||
|
||||
float3 GetLimitedLightColor(float3 lightColor)
|
||||
{
|
||||
lightColor = ApplyCurrentExposureMultiplier(lightColor);
|
||||
float3 result = lerp(lightColor, saturate(lightColor), _Is_Filter_LightColor);
|
||||
// In a hemisphere, The engery of full radiance is L * 2pi, and the engery of lambert is L * pi. We multiply by 0.5 here to apply the energy conservation.
|
||||
lightColor = ApplyCurrentExposureMultiplier(lightColor) * 0.5;
|
||||
float3 result = lerp(lightColor, normalize(lightColor), _ClampLightColor);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -57,7 +58,7 @@ DirectLighting UtsEvaluateBSDF_Directional(LightLoopContext lightLoopContext, Po
|
||||
// TODO: Colored shadow will overwrite the first and second shading diffuse color
|
||||
//float3 shadowColor = ComputeShadowColor(shadow, lightData.shadowTint, lightData.penumbraTint);
|
||||
float4 lightColor = EvaluateLight_Directional(lightLoopContext, posInput, lightData);
|
||||
lightColor.rgb = GetLimitedLightColor(lightColor.rgb * lightColor.a * _Light_Intensity_Multiplier);
|
||||
lightColor.rgb = GetLimitedLightColor(lightColor.rgb * lightColor.a * _LightIntensityMultiplier);
|
||||
|
||||
UtsClampRoughness(preLightData, bsdfData, lightData.minRoughness);
|
||||
|
||||
@@ -86,7 +87,7 @@ DirectLighting UtsEvaluateBSDF_Punctual(LightLoopContext lightLoopContext, Posit
|
||||
// TODO: Colored shadow will overwrite the first and second shading diffuse color
|
||||
//float3 shadowColor = ComputeShadowColor(shadow, lightData.shadowTint, lightData.penumbraTint);
|
||||
float4 lightColor = EvaluateLight_Punctual(lightLoopContext, posInput, lightData, L, distances);
|
||||
lightColor.rgb = GetLimitedLightColor(lightColor.rgb * lightColor.a * _Light_Intensity_Multiplier);
|
||||
lightColor.rgb = GetLimitedLightColor(lightColor.rgb * lightColor.a * _LightIntensityMultiplier);
|
||||
|
||||
UtsClampRoughness(preLightData, bsdfData, lightData.minRoughness);
|
||||
|
||||
@@ -193,9 +194,10 @@ IndirectLighting UtsEvaluateBSDF_MatCapSpecular(float3 positionWS, UtsBSDFData b
|
||||
return lighting;
|
||||
}
|
||||
|
||||
void UtsEvaluateBSDF_Ramp(PositionInputs posInput, UtsBSDFData bsdfData, float3 L, inout BuiltinData builtinData)
|
||||
void UtsEvaluateBSDF_Ramp(PositionInputs posInput, UtsBSDFData bsdfData, inout BuiltinData builtinData)
|
||||
{
|
||||
// TODO
|
||||
float3 lighting = SAMPLE_TEXTURE2D_ARRAY(_IndirectDiffuseRampMap, s_trilinear_clamp_sampler, float2(_IndirectDiffuseRampPosition, 0.0), _IndirectDiffuseRampIndex).rgb;
|
||||
builtinData.bakeDiffuseLighting = lighting * GetInverseCurrentExposureMultiplier();
|
||||
}
|
||||
|
||||
IndirectLighting UtsEvaluateBSDF_Env(LightLoopContext lightLoopContext, PositionInputs posInput, PreLightData preLightData, EnvLightData lightData, UtsBSDFData bsdfData, int influenceShapeType, int GPUImageBasedLightingType, inout float hierarchyWeight)
|
||||
|
||||
@@ -53,6 +53,17 @@ bool UtsUseScreenSpaceShadow(DirectionalLightData light, float3 normalWS)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsNonZeroBSDF(float3 L, UtsBSDFData bsdfData)
|
||||
{
|
||||
#if _MATERIAL_TYPE_FACE
|
||||
return true;
|
||||
#else
|
||||
float NdotL = dot(bsdfData.normalWS, L);
|
||||
|
||||
return NdotL > 0.0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bsdfData, BuiltinData builtinData,
|
||||
float3 V, uint featureFlags, out LightLoopOutput lightLoopOutput)
|
||||
{
|
||||
@@ -87,8 +98,8 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
|
||||
float3 L = -light.forward;
|
||||
|
||||
// Is it worth sampling the shadow map?
|
||||
if ((light.lightDimmer > 0) && (light.shadowDimmer > 0) && // Note: Volumetric can have different dimmer, thus why we test it here
|
||||
dot(bsdfData.normalWS, L) > 0.0)
|
||||
// Should we skip it if NdotL is negative? (i.e. transmission)
|
||||
if ((light.lightDimmer > 0) && (light.shadowDimmer > 0))
|
||||
{
|
||||
context.shadowValue = GetDirectionalShadowAttenuation(context.shadowContext,
|
||||
posInput.positionSS, posInput.positionWS + L * _ShadowDistanceBias, UtsGetShadowNormal(bsdfData),
|
||||
@@ -318,7 +329,6 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
|
||||
AccumulateIndirectLighting(lighting, aggregateLighting);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#elif _INDIRECT_SPECULAR_MODE_MATCAP
|
||||
@@ -347,6 +357,11 @@ void UtsLightLoop(FragInputs fragInputs, PositionInputs posInput, UtsBSDFData bs
|
||||
#endif
|
||||
}
|
||||
|
||||
if (HasFlag(bsdfData.surfaceFeatures, SURFACEFEATURE_STOCKING))
|
||||
{
|
||||
UtsEvaluateLighting_Stocking(fragInputs, posInput, bsdfData.normalWS, V, aggregateLighting);
|
||||
}
|
||||
|
||||
#ifndef _LIGHT_BASE_RIM_LIGHT_ON
|
||||
if (HasFlag(bsdfData.surfaceFeatures, SURFACEFEATURE_RIM_LIGHT))
|
||||
{
|
||||
|
||||
@@ -54,24 +54,25 @@ float3 ComputeSpecularTerm(UtsBSDFData bsdfData, PreLightData preLightData, floa
|
||||
|
||||
#elif _PBR_MODE_HAIR
|
||||
float3 t = ShiftTangent(bsdfData.bitangentWS, N, bsdfData.anisotropy);
|
||||
float specularExponent = RoughnessToBlinnPhongSpecularExponent(PerceptualRoughnessToRoughness(bsdfData.coatRoughness));
|
||||
float specularExponent = RoughnessToBlinnPhongSpecularExponent(PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness));
|
||||
DV = D_KajiyaKay(t, H, specularExponent);
|
||||
|
||||
float normalizeSpec = DV * rcp(specularExponent + 2) * 2 * PI;
|
||||
//DV *= StepFeatherToon(normalizeSpec,specularStep,specularFeather);
|
||||
float normalizeSpec = DV * rcp(specularExponent + 2.0) * TWO_PI;
|
||||
DV = DV * normalizeSpec * _KKColor.rgb;
|
||||
#elif _PBR_MODE_FABRIC
|
||||
float D = D_Charlie(NdotH, bsdfData.roughnessT);
|
||||
// V_Charlie is expensive, use approx with V_Ashikhmin instead
|
||||
// float V = V_Charlie(NdotL, clampedNdotV, bsdfData.roughness);
|
||||
float Vis = V_Ashikhmin(NdotL, clampedNdotV);
|
||||
DV = D * Vis;
|
||||
#elif _PBR_MODE_TOON
|
||||
float specularExponent = RoughnessToBlinnPhongSpecularExponent(PerceptualRoughnessToRoughness(bsdfData.perceptualRoughness));
|
||||
DV = pow(NdotH, 5.0 * specularExponent);
|
||||
DV = StepFeatherToon(DV, _ToonSpecularStep, _ToonSpecularFeather);
|
||||
//specTerm = pow(NdotH, 5.0 * specularExponent);
|
||||
//specTerm = StepFeatherToon(specTerm, _ToonSpecularStep, _ToonSpecularFeather);
|
||||
//return specTerm * ColorSpaceDielectricSpec.rgb * clampedNdotL;
|
||||
#endif
|
||||
|
||||
specTerm = DV * preLightData.specularFGD;
|
||||
specTerm = specTerm * clampedNdotL;
|
||||
|
||||
// We use specularFGD here to approximate F.
|
||||
specTerm = DV * preLightData.specularFGD * clampedNdotL;
|
||||
return specTerm;
|
||||
#endif
|
||||
}
|
||||
@@ -123,7 +124,7 @@ DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, Pr
|
||||
|
||||
#if _SHADING_MODE_SDF
|
||||
float angle;
|
||||
float3 sdfTexture = SampleSDFTexture(L, uv, angle); // r: sdf shadow, g: sdf highlight, b: fixed shadow
|
||||
float3 sdfTexture = SampleSDFTexture(L, uv, angle); // r: sdf shadow, g: sdf highlight, b: halfshadow
|
||||
float shadowSmoothLevel = _SDFShadowSmoothLevel / 10.0;
|
||||
float sdfShadowMask = smoothstep(angle - shadowSmoothLevel, angle + shadowSmoothLevel, sdfTexture.r);
|
||||
float sdfHighlight = sdfTexture.g * _SDFHighlightStrength;
|
||||
@@ -142,14 +143,14 @@ DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, Pr
|
||||
float NdotL = dot(bsdfData.normalWS, L);
|
||||
float halfLambert = 0.5 * NdotL + 0.5;
|
||||
|
||||
float3 rampColor = SAMPLE_TEXTURE2D_ARRAY_LOD(_ShadingRampMap, s_linear_clamp_sampler, float2(halfLambert * shadow.x, rampMask), _ShadingIndex, 0.0).rgb;
|
||||
float3 rampColor = SAMPLE_TEXTURE2D_ARRAY(_ShadingRampMap, s_linear_clamp_sampler, float2(halfLambert * shadow.x, rampMask), _ShadingIndex).rgb;
|
||||
|
||||
diffuseTerm = bsdfData.diffuseColor * rampColor;
|
||||
diffuseTerm = bsdfData.diffuseColor * rampColor * INV_PI;
|
||||
specularTerm *= saturate(NdotL) * sharpShadow;
|
||||
#elif _SHADING_MODE_SDF
|
||||
float3 rampColor = SAMPLE_TEXTURE2D_ARRAY_LOD(_ShadingRampMap, s_linear_clamp_sampler, float2(sdfShadowMask * sharpShadow.x, rampMask), _ShadingIndex, 0.0).rgb;
|
||||
float3 rampColor = SAMPLE_TEXTURE2D_ARRAY(_ShadingRampMap, s_linear_clamp_sampler, float2(sdfShadowMask * sharpShadow.x, rampMask), _ShadingIndex).rgb;
|
||||
|
||||
diffuseTerm = bsdfData.diffuseColor * rampColor;
|
||||
diffuseTerm = bsdfData.diffuseColor * rampColor * INV_PI;
|
||||
specularTerm = (specularTerm + sdfHighlight) * sdfShadowMask * sharpShadow;
|
||||
#endif
|
||||
#else
|
||||
@@ -157,19 +158,19 @@ DirectLighting UtsShadeSurface(PositionInputs posInput, UtsBSDFData bsdfData, Pr
|
||||
float NdotL = dot(bsdfData.normalWS, L);
|
||||
float halfLambert = 0.5 * NdotL + 0.5;
|
||||
|
||||
float firstColorFeatherForMask = lerp(_1stShadeColorFeather, 0.0, max(_ComposerMaskMode, _FirstShadeOverridden));
|
||||
float baseShadeMask = saturate((halfLambert - (_1stShadeColorStep - firstColorFeatherForMask)) / (_1stShadeColorStep - (_1stShadeColorStep - firstColorFeatherForMask)));
|
||||
// float firstColorFeatherForMask = lerp(_1stShadeColorFeather, 0.0, max(_ComposerMaskMode, _FirstShadeOverridden));
|
||||
float baseShadeMask = saturate((halfLambert - (_1stShadeColorStep - _1stShadeColorFeather)) / (_1stShadeColorStep - (_1stShadeColorStep - _1stShadeColorFeather)));
|
||||
baseShadeMask *= sharpShadow.x;
|
||||
|
||||
float secondColorFeatherForMask = lerp(_2ndShadeColorFeather, 0.0, max(_SecondShadeOverridden, _ComposerMaskMode));
|
||||
float firstShadeMask = saturate((halfLambert - (_2ndShadeColorStep - secondColorFeatherForMask)) / (_2ndShadeColorStep - (_2ndShadeColorStep - secondColorFeatherForMask)));
|
||||
// float secondColorFeatherForMask = lerp(_2ndShadeColorFeather, 0.0, max(_SecondShadeOverridden, _ComposerMaskMode));
|
||||
float firstShadeMask = saturate((halfLambert - (_2ndShadeColorStep - _2ndShadeColorFeather)) / (_2ndShadeColorStep - (_2ndShadeColorStep - _2ndShadeColorFeather)));
|
||||
|
||||
diffuseTerm = lerp(lerp(bsdfData.secondShadingDiffuseColor, bsdfData.firstShadingDiffuseColor, firstShadeMask), bsdfData.diffuseColor, baseShadeMask);
|
||||
diffuseTerm = lerp(lerp(bsdfData.secondShadingDiffuseColor, bsdfData.firstShadingDiffuseColor, firstShadeMask), bsdfData.diffuseColor, baseShadeMask) * INV_PI;
|
||||
specularTerm *= baseShadeMask;
|
||||
#elif _SHADING_MODE_SDF
|
||||
float shadeMask = sdfShadowMask * sdfTexture.b * sharpShadow.x;
|
||||
|
||||
diffuseTerm = lerp(bsdfData.firstShadingDiffuseColor, bsdfData.diffuseColor, shadeMask);
|
||||
diffuseTerm = lerp(bsdfData.firstShadingDiffuseColor, bsdfData.diffuseColor, shadeMask) * INV_PI;
|
||||
specularTerm = (specularTerm + sdfHighlight) * shadeMask;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -41,12 +41,13 @@ float GetHairShadow(PositionInputs posInput, float3 L)
|
||||
float2 shadowLength = float2(shadowLengthY * 2.0f, shadowLengthY);
|
||||
|
||||
float3 cameraDirOS = normalize(TransformWorldToObject(GetCameraPositionWS()));
|
||||
float cameraDirFactor = 1 - smoothstep(0.1, 0.9, cameraDirOS.y);
|
||||
shadowLength.y *= cameraDirFactor;
|
||||
float cameraDirFactor = 1.0 - smoothstep(0.1, 0.9, cameraDirOS.y);
|
||||
// shadowLength.y *= cameraDirFactor;
|
||||
|
||||
float2 samplingPoint = (posInput.positionSS + shadowLength * viewLightDir.xy * (_ScreenSize.xy / float2(1920.0f, 1080.0f))) * _ScreenSize.zw; // Use 1080p as the reference resolution to achieve consistent shadow lengths across various screen resolutions.
|
||||
// TODO: sample point is still shifting when fov change.
|
||||
float2 samplingPoint = (posInput.positionSS + shadowLength * viewLightDir.xy) * _ScreenSize.zw; // Use 1080p as the reference resolution to achieve consistent shadow lengths across various screen resolutions.
|
||||
|
||||
float2 scaledUVs = samplingPoint * _HairShadowRTHandleScale.xy; // We have to including the scaling factor for our shadow map since we are not going to allocate new texture if the rendering resolution changed.
|
||||
float2 scaledUVs = samplingPoint * _RTHandleScale.xy; // We have to including the scaling factor for our shadow map since we are not going to allocate new texture if the rendering resolution changed.
|
||||
float hairShadow = SAMPLE_TEXTURE2D_SHADOW(_HairShadowTex, s_linear_clamp_compare_sampler, float3(scaledUVs, posInput.deviceDepth + _HairShadowDepthBias)).r;
|
||||
shadow = lerp(1.0 - hairShadowOpacity, 1.0, hairShadow);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
// Otherwise those parameters are not bound correctly at runtime.
|
||||
// ===========================================================================
|
||||
|
||||
#define fixed half
|
||||
|
||||
#define UNITY_TEXTURE_STREAMING_DEBUG_VARS
|
||||
float4 unity_MipmapStreaming_DebugTex_ST;
|
||||
float4 unity_MipmapStreaming_DebugTex_TexelSize;
|
||||
@@ -15,293 +13,36 @@ float4 unity_MipmapStreaming_DebugTex_StreamInfo;
|
||||
// Unity Toon Shader
|
||||
#include "UtsTextures.hlsl"
|
||||
|
||||
// Lit
|
||||
TEXTURE2D(_DistortionVectorMap);
|
||||
SAMPLER(sampler_DistortionVectorMap);
|
||||
|
||||
TEXTURE2D(_EmissiveColorMap);
|
||||
SAMPLER(sampler_EmissiveColorMap);
|
||||
|
||||
// TODO: HDRP properties, clean it in the future
|
||||
#ifndef LAYERED_LIT_SHADER
|
||||
|
||||
TEXTURE2D(_DiffuseLightingMap);
|
||||
SAMPLER(sampler_DiffuseLightingMap);
|
||||
|
||||
TEXTURE2D(_BaseColorMap);
|
||||
SAMPLER(sampler_BaseColorMap);
|
||||
|
||||
TEXTURE2D(_HairBlendingMap);
|
||||
SAMPLER(sampler_HairBlendingMap);
|
||||
|
||||
TEXTURE2D(_MaskMap);
|
||||
SAMPLER(sampler_MaskMap);
|
||||
TEXTURE2D(_BentNormalMap); // Reuse sampler from normal map
|
||||
SAMPLER(sampler_BentNormalMap);
|
||||
|
||||
TEXTURE2D(_NormalMap);
|
||||
SAMPLER(sampler_NormalMap);
|
||||
TEXTURE2D(_NormalMapOS);
|
||||
SAMPLER(sampler_NormalMapOS);
|
||||
|
||||
TEXTURE2D(_DetailMap);
|
||||
SAMPLER(sampler_DetailMap);
|
||||
|
||||
TEXTURE2D(_HeightMap);
|
||||
SAMPLER(sampler_HeightMap);
|
||||
|
||||
TEXTURE2D(_TangentMap);
|
||||
SAMPLER(sampler_TangentMap);
|
||||
TEXTURE2D(_TangentMapOS);
|
||||
SAMPLER(sampler_TangentMapOS);
|
||||
|
||||
TEXTURE2D(_AnisotropyMap);
|
||||
SAMPLER(sampler_AnisotropyMap);
|
||||
|
||||
TEXTURE2D(_SubsurfaceMaskMap);
|
||||
SAMPLER(sampler_SubsurfaceMaskMap);
|
||||
TEXTURE2D(_ThicknessMap);
|
||||
SAMPLER(sampler_ThicknessMap);
|
||||
|
||||
TEXTURE2D(_IridescenceThicknessMap);
|
||||
SAMPLER(sampler_IridescenceThicknessMap);
|
||||
|
||||
TEXTURE2D(_IridescenceMaskMap);
|
||||
SAMPLER(sampler_IridescenceMaskMap);
|
||||
|
||||
TEXTURE2D(_SpecularColorMap);
|
||||
SAMPLER(sampler_SpecularColorMap);
|
||||
|
||||
TEXTURE2D(_TransmittanceColorMap);
|
||||
SAMPLER(sampler_TransmittanceColorMap);
|
||||
|
||||
TEXTURE2D(_CoatMaskMap);
|
||||
SAMPLER(sampler_CoatMaskMap);
|
||||
|
||||
TEXTURE2D(_SSSLutMap);
|
||||
//SAMPLER(sampler_SSSLutMap); //Use s_linear_clamp_sampler instead
|
||||
|
||||
TEXTURE2D(_HairShadowTex);
|
||||
TEXTURE2D_X(_HairBlendingTex);
|
||||
|
||||
#else
|
||||
|
||||
// Set of users variables
|
||||
#define PROP_DECL(type, name) type name##0, name##1, name##2, name##3
|
||||
// sampler are share by texture type inside a layered material but we need to support that a particualr layer have no texture, so we take the first sampler of available texture as the share one
|
||||
// mean we must declare all sampler
|
||||
#define PROP_DECL_TEX2D(name)\
|
||||
TEXTURE2D(CALL_MERGE_NAME(name, 0)); \
|
||||
SAMPLER(CALL_MERGE_NAME(CALL_MERGE_NAME(sampler, name), 0)); \
|
||||
TEXTURE2D(CALL_MERGE_NAME(name, 1)); \
|
||||
SAMPLER(CALL_MERGE_NAME(CALL_MERGE_NAME(sampler, name), 1)); \
|
||||
TEXTURE2D(CALL_MERGE_NAME(name, 2)); \
|
||||
SAMPLER(CALL_MERGE_NAME(CALL_MERGE_NAME(sampler, name), 2)); \
|
||||
TEXTURE2D(CALL_MERGE_NAME(name, 3)); \
|
||||
SAMPLER(CALL_MERGE_NAME(CALL_MERGE_NAME(sampler, name), 3))
|
||||
|
||||
|
||||
PROP_DECL_TEX2D(_BaseColorMap);
|
||||
PROP_DECL_TEX2D(_MaskMap);
|
||||
PROP_DECL_TEX2D(_BentNormalMap);
|
||||
PROP_DECL_TEX2D(_NormalMap);
|
||||
PROP_DECL_TEX2D(_NormalMapOS);
|
||||
PROP_DECL_TEX2D(_DetailMap);
|
||||
PROP_DECL_TEX2D(_HeightMap);
|
||||
|
||||
PROP_DECL_TEX2D(_SubsurfaceMaskMap);
|
||||
PROP_DECL_TEX2D(_ThicknessMap);
|
||||
|
||||
TEXTURE2D(_LayerMaskMap);
|
||||
SAMPLER(sampler_LayerMaskMap);
|
||||
TEXTURE2D(_LayerInfluenceMaskMap);
|
||||
SAMPLER(sampler_LayerInfluenceMaskMap);
|
||||
|
||||
#endif
|
||||
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
|
||||
#include "UtsUnityPerMaterial.hlsl"
|
||||
|
||||
// shared constant between lit and layered lit
|
||||
float _AlphaCutoff;
|
||||
float _UseShadowThreshold;
|
||||
float _AlphaCutoffShadow;
|
||||
float _AlphaCutoffPrepass;
|
||||
float _AlphaCutoffPostpass;
|
||||
float4 _DoubleSidedConstants;
|
||||
float _DistortionScale;
|
||||
float _DistortionVectorScale;
|
||||
float _DistortionVectorBias;
|
||||
float _DistortionBlurScale;
|
||||
float _DistortionBlurRemapMin;
|
||||
float _DistortionBlurRemapMax;
|
||||
|
||||
float _PPDMaxSamples;
|
||||
float _PPDMinSamples;
|
||||
float _PPDLodThreshold;
|
||||
|
||||
int _SpecularOcclusionMode;
|
||||
|
||||
// Transparency
|
||||
float3 _TransmittanceColor;
|
||||
float _Ior;
|
||||
float _ATDistance;
|
||||
|
||||
// Caution: C# code in BaseLitUI.cs call LightmapEmissionFlagsProperty() which assume that there is an existing "_EmissionColor"
|
||||
// value that exist to identify if the GI emission need to be enabled.
|
||||
// In our case we don't use such a mechanism but need to keep the code quiet. We declare the value and always enable it.
|
||||
// TODO: Fix the code in legacy unity so we can customize the beahvior for GI
|
||||
float3 _EmissionColor;
|
||||
float4 _EmissiveColorMap_ST;
|
||||
float _TexWorldScaleEmissive;
|
||||
// TODO: This is for layered lit only, clean it in the future
|
||||
float4 _UVMappingMaskEmissive;
|
||||
|
||||
float4 _InvPrimScale; // Only XY are used
|
||||
|
||||
// Wind
|
||||
float _InitialBend;
|
||||
float _Stiffness;
|
||||
float _Drag;
|
||||
float _ShiverDrag;
|
||||
float _ShiverDirectionality;
|
||||
|
||||
// Specular AA
|
||||
float _EnableGeometricSpecularAA;
|
||||
float _SpecularAAScreenSpaceVariance;
|
||||
float _SpecularAAThreshold;
|
||||
|
||||
// TODO: HDRP properties, clean it in the future
|
||||
#ifndef LAYERED_LIT_SHADER
|
||||
|
||||
// Set of users variables
|
||||
|
||||
float _Metallic;
|
||||
float _MetallicRemapMin;
|
||||
float _MetallicRemapMax;
|
||||
float _Smoothness;
|
||||
float _SmoothnessRemapMin;
|
||||
float _SmoothnessRemapMax;
|
||||
float _Roughness;
|
||||
float _RoughnessRemapMin;
|
||||
float _RoughnessRemapMax;
|
||||
float _AlphaRemapMin;
|
||||
float _AlphaRemapMax;
|
||||
float _AORemapMin;
|
||||
float _AORemapMax;
|
||||
float _SSSIntensity;
|
||||
int _Use_SSSLut;
|
||||
|
||||
float4 _SpecularColor;
|
||||
float _ToonSpecularStep;
|
||||
float _ToonSpecularFeather;
|
||||
|
||||
float _NormalScale;
|
||||
|
||||
float4 _DetailMap_ST;
|
||||
float _DetailAlbedoScale;
|
||||
float _DetailNormalScale;
|
||||
float _DetailSmoothnessScale;
|
||||
|
||||
float4 _HeightMap_TexelSize; // Unity facility. This will provide the size of the heightmap to the shader
|
||||
|
||||
float _HeightAmplitude;
|
||||
float _HeightCenter;
|
||||
|
||||
float _Anisotropy;
|
||||
float4 _AnisotropyMap_ST;
|
||||
int _Use_Anisotropy;
|
||||
float4 _KKColor;
|
||||
float _BSDFContribution;
|
||||
|
||||
float _DiffusionProfileHash;
|
||||
float _SubsurfaceMask;
|
||||
float _TransmissionMask;
|
||||
float _Thickness;
|
||||
float4 _ThicknessRemap;
|
||||
|
||||
|
||||
float _IridescenceThickness;
|
||||
float4 _IridescenceThicknessRemap;
|
||||
float _IridescenceMask;
|
||||
|
||||
float _CoatMask;
|
||||
|
||||
//float4 _SpecularColor;
|
||||
float _EnergyConservingSpecularColor;
|
||||
|
||||
float _TexWorldScale;
|
||||
float _InvTilingScale;
|
||||
float4 _UVMappingMask;
|
||||
float4 _UVDetailsMappingMask;
|
||||
float _LinkDetailsWithBase;
|
||||
float _ObjectSpaceUVMapping;
|
||||
#else // LAYERED_LIT_SHADER
|
||||
|
||||
// Set of users variables
|
||||
PROP_DECL(float4, _BaseColor);
|
||||
float4 _BaseColorMap0_ST;
|
||||
float4 _BaseColorMap1_ST;
|
||||
float4 _BaseColorMap2_ST;
|
||||
float4 _BaseColorMap3_ST;
|
||||
|
||||
float4 _BaseColorMap0_TexelSize;
|
||||
float4 _BaseColorMap0_MipInfo;
|
||||
|
||||
PROP_DECL(float, _Metallic);
|
||||
PROP_DECL(float, _MetallicRemapMin);
|
||||
PROP_DECL(float, _MetallicRemapMax);
|
||||
PROP_DECL(float, _Smoothness);
|
||||
PROP_DECL(float, _SmoothnessRemapMin);
|
||||
PROP_DECL(float, _SmoothnessRemapMax);
|
||||
PROP_DECL(float, _AORemapMin);
|
||||
PROP_DECL(float, _AORemapMax);
|
||||
|
||||
PROP_DECL(float, _NormalScale);
|
||||
float4 _NormalMap0_TexelSize; // Unity facility. This will provide the size of the base normal to the shader
|
||||
|
||||
float4 _HeightMap0_TexelSize;
|
||||
float4 _HeightMap1_TexelSize;
|
||||
float4 _HeightMap2_TexelSize;
|
||||
float4 _HeightMap3_TexelSize;
|
||||
|
||||
float4 _DetailMap0_ST;
|
||||
float4 _DetailMap1_ST;
|
||||
float4 _DetailMap2_ST;
|
||||
float4 _DetailMap3_ST;
|
||||
PROP_DECL(float, _UVDetail);
|
||||
PROP_DECL(float, _DetailAlbedoScale);
|
||||
PROP_DECL(float, _DetailNormalScale);
|
||||
PROP_DECL(float, _DetailSmoothnessScale);
|
||||
|
||||
PROP_DECL(float, _HeightAmplitude);
|
||||
PROP_DECL(float, _HeightCenter);
|
||||
|
||||
PROP_DECL(float, _DiffusionProfileHash);
|
||||
PROP_DECL(float, _SubsurfaceMask);
|
||||
PROP_DECL(float, _Thickness);
|
||||
PROP_DECL(float4, _ThicknessRemap);
|
||||
|
||||
PROP_DECL(float, _OpacityAsDensity);
|
||||
float _InheritBaseNormal1;
|
||||
float _InheritBaseNormal2;
|
||||
float _InheritBaseNormal3;
|
||||
float _InheritBaseHeight1;
|
||||
float _InheritBaseHeight2;
|
||||
float _InheritBaseHeight3;
|
||||
float _InheritBaseColor1;
|
||||
float _InheritBaseColor2;
|
||||
float _InheritBaseColor3;
|
||||
PROP_DECL(float, _HeightOffset);
|
||||
float _HeightTransition;
|
||||
|
||||
float4 _LayerMaskMap_ST;
|
||||
float _TexWorldScaleBlendMask;
|
||||
PROP_DECL(float, _TexWorldScale);
|
||||
PROP_DECL(float, _InvTilingScale);
|
||||
float4 _UVMappingMaskBlendMask;
|
||||
PROP_DECL(float4, _UVMappingMask);
|
||||
PROP_DECL(float4, _UVDetailsMappingMask);
|
||||
PROP_DECL(float, _LinkDetailsWithBase);
|
||||
|
||||
#endif // LAYERED_LIT_SHADER
|
||||
|
||||
// Following two variables are feeded by the C++ Editor for Scene selection
|
||||
@@ -310,6 +51,7 @@ int _PassValue;
|
||||
|
||||
CBUFFER_END
|
||||
|
||||
// Global
|
||||
int _ToonLightHiCutFilter;
|
||||
int _ToonEvAdjustmentCurve;
|
||||
float _ToonEvAdjustmentValueArray[128];
|
||||
@@ -320,11 +62,11 @@ float _ToonIgnoreExposureMultiplier;
|
||||
|
||||
float _Outline_MaxWidth;
|
||||
|
||||
float4 _HairShadowRTHandleScale;
|
||||
float4 _HairBlendingRTHandleScale;
|
||||
|
||||
float _HairShadowDistance;
|
||||
float _HairShadowDistanceScaleFactor;
|
||||
float _HairShadowDepthBias;
|
||||
float _HairShadowFadeInDistance;
|
||||
float _HairShadowFadeOutDistance;
|
||||
|
||||
// float2 _HairShadowRTHandleScale;
|
||||
// float2 _HairBlendingRTHandleScale;
|
||||
|
||||
@@ -1,25 +1,49 @@
|
||||
TEXTURE2D(_MainTex);
|
||||
SAMPLER(sampler_MainTex);
|
||||
|
||||
// Shading Color
|
||||
TEXTURE2D(_BaseColorMap);
|
||||
SAMPLER(sampler_BaseColorMap);
|
||||
|
||||
TEXTURE2D(_1stShadeColorMap);
|
||||
TEXTURE2D(_2ndShadeColorMap);
|
||||
|
||||
TEXTURE2D_ARRAY(_ShadingRampMap);
|
||||
TEXTURE2D(_ShadingRampMaskMap);
|
||||
|
||||
// Shadow
|
||||
TEXTURE2D(_SDFShadingMap);
|
||||
SAMPLER(sampler_SDFShadingMap);
|
||||
|
||||
TEXTURE2D_ARRAY(_ShadingRampMap);
|
||||
TEXTURE2D(_ShadingRampMaskMap);
|
||||
// Surface Inputs
|
||||
TEXTURE2D(_MaskMap);
|
||||
SAMPLER(sampler_MaskMap);
|
||||
|
||||
TEXTURE2D(_NormalMap);
|
||||
SAMPLER(sampler_NormalMap);
|
||||
|
||||
TEXTURE2D(_AnisotropyMap);
|
||||
SAMPLER(sampler_AnisotropyMap);
|
||||
|
||||
TEXTURE2D(_SpecularColorMap);
|
||||
SAMPLER(sampler_SpecularColorMap);
|
||||
|
||||
TEXTURE2D(_SSSLutMap);
|
||||
|
||||
TEXTURE2D(_HairBlendingMap);
|
||||
SAMPLER(sampler_HairBlendingMap);
|
||||
|
||||
// Global
|
||||
TEXTURE2D(_HairShadowTex);
|
||||
TEXTURE2D_X(_HairBlendingTex);
|
||||
|
||||
|
||||
|
||||
TEXTURE2D(_IndirectDiffuseMatCapMap);
|
||||
TEXTURE2D(_IndirectSpecularMatCapMap);
|
||||
|
||||
sampler _Set_1st_ShadePosition;
|
||||
sampler _Set_2nd_ShadePosition;
|
||||
sampler _HighColor_Tex;
|
||||
sampler _Set_HighColorMask;
|
||||
sampler _Set_RimLightMask;
|
||||
sampler _NormalMapForMatCap;
|
||||
sampler _Set_MatcapMask;
|
||||
TEXTURE2D_ARRAY(_IndirectDiffuseRampMap);
|
||||
|
||||
TEXTURE2D(_ClippingMask);
|
||||
|
||||
TEXTURE2D(_AngelRingColorMap);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// Light Loop
|
||||
float3 _ObjectCenterPositionWS;
|
||||
// Surface Option
|
||||
float _SurfaceFeatures;
|
||||
half _AlphaCutoffEnable;
|
||||
float _AlphaCutoff;
|
||||
|
||||
// Shading Color
|
||||
float4 _BaseColor;
|
||||
@@ -7,13 +9,13 @@ float4 _BaseColorMap_ST;
|
||||
float4 _BaseColorMap_TexelSize;
|
||||
float4 _BaseColorMap_MipInfo;
|
||||
|
||||
float _ShadingIndex;
|
||||
fixed _ShadingRampMask;
|
||||
int _ShadingIndex;
|
||||
float _ShadingRampMask;
|
||||
|
||||
float4 _1stShadeColor;
|
||||
float4 _2ndShadeColor;
|
||||
fixed _UseBaseAs1st;
|
||||
fixed _Use1stAs2nd;
|
||||
half _UseBaseAs1st;
|
||||
half _Use1stAs2nd;
|
||||
|
||||
float _1stShadeColorStep;
|
||||
float _1stShadeColorFeather;
|
||||
@@ -28,16 +30,51 @@ float _SDFHighlightStrength;
|
||||
float _ShadowDistanceBias;
|
||||
float _ShadowNormalBias;
|
||||
|
||||
// Emissive
|
||||
// Surface Inputs
|
||||
float _AlphaRemapMin;
|
||||
float _AlphaRemapMax;
|
||||
|
||||
float _NormalScale;
|
||||
|
||||
float _Metallic;
|
||||
float _MetallicRemapMin;
|
||||
float _MetallicRemapMax;
|
||||
float _Smoothness;
|
||||
float _SmoothnessRemapMin;
|
||||
float _SmoothnessRemapMax;
|
||||
float _Roughness;
|
||||
float _RoughnessRemapMin;
|
||||
float _RoughnessRemapMax;
|
||||
|
||||
float _AORemapMin;
|
||||
float _AORemapMax;
|
||||
|
||||
float _Anisotropy;
|
||||
float4 _AnisotropyMap_ST;
|
||||
|
||||
float4 _KKColor;
|
||||
|
||||
float4 _SpecularColor;
|
||||
float _ToonSpecularStep;
|
||||
float _ToonSpecularFeather;
|
||||
float _BSDFContribution;
|
||||
float _EnergyConservingSpecularColor;
|
||||
|
||||
// float _SSSIntensity;
|
||||
// int _Use_SSSLut;
|
||||
|
||||
float3 _EmissiveColor;
|
||||
fixed _AlbedoAffectEmissive;
|
||||
fixed _EmissiveExposureWeight;
|
||||
half _AlbedoAffectEmissive;
|
||||
half _EmissiveExposureWeight;
|
||||
|
||||
float _ObjectSpaceUVMappingEmissive;
|
||||
|
||||
// Ambient
|
||||
float _IndirectDiffuseMatCapLod;
|
||||
|
||||
int _IndirectDiffuseRampIndex;
|
||||
float _IndirectDiffuseRampPosition;
|
||||
|
||||
float _IndirectDiffuseIntensity;
|
||||
float _SSAOWeight;
|
||||
float _SSGIWeight;
|
||||
@@ -50,159 +87,51 @@ float _SSRWeight;
|
||||
//Rim Light
|
||||
float4 _RimLightColor;
|
||||
float _RimLightIntensity;
|
||||
half _AlbedoAffectRimLight;
|
||||
float _RimLightLevel;
|
||||
fixed _RimLightClipping;
|
||||
half _RimLightClipping;
|
||||
float _RimLightClippingLevel;
|
||||
|
||||
float _LightDirectionRimLightLevel;
|
||||
|
||||
// Angle Ring
|
||||
float4 _AngelRingColor;
|
||||
float4 _AngelRingColorMap_ST;
|
||||
float _AngelRingIntensity;
|
||||
float _AngelRingOffsetU;
|
||||
float _AngelRingOffsetV;
|
||||
|
||||
// Outline
|
||||
float _OutlineWidth;
|
||||
float4 _OutlineColor;
|
||||
fixed _AlbedoAffectOutline;
|
||||
fixed _SkyColorAffectOutline;
|
||||
half _AlbedoAffectOutline;
|
||||
half _SkyColorAffectOutline;
|
||||
float _SkyColorIntensity;
|
||||
|
||||
float _OutlineFadeIn;
|
||||
float _OutlineFadeOut;
|
||||
fixed _UseSmoothedNormal;
|
||||
|
||||
|
||||
float _utsTechnique;
|
||||
float4 _Color;
|
||||
|
||||
float _SurfaceFeatures;
|
||||
half _UseSmoothedNormal;
|
||||
|
||||
float _Tweak_SystemShadowsLevel;
|
||||
|
||||
float _EyeParallaxAmount;
|
||||
float _HairBlendingFactor;
|
||||
|
||||
float _BaseColor_Step;
|
||||
float _BaseShade_Feather;
|
||||
float4 _Set_1st_ShadePosition_ST;
|
||||
// Advance
|
||||
half _ClampLightColor;
|
||||
float _LightIntensityMultiplier;
|
||||
float _Minimal_Diffuse_Contribution;
|
||||
|
||||
float _ShadeColor_Step;
|
||||
float _1st2nd_Shades_Feather;
|
||||
float4 _Set_2nd_ShadePosition_ST;
|
||||
float4 _ShadingGradeMap_ST;
|
||||
// Light Loop
|
||||
float3 _ObjectCenterPositionWS;
|
||||
|
||||
float _Tweak_ShadingGradeMapLevel;
|
||||
fixed _BlurLevelSGM;
|
||||
//
|
||||
|
||||
float4 _HighColor;
|
||||
float4 _HighColor_Tex_ST;
|
||||
fixed _Is_LightColor_HighColor;
|
||||
|
||||
fixed _Is_NormalMapToHighColor;
|
||||
float _HighColor_Power;
|
||||
fixed _Is_SpecularToHighColor;
|
||||
fixed _Is_BlendAddToHiColor;
|
||||
fixed _Is_BlendAddToRimColor;
|
||||
fixed _Is_UseTweakHighColorOnShadow;
|
||||
float _TweakHighColorOnShadow;
|
||||
|
||||
fixed _Is_LightColor_RimLight;
|
||||
fixed _Is_NormalMapToRimLight;
|
||||
fixed _LightDirection_MaskOn;
|
||||
fixed _Add_Antipodean_RimLight;
|
||||
float4 _Ap_RimLightColor;
|
||||
fixed _Is_LightColor_Ap_RimLight;
|
||||
float _Ap_RimLight_Power;
|
||||
fixed _Ap_RimLight_FeatherOff;
|
||||
float4 _Set_RimLightMask_ST;
|
||||
float _Tweak_RimLightMaskLevel;
|
||||
fixed _MatCap;
|
||||
float4 _MatCap_Sampler_ST;
|
||||
float4 _MatCapColor;
|
||||
fixed _Is_LightColor_MatCap;
|
||||
fixed _Is_BlendAddToMatCap;
|
||||
float _Tweak_MatCapUV;
|
||||
float _Rotate_MatCapUV;
|
||||
fixed _Is_NormalMapForMatCap;
|
||||
float4 _NormalMapForMatCap_ST;
|
||||
float _Rotate_NormalMapForMatCapUV;
|
||||
fixed _Is_UseTweakMatCapOnShadow;
|
||||
float _TweakMatCapOnShadow;
|
||||
float4 _Set_MatcapMask_ST;
|
||||
float _Tweak_MatcapMaskLevel;
|
||||
fixed _Is_Ortho;
|
||||
float _CameraRolling_Stabilizer;
|
||||
fixed _BlurLevelMatcap;
|
||||
fixed _Inverse_MatcapMask;
|
||||
float _BumpScale;
|
||||
float _BumpScaleMatcap;
|
||||
float4 _Emissive_Tex_ST;
|
||||
float4 _Emissive_Color;
|
||||
|
||||
fixed _Is_ViewCoord_Scroll;
|
||||
float _Rotate_EmissiveUV;
|
||||
float _Base_Speed;
|
||||
float _Scroll_EmissiveU;
|
||||
float _Scroll_EmissiveV;
|
||||
fixed _Is_PingPong_Base;
|
||||
float4 _ColorShift;
|
||||
float4 _ViewShift;
|
||||
float _ColorShift_Speed;
|
||||
fixed _Is_ColorShift;
|
||||
fixed _Is_ViewShift;
|
||||
//
|
||||
float _Unlit_Intensity;
|
||||
|
||||
fixed _Is_Filter_HiCutPointLightColor;
|
||||
fixed _Is_Filter_LightColor;
|
||||
|
||||
float _StepOffset;
|
||||
fixed _Is_BLD;
|
||||
float _Offset_X_Axis_BLD;
|
||||
float _Offset_Y_Axis_BLD;
|
||||
fixed _Inverse_Z_Axis_BLD;
|
||||
|
||||
float4 _ClippingMask_ST;
|
||||
|
||||
fixed _IsBaseMapAlphaAsClippingMask;
|
||||
float _Clipping_Level;
|
||||
fixed _Inverse_Clipping;
|
||||
float _Tweak_transparency;
|
||||
fixed _AngelRing;
|
||||
|
||||
float _BaseColorVisible;
|
||||
float _BaseColorOverridden;
|
||||
float4 _BaseColorMaskColor;
|
||||
|
||||
float _FirstShadeVisible;
|
||||
float _FirstShadeOverridden;
|
||||
float4 _FirstShadeMaskColor;
|
||||
|
||||
float _SecondShadeVisible;
|
||||
float _SecondShadeOverridden;
|
||||
float4 _SecondShadeMaskColor;
|
||||
|
||||
float _HighlightVisible;
|
||||
float _HighlightOverridden;
|
||||
float4 _HighlightMaskColor;
|
||||
|
||||
float _AngelRingVisible;
|
||||
float _AngelRingOverridden;
|
||||
float4 _AngelRingMaskColor;
|
||||
|
||||
float _RimLightVisible;
|
||||
float _RimLightOverridden;
|
||||
float4 _RimLightMaskColor;
|
||||
// NOTE: Not sure what these are for
|
||||
// float _FirstShadeOverridden;
|
||||
// float _SecondShadeOverridden;
|
||||
|
||||
float _UseShadowThreshold;
|
||||
float _AlphaCutoffShadow;
|
||||
float _ComposerMaskMode;
|
||||
int _ClippingMatteMode;
|
||||
|
||||
float _GI_Intensity;
|
||||
float _Light_Intensity_Multiplier;
|
||||
|
||||
|
||||
float4 _AngelRingColor;
|
||||
float4 _AngelRingColorMap_ST;
|
||||
float _AngelRingIntensity;
|
||||
float _AngelRingOffsetU;
|
||||
float _AngelRingOffsetV;
|
||||
|
||||
#if defined(_UTS_TOON_EV_PER_MODEL)
|
||||
// not in materials
|
||||
@@ -212,7 +141,4 @@ float _ToonEvAdjustmentValueArray[128];
|
||||
float _ToonEvAdjustmentValueMin;
|
||||
float _ToonEvAdjustmentValueMax;
|
||||
float _ToonEvAdjustmentCompensation;
|
||||
#endif //#if !defined(_UTS_TOON_EV_PER_MODEL)
|
||||
|
||||
|
||||
float _BlendMode;
|
||||
#endif
|
||||
|
||||
@@ -63,18 +63,16 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
#ifdef _DEPTHOFFSET_ON
|
||||
, out float outputDepth : SV_Depth
|
||||
#endif
|
||||
)
|
||||
)
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(packedInput);
|
||||
FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh);
|
||||
|
||||
_Color = _BaseColor;
|
||||
float4 objPos = mul(unity_ObjectToWorld, float4(0, 0, 0, 1));
|
||||
float4 Set_UV0 = input.texCoord0;
|
||||
|
||||
// The following temporary definition of unity_AmbientEquator is for HDRP only.
|
||||
//float4 unity_AmbientEquator = float4(0.05, 0.05, 0.05, 1.0); //Todo.
|
||||
//v.2.0.9
|
||||
//float3 envLightSource_GradientEquator = unity_AmbientEquator.rgb > 0.05 ? unity_AmbientEquator.rgb : half3(0.05, 0.05, 0.05);
|
||||
float3 envLightSource_GradientEquator = ShadeSH9(float4(0, 1, 0, 0));
|
||||
float3 envLightSource_SkyboxIntensity = max(
|
||||
@@ -84,8 +82,8 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
float3 ambientSkyColor = envLightSource_SkyboxIntensity.rgb > 0.0 ? envLightSource_SkyboxIntensity : envLightSource_GradientEquator;
|
||||
ambientSkyColor *= GetCurrentExposureMultiplier();
|
||||
|
||||
float4 _BlendingTex_var = SAMPLE_TEXTURE2D(_HairBlendingMap, sampler_HairBlendingMap, TRANSFORM_TEX(Set_UV0, _BaseColorMap));
|
||||
outColor = float4(_BlendingTex_var.rgb * ambientSkyColor, _BlendingTex_var.a);
|
||||
float4 blendingTex = SAMPLE_TEXTURE2D(_HairBlendingMap, sampler_HairBlendingMap, TRANSFORM_TEX(Set_UV0, _BaseColorMap));
|
||||
outColor = float4(blendingTex.rgb + ambientSkyColor, blendingTex.a);
|
||||
|
||||
#ifdef _DEPTHOFFSET_ON
|
||||
outputDepth = posInput.deviceDepth;
|
||||
|
||||
@@ -82,12 +82,7 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
#ifdef _IS_CLIPPING_MATTE
|
||||
if (_ClippingMatteMode != 0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif // _IS_CLIPPING_MATTE
|
||||
|
||||
#if defined(UTS_DEBUG_SHADOWMAP_NO_OUTLINE)
|
||||
discard;
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
//Unity Toon Shader/HDRP
|
||||
//nobuyuki@unity3d.com
|
||||
//toshiyuki@unity3d.com (Universal RP/HDRP)
|
||||
#include "Packages/com.misaki.hdrp-toon/Runtime/Shaders/Includes/Common/UtsLitData.hlsl"
|
||||
|
||||
#define APPROXIMATE_POLY_LIGHT_AS_SPHERE_LIGHT
|
||||
|
||||
@@ -97,16 +95,15 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize();
|
||||
PositionInputs posInput = GetPositionInput(input.positionSS.xy, _ScreenSize.zw, input.positionSS.z, input.positionSS.w, input.positionRWS.xyz, tileIndex);
|
||||
|
||||
|
||||
#ifdef VARYINGS_NEED_POSITION_WS
|
||||
float3 V = GetWorldSpaceNormalizeViewDir(input.positionRWS);
|
||||
|
||||
#ifdef MATERIAL_TYPE_EYE
|
||||
// Must have view Dir to work
|
||||
float2 viewT = TransformObjectToTangent(V, input.tangentToWorld);
|
||||
float2 parallaxOffset = viewT;
|
||||
parallaxOffset.y = -parallaxOffset.y;
|
||||
input.texCoord0.xy = clamp(input.texCoord0.xy -_EyeParallaxAmount * parallaxOffset, 0, 1);
|
||||
// Must have view Dir to work
|
||||
float2 viewT = TransformObjectToTangent(V, input.tangentToWorld);
|
||||
float2 parallaxOffset = viewT;
|
||||
parallaxOffset.y = -parallaxOffset.y;
|
||||
input.texCoord0.xy = clamp(input.texCoord0.xy -_EyeParallaxAmount * parallaxOffset, 0, 1);
|
||||
#endif
|
||||
|
||||
#else
|
||||
@@ -121,7 +118,7 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
|
||||
SurfaceData tempSurfaceData;
|
||||
BuiltinData builtinData;
|
||||
GetSurfaceAndBuiltinData(input, V, posInput, tempSurfaceData, builtinData);
|
||||
UtsGetSurfaceAndBuiltinData(input, V, posInput, tempSurfaceData, builtinData);
|
||||
UTSSurfaceData surfaceData = GetUTSSurfaceData(input, V);
|
||||
UtsBSDFData bsdfData = ConvertUTSSurfaceDataToUTSBSDFData(surfaceData);
|
||||
|
||||
@@ -132,11 +129,9 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
context.shadowContext = InitShadowContext();
|
||||
context.shadowValue = 1;
|
||||
context.sampleReflection = 0.0;
|
||||
#if UNITY_VERSION >= 202120 && UNITY_VERSION < 202320
|
||||
context.splineVisibility = -1;
|
||||
#endif
|
||||
|
||||
#ifdef APPLY_FOG_ON_SKY_REFLECTIONS
|
||||
context.positionWS = posInput.positionWS;
|
||||
context.positionWS = posInput.positionWS;
|
||||
#endif
|
||||
|
||||
// With XR single-pass and camera-relative: offset position to do lighting computations from the combined center view (original camera matrix).
|
||||
@@ -146,31 +141,17 @@ void Frag(PackedVaryingsToPS packedInput,
|
||||
// Initialize the contactShadow and contactShadowFade fields
|
||||
InitContactShadow(posInput, context);
|
||||
|
||||
float channelAlpha = 0.0f;
|
||||
|
||||
LightLoopOutput lightLoopOutput;
|
||||
ZERO_INITIALIZE(LightLoopOutput, lightLoopOutput);
|
||||
|
||||
UtsLightLoop(input, posInput, bsdfData, builtinData, V, featureFlags, lightLoopOutput);
|
||||
|
||||
float3 finalColor = lightLoopOutput.diffuseLighting + lightLoopOutput.specularLighting;
|
||||
|
||||
#ifdef _IS_TRANSCLIPPING_OFF
|
||||
|
||||
outColor = float4(finalColor, 1 * ApplyChannelAlpha(channelAlpha));
|
||||
|
||||
#elif _IS_TRANSCLIPPING_ON
|
||||
|
||||
float Set_Opacity = saturate((inverseClipping + _Tweak_transparency));
|
||||
|
||||
outColor = EvaluateAtmosphericScattering(posInput, V, float4(finalColor, 1));
|
||||
outColor = float4(outColor.rgb, Set_Opacity * ApplyChannelAlpha(channelAlpha));
|
||||
#endif
|
||||
outColor = ApplyBlendMode(lightLoopOutput.diffuseLighting, lightLoopOutput.specularLighting, builtinData.opacity);
|
||||
|
||||
#if _MATERIAL_TYPE_FRONTHAIR && ENABLE_UTS_HAIR_BLENDING
|
||||
float2 screenUV = posInput.positionNDC * _HairBlendingRTHandleScale.xy;
|
||||
float4 hairBlendingMap = LOAD_TEXTURE2D_X(_HairBlendingTex, screenUV);
|
||||
outColor.rgb = lerp(outColor.rgb, hairBlendingMap.rgb, hairBlendingMap.a * _HairBlendingFactor);
|
||||
float2 screenUV = posInput.positionSS; // * _HairBlendingRTHandleScale.xy; // Why we don't need to scale? Does unity handle it internally?
|
||||
float4 hairBlendingTex = LOAD_TEXTURE2D_X(_HairBlendingTex, screenUV);
|
||||
outColor.rgb = lerp(outColor.rgb, hairBlendingTex.rgb, hairBlendingTex.a * _HairBlendingFactor);
|
||||
#endif
|
||||
|
||||
#if UTS_DEBUG_SHADOWMAP || UTS_DEBUG_SELFSHADOW
|
||||
|
||||
@@ -21,15 +21,12 @@ namespace Misaki.HdrpToon
|
||||
private const string _TOON_LIGHT_FILTER_PROP_NAME = "_ToonLightHiCutFilter";
|
||||
private const string _IGNORE_VOLUME_EXPOSURE_PROP_NAME = "_ToonIgnoreExposureMultiplier";
|
||||
|
||||
private const string _HAIR_SHADOW_RTHANDLE_SCALE_PROP_NAME = "_HairShadowRTHandleScale";
|
||||
private const string _HAIR_SHADOW_DISTANCE_PROP_NAME = "_HairShadowDistance";
|
||||
private const string _HAIR_SHADOW_DISTANCE_SCALE_PROP_NAME = "_HairShadowDistanceScaleFactor";
|
||||
private const string _HAIR_SHADOW_DEPTH_BIAS_PROP_NAME = "_HairShadowDepthBias";
|
||||
private const string _HAIR_SHADOW_FADEIN_PROP_NAME = "_HairShadowFadeInDistance";
|
||||
private const string _HAIR_SHADOW_FADE_OUT_PROP_NAME = "_HairShadowFadeOutDistance";
|
||||
|
||||
private const string _HAIR_BLENDING_RTHANDLE_SCALE_PROP_NAME = "_HairBlendingRTHandleScale";
|
||||
|
||||
private const string _HAIR_SHADOW_RT_PROP_NAME = "_HairShadowTex";
|
||||
private const string _HAIR_BLENDING_PROP_NAME = "_HairBlendingTex";
|
||||
|
||||
@@ -43,7 +40,9 @@ namespace Misaki.HdrpToon
|
||||
private RTHandle _hairShadowRTHandle;
|
||||
private bool _needReallocateHairShadow;
|
||||
|
||||
// TODO: Possible to avoid another RTHandle for depth?
|
||||
private RTHandle _hairBlendingRTHandle;
|
||||
private RTHandle _hairBlendingDepthRTHandle;
|
||||
private bool _needReallocateHairBlending;
|
||||
|
||||
private bool _enableHairShadow;
|
||||
@@ -142,15 +141,16 @@ namespace Misaki.HdrpToon
|
||||
}
|
||||
#endif
|
||||
|
||||
var scale = _hairShadowQuality switch
|
||||
// Use R8 or R16 directly?
|
||||
var format = _hairShadowQuality switch
|
||||
{
|
||||
BufferQuality.Low => new Vector2(0.5f, 0.5f),
|
||||
BufferQuality.High => Vector2.one,
|
||||
_ => Vector2.zero
|
||||
BufferQuality.Low => GraphicsFormat.D16_UNorm,
|
||||
BufferQuality.High => GraphicsFormat.D32_SFloat,
|
||||
_ => GraphicsFormat.R16G16B16A16_SFloat
|
||||
};
|
||||
|
||||
_hairShadowRTHandle?.Release();
|
||||
_hairShadowRTHandle = RTHandles.Alloc(scale, useDynamicScale: true, format: GraphicsFormat.D16_UNorm, isShadowMap: true, name: _HAIR_SHADOW_RT_PROP_NAME);
|
||||
_hairShadowRTHandle = RTHandles.Alloc(Vector2.one, useDynamicScale: true, format: format, isShadowMap: true, name: _HAIR_SHADOW_RT_PROP_NAME);
|
||||
Shader.SetGlobalTexture(_HAIR_SHADOW_RT_PROP_NAME, _hairShadowRTHandle);
|
||||
|
||||
_needReallocateHairShadow = false;
|
||||
@@ -179,6 +179,13 @@ namespace Misaki.HdrpToon
|
||||
|
||||
_hairBlendingRTHandle?.Release();
|
||||
_hairBlendingRTHandle = RTHandles.Alloc(Vector2.one, useDynamicScale: true, dimension: TextureXR.dimension, colorFormat: format, name: _HAIR_BLENDING_PROP_NAME);
|
||||
|
||||
if (_hairBlendingDepthRTHandle == null || _hairBlendingDepthRTHandle.rt == null || !_hairBlendingDepthRTHandle.rt.IsCreated())
|
||||
{
|
||||
_hairBlendingDepthRTHandle?.Release();
|
||||
_hairBlendingDepthRTHandle = RTHandles.Alloc(Vector2.one, useDynamicScale: true, dimension: TextureXR.dimension, colorFormat: GraphicsFormat.D16_UNorm, name: _HAIR_BLENDING_PROP_NAME + "_depth");
|
||||
}
|
||||
|
||||
Shader.SetGlobalTexture(_HAIR_BLENDING_PROP_NAME, _hairBlendingRTHandle);
|
||||
|
||||
_needReallocateHairBlending = false;
|
||||
@@ -274,7 +281,6 @@ namespace Misaki.HdrpToon
|
||||
|
||||
CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, ctx.renderContext.CreateRendererList(result));
|
||||
|
||||
Shader.SetGlobalVector(_HAIR_SHADOW_RTHANDLE_SCALE_PROP_NAME, _hairShadowRTHandle.rtHandleProperties.rtHandleScale);
|
||||
Shader.SetGlobalFloat(_HAIR_SHADOW_DISTANCE_PROP_NAME, utsRenderer.shadowDistance.value);
|
||||
Shader.SetGlobalFloat(_HAIR_SHADOW_DISTANCE_SCALE_PROP_NAME, utsRenderer.shadowDistanceScale.value);
|
||||
Shader.SetGlobalFloat(_HAIR_SHADOW_DEPTH_BIAS_PROP_NAME, utsRenderer.shadowDepthBias.value);
|
||||
@@ -298,7 +304,7 @@ namespace Misaki.HdrpToon
|
||||
|
||||
using (new ProfilingScope(ctx.cmd, _hairBlendingProfilingSampler))
|
||||
{
|
||||
CoreUtils.SetRenderTarget(ctx.cmd, _hairBlendingRTHandle, ctx.cameraDepthBuffer, ClearFlag.Color);
|
||||
CoreUtils.SetRenderTarget(ctx.cmd, _hairBlendingRTHandle, _hairBlendingDepthRTHandle, ClearFlag.Color | ClearFlag.Depth);
|
||||
|
||||
var result = new RendererListDesc(UtsShaderPassName.hairBlendingTargetPassId, ctx.cullingResults, ctx.hdCamera.camera)
|
||||
{
|
||||
@@ -308,7 +314,6 @@ namespace Misaki.HdrpToon
|
||||
};
|
||||
|
||||
CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, ctx.renderContext.CreateRendererList(result));
|
||||
Shader.SetGlobalVector(_HAIR_BLENDING_RTHANDLE_SCALE_PROP_NAME, _hairBlendingRTHandle.rtHandleProperties.rtHandleScale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,6 +331,7 @@ namespace Misaki.HdrpToon
|
||||
_exposureArray = null;
|
||||
_hairShadowRTHandle?.Release();
|
||||
_hairBlendingRTHandle?.Release();
|
||||
_hairBlendingDepthRTHandle?.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ namespace Misaki.HdrpToon
|
||||
public BoolParameter enableHairShadow = new(false);
|
||||
public ClampedFloatParameter shadowDistance = new(5.0f, 0.0f, 20.0f);
|
||||
public ClampedFloatParameter shadowDistanceScale = new(0.5f, 0.0f, 1.0f);
|
||||
public ClampedFloatParameter shadowDepthBias = new(0f, 0.0f, 0.01f);
|
||||
public ClampedFloatParameter shadowDepthBias = new(0f, -0.01f, 0.01f);
|
||||
public FloatParameter shadowFadeIn = new(45f);
|
||||
public FloatParameter shadowFadeOut = new(50f);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.misaki.hdrp-toon",
|
||||
"version": "2.1.0",
|
||||
"version": "3.0.1-pre",
|
||||
"displayName": "HDRP Toon",
|
||||
"description": "A high quality toon shader for High Definition Render Pipeline(HDRP)",
|
||||
"changelogUrl": "https://git.personalnas.com/Misaki/hdrp-toon/src/branch/develop/CHANGELOG.md",
|
||||
@@ -21,6 +21,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"com.unity.render-pipelines.high-definition": "17.0.0",
|
||||
"com.misaki.shader-gui": "1.1.2"
|
||||
"com.misaki.shader-gui": "1.1.4"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user