sebastienlagarde
7 年前
当前提交
b2780d61
共有 6 个文件被更改,包括 81 次插入 和 46 次删除
-
32ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
-
22ScriptableRenderPipeline/HDRenderPipeline/HDStringConstants.cs
-
2ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs.meta
-
51ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs
-
20ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScattering.cs
-
0/ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs.meta
|
|||
using UnityEngine.Rendering; |
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class SubsurfaceScatteringManager |
|||
{ |
|||
// Currently we only support SSSBuffer with one buffer. If the shader code change, it may require to update the shader manager
|
|||
public const int k_MaxSSSBuffer = 1; |
|||
|
|||
readonly int m_SSSBuffer0; |
|||
readonly RenderTargetIdentifier m_SSSBuffer0RT; |
|||
|
|||
public int sssBufferCount { get; set; } |
|||
|
|||
RenderTargetIdentifier[] m_ColorMRTs; |
|||
RenderTargetIdentifier[] m_RTIDs = new RenderTargetIdentifier[k_MaxSSSBuffer]; |
|||
|
|||
public SubsurfaceScatteringManager() |
|||
{ |
|||
m_SSSBuffer0RT = new RenderTargetIdentifier(m_SSSBuffer0); |
|||
} |
|||
|
|||
// In case of deferred, we must be in sync with SubsurfaceScattering.hlsl and lit.hlsl files and setup the correct buffers
|
|||
// for SSS
|
|||
public void InitGBuffers(int width, int height, GBufferManager gbufferManager, CommandBuffer cmd) |
|||
{ |
|||
sssBufferCount = k_MaxSSSBuffer; |
|||
|
|||
m_RTIDs[0] = gbufferManager.GetGBuffers()[0]; |
|||
} |
|||
|
|||
// In case of full forward we must allocate the render target for forward SSS (or reuse one already existing)
|
|||
// TODO: Provide a way to reuse a render target
|
|||
public void InitGBuffers(int width, int height, CommandBuffer cmd) |
|||
{ |
|||
sssBufferCount = k_MaxSSSBuffer; |
|||
|
|||
m_RTIDs[0] = m_SSSBuffer0RT; |
|||
|
|||
cmd.ReleaseTemporaryRT(m_SSSBuffer0); |
|||
cmd.GetTemporaryRT(m_SSSBuffer0, width, height, 0, FilterMode.Point, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); |
|||
} |
|||
|
|||
public RenderTargetIdentifier GetSSSBuffers(int index) |
|||
{ |
|||
Debug.Assert(index < sssBufferCount); |
|||
return m_RTIDs[index]; |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine.Rendering; |
|||
using System; |
|||
|
|||
namespace UnityEngine.Experimental.Rendering.HDPipeline |
|||
{ |
|||
public class SubsurfaceScatteringManager |
|||
{ |
|||
public const int k_MaxGbuffer = 2; |
|||
|
|||
public int sssbufferCount { get; set; } |
|||
|
|||
RenderTargetIdentifier[] m_ColorMRTs; |
|||
RenderTargetIdentifier[] m_RTIDs = new RenderTargetIdentifier[k_MaxGbuffer]; |
|||
|
|||
|
|||
// public RenderTargetIdentifier SSSBuffer[2];
|
|||
|
|||
// public SetSSSBuffer();
|
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue