浏览代码

Move files to screenspace lighting and move Reflection enum in it

/main
sebastienlagarde 6 年前
当前提交
26c608bb
共有 24 个文件被更改,包括 188 次插入144 次删除
  1. 6
      com.unity.render-pipelines.core/CoreRP/ShaderLibrary/ImageBasedLighting.hlsl
  2. 20
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs
  3. 1
      com.unity.render-pipelines.high-definition/HDRP/Debug/DebugFullScreen.shader
  4. 6
      com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs
  5. 16
      com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Lit/LitUI.cs
  6. 24
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs
  7. 15
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs.hlsl
  8. 13
      com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl
  9. 8
      com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs
  10. 2
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs
  11. 94
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs
  12. 24
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.hlsl
  13. 9
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.hlsl.meta
  14. 16
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.hlsl
  15. 9
      com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.hlsl.meta
  16. 69
      com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceLighting.cs
  17. 0
      /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceRefraction.cs.meta
  18. 0
      /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceTracing.hlsl.meta
  19. 0
      /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.meta
  20. 0
      /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs
  21. 0
      /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs.meta
  22. 0
      /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceRefraction.cs
  23. 0
      /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceTracing.hlsl

6
com.unity.render-pipelines.core/CoreRP/ShaderLibrary/ImageBasedLighting.hlsl


return PerceptualRoughnessToMipmapLevel(perceptualRoughness, UNITY_SPECCUBE_LOD_STEPS);
}
// Mapping for convolved Texture2D, this is an empirical remapping to match GGX version of cubemap convolution
real PlanarPerceptualRoughnessToMipmapLevel(real perceptualRoughness, uint mipMapcount)
{
return PositivePow(perceptualRoughness, 0.8) * uint(max(mipMapcount - 1, 0));
}
// The *accurate* version of the non-linear remapping. It works by
// approximating the cone of the specular lobe, and then computing the MIP map level
// which (approximately) covers the footprint of the lobe with a single texel.

20
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugDisplay.cs


