浏览代码

Fixed various issue and follow the deisng done with Julien. Working version

/feature-ReflectionProbeFit
Sebastien Lagarde 7 年前
当前提交
13eb066f
共有 5 个文件被更改,包括 81 次插入32 次删除
  1. 24
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  2. 18
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs
  3. 30
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopSettings.cs
  4. 40
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/FrameSettings.cs
  5. 1
      ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.cs

24
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


{
return m_samplers[(int)id];
}
public CommonSettings.Settings commonSettingsToUse
{
get

m_DebugDisplaySettings.RegisterDebug(m_Asset.GetEffectiveDefaultFrameSettings());
m_DebugFullScreenTempRT = HDShaderIDs._DebugFullScreenTexture;
// Init all samplers
for (int i = 0; i < (int)CustomSamplerId.Max; i++)

void RenderDistortion(CommandBuffer cmd, RenderPipelineResources resources)
{
if (!m_FrameSettings.renderSettings.enableDistortion)
return;
using (new ProfilingSample(cmd, "ApplyDistortion", GetSampler(CustomSamplerId.ApplyDistortion)))
{
var size = new Vector4(m_CurrentWidth, m_CurrentHeight, 1f / m_CurrentWidth, 1f / m_CurrentHeight);

}
}
// Render transparent depth prepass after opaque one
using (new ProfilingSample(cmd, "Transparent Depth Prepass", GetSampler(CustomSamplerId.TransparentDepthPrepass)))
if (m_FrameSettings.renderSettings.enableTransparentPrePass)
RenderTransparentRenderList(cull, camera, renderContext, cmd, m_TransparentDepthPrePassNames);
// Render transparent depth prepass after opaque one
using (new ProfilingSample(cmd, "Transparent Depth Prepass", GetSampler(CustomSamplerId.TransparentDepthPrepass)))
{
RenderTransparentRenderList(cull, camera, renderContext, cmd, m_TransparentDepthPrePassNames);
}
}
}

