您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
38 行
1.6 KiB
38 行
1.6 KiB
using System;
|
|
using UnityEngine.Rendering;
|
|
|
|
namespace UnityEngine.Experimental.Rendering.HDPipeline
|
|
{
|
|
[Serializable]
|
|
public class ScreenSpaceRefraction : VolumeComponent
|
|
{
|
|
static ScreenSpaceRefraction s_Default = null;
|
|
public static ScreenSpaceRefraction @default
|
|
{
|
|
get
|
|
{
|
|
if (s_Default == null)
|
|
{
|
|
s_Default = ScriptableObject.CreateInstance<ScreenSpaceRefraction>();
|
|
s_Default.hideFlags = HideFlags.HideAndDontSave;
|
|
}
|
|
return s_Default;
|
|
}
|
|
}
|
|
|
|
public IntParameter rayMinLevel = new IntParameter(2);
|
|
public IntParameter rayMaxLevel = new IntParameter(6);
|
|
public IntParameter rayMaxIterations = new IntParameter(32);
|
|
public FloatParameter rayDepthSuccessBias = new FloatParameter(0.1f);
|
|
public ClampedFloatParameter screenWeightDistance = new ClampedFloatParameter(0.1f, 0, 1);
|
|
|
|
public void PushShaderParameters(CommandBuffer cmd)
|
|
{
|
|
cmd.SetGlobalInt(HDShaderIDs._SSRefractionRayMinLevel, rayMinLevel.value);
|
|
cmd.SetGlobalInt(HDShaderIDs._SSRefractionRayMaxLevel, rayMaxLevel.value);
|
|
cmd.SetGlobalInt(HDShaderIDs._SSRefractionRayMaxIterations, rayMaxIterations.value);
|
|
cmd.SetGlobalFloat(HDShaderIDs._SSRefractionRayDepthSuccessBias, rayDepthSuccessBias.value);
|
|
cmd.SetGlobalFloat(HDShaderIDs._SSRefractionInvScreenWeightDistance, 1f / screenWeightDistance.value);
|
|
}
|
|
}
|
|
}
|