浏览代码

Updated MyLWRenderer to newest SRP commit (not working 100%)

/main
Andre McGrail 7 年前
当前提交
b5f3c4b4
共有 3 个文件被更改,包括 51 次插入12 次删除
  1. 57
      Assets/Scripts/Rendering/MyLWRenderer.cs
  2. 4
      Assets/Scripts/Rendering/WaterFXPass.cs
  3. 2
      ProjectSettings/ProjectVersion.txt

57
Assets/Scripts/Rendering/MyLWRenderer.cs


private FinalBlitPass m_FinalBlitPass;
private EndXRRenderingPass m_EndXrRenderingPass;
#if UNITY_EDITOR
private SceneViewDepthCopyPass m_SceneViewDepthCopyPass;
#endif
public RenderTargetHandle Color;
public RenderTargetHandle DepthAttachment;
public RenderTargetHandle DepthTexture;
public RenderTargetHandle OpaqueColor;
public RenderTargetHandle DirectionalShadowmap;
public RenderTargetHandle LocalShadowmap;
public RenderTargetHandle ScreenSpaceShadowmap;
[NonSerialized]
private bool m_Initialized = false;

m_TransparentPostProcessPass = new TransparentPostProcessPass(renderer);
m_FinalBlitPass = new FinalBlitPass(renderer);
m_EndXrRenderingPass = new EndXRRenderingPass(renderer);
m_WaterFXPass = new WaterFXPass(renderer);
m_WaterFXPass = new WaterFXPass(renderer);
#if UNITY_EDITOR
m_SceneViewDepthCopyPass = new SceneViewDepthCopyPass(renderer);
#endif
// RenderTexture format depends on camera and pipeline (HDR, non HDR, etc)
// Samples (MSAA) depend on camera and pipeline
renderer.RegisterSurface("_CameraColorTexture", out Color);
renderer.RegisterSurface("_CameraDepthAttachment", out DepthAttachment);
renderer.RegisterSurface("_CameraDepthTexture", out DepthTexture);
renderer.RegisterSurface("_CameraOpaqueTexture", out OpaqueColor);
renderer.RegisterSurface("_DirectionalShadowmapTexture", out DirectionalShadowmap);
renderer.RegisterSurface("_LocalShadowmapTexture", out LocalShadowmap);
renderer.RegisterSurface("_ScreenSpaceShadowMapTexture", out ScreenSpaceShadowmap);
m_Initialized = true;
}

requiresDepthPrepass |= renderingData.cameraData.isStereoEnabled;
if (renderingData.shadowData.renderDirectionalShadows)
{
m_DirectionalShadowPass.Setup(DirectionalShadowmap);
}
{
m_LocalShadowPass.Setup(LocalShadowmap);
}
m_DepthOnlyPass.Setup(baseDescriptor, RenderTargetHandles.DepthTexture, SampleCount.One);
m_DepthOnlyPass.Setup(baseDescriptor, DepthTexture, SampleCount.One);
renderer.EnqueuePass(m_DepthOnlyPass);
}

m_ScreenSpaceShadowResovePass.Setup(baseDescriptor, RenderTargetHandles.ScreenSpaceShadowmap);
m_ScreenSpaceShadowResovePass.Setup(baseDescriptor, ScreenSpaceShadowmap);
renderer.EnqueuePass(m_ScreenSpaceShadowResovePass);
}

ref renderingData.cameraData,
baseDescriptor,
requiresDepthAttachment);
RenderTargetHandle colorHandle = (requiresColorAttachment) ? RenderTargetHandles.Color : RenderTargetHandle.BackBuffer;
RenderTargetHandle depthHandle = (requiresDepthAttachment) ? RenderTargetHandles.DepthAttachment : RenderTargetHandle.BackBuffer;
RenderTargetHandle colorHandle = (requiresColorAttachment) ? Color : RenderTargetHandle.BackBuffer;
RenderTargetHandle depthHandle = (requiresDepthAttachment) ? DepthAttachment : RenderTargetHandle.BackBuffer;
var sampleCount = (SampleCount)renderingData.cameraData.msaaSamples;
m_CreateLightweightRenderTexturesPass.Setup(baseDescriptor, colorHandle, depthHandle, sampleCount);

renderer.EnqueuePass(m_BeginXrRenderingPass);
renderer.EnqueuePass(m_WaterFXPass);
Camera camera = renderingData.cameraData.camera;
bool dynamicBatching = renderingData.supportsDynamicBatching;

//renderer.EnqueuePass(m_WaterFXPass);
m_RenderOpaqueForwardPass.Setup(baseDescriptor, colorHandle, depthHandle, LightweightForwardRenderer.GetCameraClearFlag(camera), camera.backgroundColor, rendererConfiguration, dynamicBatching);
renderer.EnqueuePass(m_RenderOpaqueForwardPass);

if (depthHandle != RenderTargetHandle.BackBuffer)
{
m_CopyDepthPass.Setup(depthHandle);
m_CopyDepthPass.Setup(depthHandle, DepthTexture);
m_CopyColorPass.Setup(colorHandle);
m_CopyColorPass.Setup(colorHandle, OpaqueColor);
renderer.EnqueuePass(m_CopyColorPass);
}

{
renderer.EnqueuePass(m_EndXrRenderingPass);
}
#if UNITY_EDITOR
if (renderingData.cameraData.isSceneViewCamera)
{
m_SceneViewDepthCopyPass.Setup(DepthTexture);
renderer.EnqueuePass(m_SceneViewDepthCopyPass);
}
#endif
}
}
}

4
Assets/Scripts/Rendering/WaterFXPass.cs


CommandBuffer cmd = CommandBufferPool.Get(k_RenderWaterFXTag);
RenderTextureDescriptor descriptor = renderer.CreateRTDesc(ref renderingData.cameraData);
descriptor.width = (int)(descriptor.width * 0.5f);
descriptor.height = (int)(descriptor.height * 0.5f);
//descriptor.width = (int)(descriptor.width * 0.5f);
//descriptor.height = (int)(descriptor.height * 0.5f);
using (new ProfilingSample(cmd, k_RenderWaterFXTag))
{

2
ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2018.2.0b11
m_EditorVersion: 2018.2.0f1
正在加载...
取消
保存