void RenderSSAO(CommandBuffer cmd, Camera camera, ScriptableRenderContext renderContext, PostProcessLayer postProcessLayer)
{
// Apply SSAO from PostProcessLayer
if (postProcessLayer != null && postProcessLayer.enabled)
if (m_FrameSettings.lightingSettings.enableSSAO && postProcessLayer != null && postProcessLayer.enabled)
{
var settings = postProcessLayer.GetSettings<AmbientOcclusion>();

void RenderTransparentDepthPostPass(CullResults cullResults, Camera camera, ScriptableRenderContext renderContext, CommandBuffer cmd, ForwardPass pass)
{
if (m_FrameSettings.renderSettings.enableTransparentPostPass)
return;
using (new ProfilingSample(cmd, "Render Transparent Depth Post ", GetSampler(CustomSamplerId.TransparentDepthPostPass)))
{
CoreUtils.SetRenderTarget(cmd, m_CameraDepthStencilBufferRT);

void RenderVelocity(CullResults cullResults, HDCamera hdcam, ScriptableRenderContext renderContext, CommandBuffer cmd)
{
if (!m_FrameSettings.renderSettings.enableMotionVectors)
return;
using (new ProfilingSample(cmd, "Velocity", GetSampler(CustomSamplerId.Velocity)))
{
// If opaque velocity have been render during GBuffer no need to render it here

{
using (new ProfilingSample(cmd, "Post-processing", GetSampler(CustomSamplerId.PostProcessing)))
{
if (CoreUtils.IsPostProcessingActive(layer))
if (m_FrameSettings.renderSettings.enablePostprocess && CoreUtils.IsPostProcessingActive(layer))
{
// Note: Here we don't use GetDepthTexture() to get the depth texture but m_CameraDepthStencilBuffer as the Forward transparent pass can
// write extra data to deal with DOF/MB

18
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipelineAsset.cs


// To be able to turn on/off FrameSettings properties at runtime for debugging purpose without affecting the original one
// we create a runtime copy (m_effectiveFrameSettings that is used, and any parametrization is done on serialized frameSettings)
public FrameSettings defaultFrameSettings = new FrameSettings(); // This are the defaultFrameSettings for all the camera and apply to sceneView
// Not serialized, not visible
public FrameSettings defaultFrameSettings = new FrameSettings(); // This are the defaultFrameSettings for all the camera and apply to sceneView, public to be visible in the inspector
// Not serialized, not visible, the settings effectively used
}
public void OnValidate()
{
// Modification of defaultFrameSettings in the inspector will call OnValidate().
// We do a copy of the settings to those effectively used
defaultFrameSettings.CopyTo(m_defaultEffectiveFrameSettings);
}
// Store the various GlobalFrameSettings for each platform (for now only one)

public override Material GetDefault2DMaterial()
{
return null;
}
public void OnValidate()
{
// Modification of defaultFrameSettings in the inspector will call OnValidate().
// At this time we copy the settings to those effectively used
m_defaultEffectiveFrameSettings = defaultFrameSettings.deepCopy();
}
}
}

30
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoopSettings.cs


public class LightLoopSettings
{
// Setup by the users
public bool enableTileAndCluster;
public bool enableComputeLightEvaluation;
public bool enableComputeLightVariants;
public bool enableComputeMaterialVariants;
public bool enableTileAndCluster = true;
public bool enableComputeLightEvaluation = true;
public bool enableComputeLightVariants = true;
public bool enableComputeMaterialVariants = true;
public bool enableFptlForForwardOpaque;
public bool enableBigTilePrepass;
public bool enableFptlForForwardOpaque = true;
public bool enableBigTilePrepass = true;
public bool isFptlEnabled;
public bool isFptlEnabled = true;
public LightLoopSettings()
public void CopyTo(LightLoopSettings lightLoopSettings)
enableTileAndCluster = true;
enableComputeLightEvaluation = true;
enableComputeLightVariants = true;
enableComputeMaterialVariants = true;
lightLoopSettings.enableTileAndCluster = this.enableTileAndCluster;
lightLoopSettings.enableComputeLightEvaluation = this.enableComputeLightEvaluation;
lightLoopSettings.enableComputeLightVariants = this.enableComputeLightVariants;
lightLoopSettings.enableComputeMaterialVariants = this.enableComputeMaterialVariants;
enableFptlForForwardOpaque = true;
enableBigTilePrepass = true;
lightLoopSettings.enableFptlForForwardOpaque = this.enableFptlForForwardOpaque;
lightLoopSettings.enableBigTilePrepass = this.enableBigTilePrepass;
isFptlEnabled = true;
lightLoopSettings.isFptlEnabled = this.isFptlEnabled;
}
// aggregateFrameSettings already contain the aggregation of RenderPipelineSettings and FrameSettings (regular and/or debug)

40
ScriptableRenderPipeline/HDRenderPipeline/RenderPipeline/FrameSettings.cs


public bool enableDistortion = true;
public bool enablePostprocess = true;
public bool enableStereo = false;
public bool enableAsyncCompute = false;

public LightingSettings lightingSettings = new LightingSettings();
public RenderSettings renderSettings = new RenderSettings();
public LightLoopSettings lightLoopSettings = new LightLoopSettings();
public void CopyTo(FrameSettings frameSettings)
{
frameSettings.lightingSettings.enableShadow = this.lightingSettings.enableShadow;
frameSettings.lightingSettings.enableSSR = this.lightingSettings.enableSSR;
frameSettings.lightingSettings.enableSSAO = this.lightingSettings.enableSSAO;
frameSettings.lightingSettings.enableSSSAndTransmission = this.lightingSettings.enableSSSAndTransmission;
frameSettings.lightingSettings.diffuseGlobalDimmer = this.lightingSettings.diffuseGlobalDimmer;
frameSettings.lightingSettings.specularGlobalDimmer = this.lightingSettings.specularGlobalDimmer;
frameSettings.renderSettings.enableForwardRenderingOnly = this.renderSettings.enableForwardRenderingOnly;
frameSettings.renderSettings.enableDepthPrepassWithDeferredRendering = this.renderSettings.enableDepthPrepassWithDeferredRendering;
frameSettings.renderSettings.enableAlphaTestOnlyInDeferredPrepass = this.renderSettings.enableAlphaTestOnlyInDeferredPrepass;
frameSettings.renderSettings.enableTransparentPrePass = this.renderSettings.enableTransparentPrePass;
frameSettings.renderSettings.enableMotionVectors = this.renderSettings.enableMotionVectors;
frameSettings.renderSettings.enableDBuffer = this.renderSettings.enableDBuffer;
frameSettings.renderSettings.enableAtmosphericScattering = this.renderSettings.enableAtmosphericScattering;
frameSettings.renderSettings.enableRoughRefraction = this.renderSettings.enableRoughRefraction;
frameSettings.renderSettings.enableTransparentPostPass = this.renderSettings.enableTransparentPostPass;
frameSettings.renderSettings.enableDistortion = this.renderSettings.enableDistortion;
frameSettings.renderSettings.enablePostprocess = this.renderSettings.enablePostprocess;
frameSettings.renderSettings.enableStereo = this.renderSettings.enableStereo;
frameSettings.renderSettings.enableForwardRenderingOnly = this.renderSettings.enableForwardRenderingOnly;
frameSettings.renderSettings.enableOpaqueObjects = this.renderSettings.enableOpaqueObjects;
frameSettings.renderSettings.enableTransparentObjects = this.renderSettings.enableTransparentObjects;
frameSettings.renderSettings.enableAsyncCompute = this.renderSettings.enableAsyncCompute;
frameSettings.renderSettings.enableMSAA = this.renderSettings.enableMSAA;
frameSettings.renderSettings.enableMaterialDisplayDebug = this.renderSettings.enableMaterialDisplayDebug;
frameSettings.renderSettings.enableShadowMask = this.renderSettings.enableShadowMask;
this.lightLoopSettings.CopyTo(frameSettings.lightLoopSettings);
}
// Init a FrameSettings from renderpipeline settings, frame settings and debug settings (if any)
// This will aggregate the various option

1
ScriptableRenderPipeline/HDRenderPipeline/Sky/AtmosphericScattering/AtmosphericScattering.cs


cmd.SetGlobalFloat(m_TypeParam, (float)type);
else
cmd.SetGlobalFloat(m_TypeParam, (float)FogType.None);
// Fog Color
cmd.SetGlobalFloat(m_ColorModeParam, (float)colorMode);
cmd.SetGlobalColor(m_FogColorParam, fogColor);

正在加载...
取消
保存