浏览代码

Fixed SSAO on DX11

/projects-TheLastStand
John 7 年前
当前提交
f55cbac8
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 16
      ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs

16
ScriptableRenderPipeline/LightweightPipeline/LWRP/LightweightPipeline.cs


private RenderTargetIdentifier m_CurrCameraColorRT;
private RenderTargetIdentifier m_ShadowMapRT;
private RenderTargetIdentifier m_ScreenSpaceShadowMapRT;
private RenderTargetIdentifier m_AmbientOcclusionRT;
private RTHandle m_AmbientOcclusionBuffer;
private bool m_IntermediateTextureArray;
private bool m_RequireDepthTexture;

m_CopyDepth = new RenderTargetIdentifier(CameraRenderTargetID.depthCopy);
m_PostProcessRenderContext = new PostProcessRenderContext();
m_AmbientOcclusionRT = new RenderTargetIdentifier(PerCameraBuffer._AmbientOcclusionBuffer);
RTHandle.Initialize(Screen.width, Screen.height, false, (MSAASamples)m_Asset.MSAASampleCount);
m_AmbientOcclusionBuffer = RTHandle.Alloc(Vector2.one, filterMode: FilterMode.Bilinear, colorFormat: RenderTextureFormat.R8, sRGB: false, enableRandomWrite: true, name: "AmbientOcclusion");
m_CopyTextureSupport = SystemInfo.copyTextureSupport;

{
base.Dispose();
Shader.globalRenderPipeline = "";
RTHandle.Release(m_AmbientOcclusionBuffer);
SupportedRenderingFeatures.active = new SupportedRenderingFeatures();

var settings = postProcessLayer.GetSettings<AmbientOcclusion>();
if(settings.IsEnabledAndSupported(null))
{
cmd.GetTemporaryRT(PerCameraBuffer._AmbientOcclusionBuffer,
camera.pixelWidth, camera.pixelHeight, 0,
FilterMode.Bilinear, RenderTextureFormat.R8);
postProcessLayer.BakeMSVOMap(cmd, camera, m_AmbientOcclusionRT, m_DepthRT, true);
postProcessLayer.BakeMSVOMap(cmd, camera, m_AmbientOcclusionBuffer, m_DepthRT, true);
cmd.SetGlobalTexture(PerCameraBuffer._AmbientOcclusionBuffer, m_AmbientOcclusionRT);
cmd.SetGlobalTexture(PerCameraBuffer._AmbientOcclusionBuffer, m_AmbientOcclusionBuffer);
cmd.SetGlobalVector(PerCameraBuffer._AmbientOcclusionParam, new Vector4(settings.color.value.r,
settings.color.value.g,
settings.color.value.b,

正在加载...
取消
保存