Added HairBlending shader pass;
Added HairBlendingSetting in UTSRenderPassSetting; Added MaterialType to UTS; Added MaterialFeature scope to UTS material editor; Merged HairBlendingPass and HairShadowPass into UTSPass; Fixed the bug that character box light can not update rotation correctly according to bound light source;
This commit is contained in:
@@ -10,12 +10,6 @@ namespace Misaki.HdrpToon
|
||||
[HideInInspector]
|
||||
internal class UTSHairShadowPass : DrawRenderersCustomPass
|
||||
{
|
||||
public enum ShadowQuality
|
||||
{
|
||||
Low,
|
||||
High
|
||||
}
|
||||
|
||||
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";
|
||||
@@ -23,13 +17,13 @@ namespace Misaki.HdrpToon
|
||||
private const string Hair_Shadow_FadeIn_Prop_Name = "_HairShadowFadeInDistance";
|
||||
private const string Hair_Shadow_Fade_Out_Prop_Name = "_HairShadowFadeOutDistance";
|
||||
|
||||
private const string Output_RT_Name = "_HairShadowTex";
|
||||
private const string Output_RT_Prop_Name = "_HairShadowTex";
|
||||
|
||||
private RTHandle _outputRTHandle;
|
||||
private bool _needReallocate;
|
||||
|
||||
private ShadowQuality _shadowQuality = ShadowQuality.High;
|
||||
internal ShadowQuality CurrentShadowQuality
|
||||
private BufferQuality _shadowQuality = BufferQuality.High;
|
||||
internal BufferQuality CurrentShadowQuality
|
||||
{
|
||||
get => _shadowQuality;
|
||||
set
|
||||
@@ -60,21 +54,21 @@ namespace Misaki.HdrpToon
|
||||
|
||||
var scale = _shadowQuality switch
|
||||
{
|
||||
ShadowQuality.Low => new Vector2(0.5f, 0.5f),
|
||||
ShadowQuality.High => Vector2.one,
|
||||
BufferQuality.Low => new Vector2(0.5f, 0.5f),
|
||||
BufferQuality.High => Vector2.one,
|
||||
_ => Vector2.zero
|
||||
};
|
||||
|
||||
var format = _shadowQuality switch
|
||||
{
|
||||
ShadowQuality.Low => GraphicsFormat.D16_UNorm,
|
||||
ShadowQuality.High => GraphicsFormat.D32_SFloat,
|
||||
BufferQuality.Low => GraphicsFormat.D16_UNorm,
|
||||
BufferQuality.High => GraphicsFormat.D32_SFloat,
|
||||
_ => GraphicsFormat.D16_UNorm
|
||||
};
|
||||
|
||||
_outputRTHandle?.Release();
|
||||
_outputRTHandle = RTHandles.Alloc(scale, colorFormat: format, filterMode: FilterMode.Bilinear, wrapMode: TextureWrapMode.Clamp, isShadowMap: true, name: Output_RT_Name);
|
||||
Shader.SetGlobalTexture(Output_RT_Name, _outputRTHandle);
|
||||
_outputRTHandle = RTHandles.Alloc(scale, colorFormat: format, filterMode: FilterMode.Bilinear, wrapMode: TextureWrapMode.Clamp, isShadowMap: true, useDynamicScale: true, name: Output_RT_Prop_Name);
|
||||
Shader.SetGlobalTexture(Output_RT_Prop_Name, _outputRTHandle);
|
||||
|
||||
_needReallocate = false;
|
||||
}
|
||||
@@ -102,18 +96,11 @@ namespace Misaki.HdrpToon
|
||||
return;
|
||||
}
|
||||
|
||||
var mask = RenderStateMask.Nothing;
|
||||
var stateBlock = new RenderStateBlock(mask)
|
||||
{
|
||||
depthState = new DepthState(true, CompareFunction.LessEqual),
|
||||
};
|
||||
|
||||
var result = new RendererListDesc(UtsShaderPassName.hairShadowCasterPassId, ctx.cullingResults, ctx.hdCamera.camera)
|
||||
{
|
||||
renderQueueRange = GetRenderQueueRange(RenderQueueType.All),
|
||||
sortingCriteria = SortingCriteria.CommonOpaque,
|
||||
excludeObjectMotionVectors = false,
|
||||
stateBlock = stateBlock,
|
||||
};
|
||||
|
||||
CoreUtils.DrawRendererList(ctx.renderContext, ctx.cmd, ctx.renderContext.CreateRendererList(result));
|
||||
|
||||
Reference in New Issue
Block a user