{
// Used to debug SSRay model
// 1x32 bits
public Lit.ProjectionModel tracingModel;
public ScreenSpaceLighting.ProjectionModel tracingModel;
// 6x32 bits
public uint loopStartPositionSSX; // Proxy, HiZ, Linear

public float iterationLinearDepthBufferMin; // HiZ, Linear
public float iterationLinearDepthBufferMax; // HiZ, Linear
public float iterationLinearDepthBufferMinThickness; // HiZ, Linear
public Lit.HiZIntersectionKind iterationIntersectionKind; // HiZ
public ScreenSpaceLighting.HiZIntersectionKind iterationIntersectionKind; // HiZ
public uint iterationCellSizeW; // HiZ, Linear
public uint iterationCellSizeH; // HiZ, Linear
public EnvShapeType proxyShapeType; // Proxy

public static GUIContent[] debuggedAlgorithmStrings = null;
public static int[] debuggedAlgorithmValues = null;
Lit.ProjectionModel m_LastProjectionModel = Lit.ProjectionModel.None;
ScreenSpaceLighting.ProjectionModel m_LastProjectionModel = ScreenSpaceLighting.ProjectionModel.None;
ScreenSpaceTracingDebug m_ScreenSpaceTracingDebugData;
public ScreenSpaceTracingDebug screenSpaceTracingDebugData
{

if (m_LastProjectionModel != m_ScreenSpaceTracingDebugData.tracingModel)
{
m_LastProjectionModel = m_ScreenSpaceTracingDebugData.tracingModel;
RefreshScreenSpaceTracingDebug<Lit.ProjectionModel>(null, m_LastProjectionModel);
RefreshScreenSpaceTracingDebug<ScreenSpaceLighting.ProjectionModel>(null, m_LastProjectionModel);
if (m_ScreenSpaceTracingDebugData.tracingModel == Lit.ProjectionModel.Proxy)
if (m_ScreenSpaceTracingDebugData.tracingModel == ScreenSpaceLighting.ProjectionModel.Proxy)
{
showSSRayDepthPyramid = false;
showSSRayGrid = false;

debugScreenSpaceTracingProxyValues = debugScreenSpaceTracingProxyValueList.ToArray();
debugScreenSpaceTracingLinearStrings = debugScreenSpaceTracingLinearStringsList.ToArray();
debugScreenSpaceTracingLinearValues = debugScreenSpaceTracingLinearValueList.ToArray();
debuggedAlgorithmStrings = Enum.GetNames(typeof(Lit.ProjectionModel))
debuggedAlgorithmStrings = Enum.GetNames(typeof(ScreenSpaceLighting.ProjectionModel))
debuggedAlgorithmValues = (int[])Enum.GetValues(typeof(Lit.ProjectionModel));
debuggedAlgorithmValues = (int[])Enum.GetValues(typeof(ScreenSpaceLighting.ProjectionModel));
}
public int GetDebugMaterialIndex()

switch (screenSpaceTracingDebugData.tracingModel)
{
case Lit.ProjectionModel.Proxy:
case ScreenSpaceLighting.ProjectionModel.Proxy:
{
debugSettingsContainer.children.Add(
new DebugUI.EnumField { displayName = "Debug Mode", getter = GetDebugLightingSubMode, setter = SetScreenSpaceTracingDebugMode, enumNames = debugScreenSpaceTracingProxyStrings, enumValues = debugScreenSpaceTracingProxyValues, onValueChanged = RefreshScreenSpaceTracingDebug }

);
break;
}
case Lit.ProjectionModel.HiZ:
case ScreenSpaceLighting.ProjectionModel.HiZ:
{
debugSettingsContainer.children.Insert(1, new DebugUI.Value { displayName = string.Empty, getter = () => "Press PageUp/PageDown to Increase/Decrease the HiZ step." });
debugSettingsContainer.children.Add(

);
break;
}
case Lit.ProjectionModel.Linear:
case ScreenSpaceLighting.ProjectionModel.Linear:
{
debugSettingsContainer.children.Add(
new DebugUI.EnumField { displayName = "Debug Mode", getter = GetDebugLightingSubMode, setter = SetScreenSpaceTracingDebugMode, enumNames = debugScreenSpaceTracingLinearStrings, enumValues = debugScreenSpaceTracingLinearValues, onValueChanged = RefreshScreenSpaceTracingDebug },

1
com.unity.render-pipelines.high-definition/HDRP/Debug/DebugFullScreen.shader


#include "HDRP/ShaderVariables.hlsl"
#include "HDRP/Debug/DebugDisplay.cs.hlsl"
#include "HDRP/Material/Builtin/BuiltinData.hlsl"
#include "HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.hlsl"
CBUFFER_START (UnityDebug)
float _FullScreenDebugMode;

6
com.unity.render-pipelines.high-definition/HDRP/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs


public override void OnInspectorGUI()
{
OnCommonInspectorGUI();
var projectionModel = (Lit.ProjectionModel)m_DeferredProjectionModel.value.enumValueIndex;
var projectionModel = (ScreenSpaceLighting.ProjectionModel)m_DeferredProjectionModel.value.enumValueIndex;
case Lit.ProjectionModel.HiZ:
case ScreenSpaceLighting.ProjectionModel.HiZ:
case Lit.ProjectionModel.Proxy:
case ScreenSpaceLighting.ProjectionModel.Proxy:
EditorGUILayout.Separator();
OnProxyInspectorGUI();
break;

16
com.unity.render-pipelines.high-definition/HDRP/Editor/Material/Lit/LitUI.cs


&& !isPrepass)
{
m_MaterialEditor.ShaderProperty(refractionModel, Styles.refractionModelText);
var mode = (Lit.RefractionModel)refractionModel.floatValue;
if (mode != Lit.RefractionModel.None)
var mode = (ScreenSpaceLighting.RefractionModel)refractionModel.floatValue;
if (mode != ScreenSpaceLighting.RefractionModel.None)
{
m_MaterialEditor.ShaderProperty(ssrefractionProjectionModel, Styles.refractionProjectionModelText);
m_MaterialEditor.ShaderProperty(ior, Styles.refractionIorText);

CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_IRIDESCENCE", materialId == BaseLitGUI.MaterialId.LitIridescence);
CoreUtils.SetKeyword(material, "_MATERIAL_FEATURE_SPECULAR_COLOR", materialId == BaseLitGUI.MaterialId.LitSpecular);
var refractionModelValue = (Lit.RefractionModel)material.GetFloat(kRefractionModel);
var refractionProjectionModelValue = (Lit.ProjectionModel)material.GetFloat(kSSRefractionProjectionModel);
var refractionModelValue = (ScreenSpaceLighting.RefractionModel)material.GetFloat(kRefractionModel);
var refractionProjectionModelValue = (ScreenSpaceLighting.ProjectionModel)material.GetFloat(kSSRefractionProjectionModel);
CoreUtils.SetKeyword(material, "_REFRACTION_PLANE", (refractionModelValue == Lit.RefractionModel.Plane) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SPHERE", (refractionModelValue == Lit.RefractionModel.Sphere) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_PLANE", (refractionModelValue == ScreenSpaceLighting.RefractionModel.Plane) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SPHERE", (refractionModelValue == ScreenSpaceLighting.RefractionModel.Sphere) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_PROXY", (refractionProjectionModelValue == Lit.ProjectionModel.Proxy) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_HIZ", (refractionProjectionModelValue == Lit.ProjectionModel.HiZ) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_PROXY", (refractionProjectionModelValue == ScreenSpaceLighting.ProjectionModel.Proxy) && canHaveRefraction);
CoreUtils.SetKeyword(material, "_REFRACTION_SSRAY_HIZ", (refractionProjectionModelValue == ScreenSpaceLighting.ProjectionModel.HiZ) && canHaveRefraction);
}
}
} // namespace UnityEditor

24
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs


LitClearCoat = 1 << 6
};
public enum RefractionModel
{
None = 0,
Plane = 1,
Sphere = 2
};
[GenerateHLSL]
public enum ProjectionModel
{
None = 0,
Proxy = 1,
HiZ = 2,
Linear = 3
};
[GenerateHLSL]
public enum HiZIntersectionKind
{
None,
Cell,
Depth
}
//-----------------------------------------------------------------------------
// SurfaceData
//-----------------------------------------------------------------------------

15
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.cs.hlsl


#define MATERIALFEATUREFLAGS_LIT_CLEAR_COAT (64)
//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+ProjectionModel: static fields
//
#define PROJECTIONMODEL_NONE (0)
#define PROJECTIONMODEL_PROXY (1)
#define PROJECTIONMODEL_HI_Z (2)
#define PROJECTIONMODEL_LINEAR (3)
//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+HiZIntersectionKind: static fields
//
#define HIZINTERSECTIONKIND_NONE (0)
#define HIZINTERSECTIONKIND_CELL (1)
#define HIZINTERSECTIONKIND_DEPTH (2)
//
// UnityEngine.Experimental.Rendering.HDPipeline.Lit+SurfaceData: static fields
//
#define DEBUGVIEW_LIT_SURFACEDATA_MATERIAL_FEATURES (1000)

13
com.unity.render-pipelines.high-definition/HDRP/Material/Lit/Lit.hlsl


#include "HDRP/Lighting/LightDefinition.cs.hlsl"
#include "HDRP/Lighting/Reflection/VolumeProjection.hlsl"
#define SSRTID Reflection
#include "HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl"
#undef SSRTID
#include "HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.hlsl"
#include "CoreRP/ShaderLibrary/Refraction.hlsl"
#define SSRTID Refraction
#include "HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl"
#undef SSRTID
#if defined(_REFRACTION_PLANE)
#define REFRACTION_MODEL(V, posInputs, bsdfData) RefractionModelPlane(V, posInputs.positionWS, bsdfData.normalWS, bsdfData.ior, bsdfData.thickness)
#elif defined(_REFRACTION_SPHERE)

{
rayOriginWS = posInput.positionWS;
rayDirWS = preLightData.iblR;
mipLevel = PositivePow(preLightData.iblPerceptualRoughness, 0.8) * uint(max(_ColorPyramidScale.z - 1, 0));
mipLevel = PlanarPerceptualRoughnessToMipmapLevel(preLightData.iblPerceptualRoughness, _ColorPyramidScale.z);
invScreenWeightDistance = _SSReflectionInvScreenWeightDistance;
#ifdef DEBUG_DISPLAY
debugMode = DEBUGLIGHTINGMODE_SCREEN_SPACE_TRACING_REFLECTION;

if (IsEnvIndexTexture2D(lightData.envIndex))
{
// Empirical remapping
iblMipLevel = PositivePow(preLightData.iblPerceptualRoughness, 0.8) * uint(max(_ColorPyramidScale.z - 1, 0));
iblMipLevel = PlanarPerceptualRoughnessToMipmapLevel(preLightData.iblPerceptualRoughness, _ColorPyramidScale.z);
}
else
#endif

8
com.unity.render-pipelines.high-definition/HDRP/RenderPipeline/HDRenderPipeline.cs


// In both forward and deferred, everything opaque should have been rendered at this point so we can safely copy the depth buffer for later processing.
CopyDepthBufferIfNeeded(cmd);
// Depth texture is now ready, bind it (Depth buffer could have been bind before if DBuffer is enable)
cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, GetDepthTexture());
RenderDepthPyramid(hdCamera, cmd, renderContext, FullScreenDebugMode.DepthPyramid);
// TODO: In the future we will render object velocity at the same time as depth prepass (we need C++ modification for this)

RenderCameraVelocity(m_CullResults, hdCamera, renderContext, cmd);
// Depth texture is now ready, bind it (Depth buffer could have been bind before if DBuffer is enable)
cmd.SetGlobalTexture(HDShaderIDs._CameraDepthTexture, GetDepthTexture());
// Caution: We require sun light here as some skies use the sun light to render, it means that UpdateSkyEnvironment must be called after PrepareLightsForGPU.
// TODO: Try to arrange code so we can trigger this call earlier and use async compute here to run sky convolution during other passes (once we move convolution shader to compute).

// Assign -1 in tracing model to notifiy we took the data.
// When debugging in forward, we want only the first time the pixel is drawn
data.tracingModel = (Lit.ProjectionModel)(-1);
data.tracingModel = (ScreenSpaceLighting.ProjectionModel)(-1);
m_DebugScreenSpaceTracingDataArray[0] = data;
m_DebugScreenSpaceTracingData.SetData(m_DebugScreenSpaceTracingDataArray);
}

2
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs


[Serializable]
public class ScreenSpaceReflection : ScreenSpaceLighting
{
// Values must be in sync with Lit.ProjectionModel
// Values must be in sync with ScreenSpaceLighting.ProjectionModel
public enum AvailableProjectionModel
{
None = 0,

94
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs


using System;
using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[Serializable]
public abstract class ScreenSpaceLighting : VolumeComponent
{
public enum RefractionModel
{
None = 0,
Plane = 1,
Sphere = 2
};
[GenerateHLSL]
public enum ProjectionModel
{
None = 0,
Proxy = 1,
HiZ = 2,
Linear = 3,
Count
};
[GenerateHLSL]
public enum HiZIntersectionKind
{
None,
Cell,
Depth
}
int m_RayLevelID;
int m_RayMinLevelID;
int m_RayMaxLevelID;
int m_RayMaxIterationsID;
int m_DepthBufferThicknessID;
int m_InvScreenWeightDistanceID;
int m_RayMaxScreenDistanceID;
int m_RayBlendScreenDistanceID;
int m_RayMarchBehindObjectsID;
public IntParameter rayLevel = new IntParameter(2);
public IntParameter rayMinLevel = new IntParameter(2);
public IntParameter rayMaxLevel = new IntParameter(6);
public IntParameter rayMaxIterations = new IntParameter(32);
public FloatParameter depthBufferThickness = new FloatParameter(1f);
public ClampedFloatParameter screenWeightDistance = new ClampedFloatParameter(0.1f, 0, 1);
public ClampedFloatParameter rayMaxScreenDistance = new ClampedFloatParameter(0.3f, 0, 1);
public ClampedFloatParameter rayBlendScreenDistance = new ClampedFloatParameter(0.1f, 0, 1);
public BoolParameter rayMarchBehindObjects = new BoolParameter(true);
public virtual void PushShaderParameters(CommandBuffer cmd)
{
cmd.SetGlobalInt(m_RayLevelID, rayLevel.value);
cmd.SetGlobalInt(m_RayMinLevelID, rayMinLevel.value);
cmd.SetGlobalInt(m_RayMaxLevelID, rayMaxLevel.value);
cmd.SetGlobalInt(m_RayMaxIterationsID, rayMaxIterations.value);
cmd.SetGlobalFloat(m_DepthBufferThicknessID, depthBufferThickness.value);
cmd.SetGlobalFloat(m_InvScreenWeightDistanceID, 1f / screenWeightDistance.value);
cmd.SetGlobalFloat(m_RayMaxScreenDistanceID, rayMaxScreenDistance.value);
cmd.SetGlobalFloat(m_RayBlendScreenDistanceID, rayBlendScreenDistance.value);
cmd.SetGlobalInt(m_RayMarchBehindObjectsID, rayMarchBehindObjects.value ? 1 : 0);
}
protected abstract void FetchIDs(
out int rayLevelID,
out int rayMinLevelID,
out int rayMaxLevelID,
out int rayMaxIterationsID,
out int DepthBufferThicknessID,
out int invScreenWeightDistanceID,
out int rayMaxScreenDistanceID,
out int rayBlendScreenDistanceID,
out int rayMarchBehindObjectsID
);
void Awake()
{
FetchIDs(
out m_RayLevelID,
out m_RayMinLevelID,
out m_RayMaxLevelID,
out m_RayMaxIterationsID,
out m_DepthBufferThicknessID,
out m_InvScreenWeightDistanceID,
out m_RayMaxScreenDistanceID,
out m_RayBlendScreenDistanceID,
out m_RayMarchBehindObjectsID
);
}
}
}

24
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.hlsl


//
// This file was automatically generated. Please don't edit by hand.
//
#ifndef SCREENSPACELIGHTING_CS_HLSL
#define SCREENSPACELIGHTING_CS_HLSL
//
// UnityEngine.Experimental.Rendering.HDPipeline.ScreenSpaceLighting+ProjectionModel: static fields
//
#define PROJECTIONMODEL_NONE (0)
#define PROJECTIONMODEL_PROXY (1)
#define PROJECTIONMODEL_HI_Z (2)
#define PROJECTIONMODEL_LINEAR (3)
#define PROJECTIONMODEL_COUNT (4)
//
// UnityEngine.Experimental.Rendering.HDPipeline.ScreenSpaceLighting+HiZIntersectionKind: static fields
//
#define HIZINTERSECTIONKIND_NONE (0)
#define HIZINTERSECTIONKIND_CELL (1)
#define HIZINTERSECTIONKIND_DEPTH (2)
#endif

9
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.hlsl.meta


fileFormatVersion: 2
guid: 117f0ba79109fbf49a6f34d915d965d0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

16
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.hlsl


#ifndef UNITY_SCREENSPACELIGHTING_INCLUDED
#define UNITY_SCREENSPACELIGHTING_INCLUDED
#include "HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.hlsl"
#include "HDRP/Lighting/Reflection/VolumeProjection.hlsl"
#define SSRTID Reflection
#include "HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceTracing.hlsl"
#undef SSRTID
#include "CoreRP/ShaderLibrary/Refraction.hlsl"
#define SSRTID Refraction
#include "HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceTracing.hlsl"
#undef SSRTID
#endif

9
com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.hlsl.meta


fileFormatVersion: 2
guid: 7f4f99197456f344d9545ac794d20867
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:

69
com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceLighting.cs


using System;
using UnityEngine.Rendering;
namespace UnityEngine.Experimental.Rendering.HDPipeline
{
[Serializable]
public abstract class ScreenSpaceLighting : VolumeComponent
{
int m_RayLevelID;
int m_RayMinLevelID;
int m_RayMaxLevelID;
int m_RayMaxIterationsID;
int m_DepthBufferThicknessID;
int m_InvScreenWeightDistanceID;
int m_RayMaxScreenDistanceID;
int m_RayBlendScreenDistanceID;
int m_RayMarchBehindObjectsID;
public IntParameter rayLevel = new IntParameter(2);
public IntParameter rayMinLevel = new IntParameter(2);
public IntParameter rayMaxLevel = new IntParameter(6);
public IntParameter rayMaxIterations = new IntParameter(32);
public FloatParameter depthBufferThickness = new FloatParameter(1f);
public ClampedFloatParameter screenWeightDistance = new ClampedFloatParameter(0.1f, 0, 1);
public ClampedFloatParameter rayMaxScreenDistance = new ClampedFloatParameter(0.3f, 0, 1);
public ClampedFloatParameter rayBlendScreenDistance = new ClampedFloatParameter(0.1f, 0, 1);
public BoolParameter rayMarchBehindObjects = new BoolParameter(true);
public virtual void PushShaderParameters(CommandBuffer cmd)
{
cmd.SetGlobalInt(m_RayLevelID, rayLevel.value);
cmd.SetGlobalInt(m_RayMinLevelID, rayMinLevel.value);
cmd.SetGlobalInt(m_RayMaxLevelID, rayMaxLevel.value);
cmd.SetGlobalInt(m_RayMaxIterationsID, rayMaxIterations.value);
cmd.SetGlobalFloat(m_DepthBufferThicknessID, depthBufferThickness.value);
cmd.SetGlobalFloat(m_InvScreenWeightDistanceID, 1f / screenWeightDistance.value);
cmd.SetGlobalFloat(m_RayMaxScreenDistanceID, rayMaxScreenDistance.value);
cmd.SetGlobalFloat(m_RayBlendScreenDistanceID, rayBlendScreenDistance.value);
cmd.SetGlobalInt(m_RayMarchBehindObjectsID, rayMarchBehindObjects.value ? 1 : 0);
}
protected abstract void FetchIDs(
out int rayLevelID,
out int rayMinLevelID,
out int rayMaxLevelID,
out int rayMaxIterationsID,
out int DepthBufferThicknessID,
out int invScreenWeightDistanceID,
out int rayMaxScreenDistanceID,
out int rayBlendScreenDistanceID,
out int rayMarchBehindObjectsID
);
void Awake()
{
FetchIDs(
out m_RayLevelID,
out m_RayMinLevelID,
out m_RayMaxLevelID,
out m_RayMaxIterationsID,
out m_DepthBufferThicknessID,
out m_InvScreenWeightDistanceID,
out m_RayMaxScreenDistanceID,
out m_RayBlendScreenDistanceID,
out m_RayMarchBehindObjectsID
);
}
}
}

/com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceRefraction.cs.meta → /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceRefraction.cs.meta

/com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl.meta → /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceTracing.hlsl.meta

/com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceLighting.cs.meta → /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceLighting.cs.meta

/com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceReflection.cs → /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs

/com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceReflection.cs.meta → /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs.meta

/com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceRefraction.cs → /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceRefraction.cs

/com.unity.render-pipelines.high-definition/HDRP/Lighting/Reflection/ScreenSpaceTracing.hlsl → /com.unity.render-pipelines.high-definition/HDRP/Lighting/ScreenSpaceLighting/ScreenSpaceTracing.hlsl

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存