浏览代码

Address feedback

/main
sebastienlagarde 7 年前
当前提交
f3d7f5bf
共有 7 个文件被更改,包括 19 次插入14 次删除
  1. 6
      ImageTemplates/LightweightPipeline/Scenes/007_LitShaderMaps.unity.png.meta
  2. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs
  3. 10
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs
  4. 4
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/materialflags.compute
  5. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CopyStencilBuffer.shader
  6. 1
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.compute
  7. 6
      ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs

6
ImageTemplates/LightweightPipeline/Scenes/007_LitShaderMaps.unity.png.meta


sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:

4
ScriptableRenderPipeline/HDRenderPipeline/HDRenderPipeline.cs


CommandBufferPool.Release(cmd);
cmd = CommandBufferPool.Get("");
buildGPULightListsCompleteFence = m_LightLoop.BuildGPULightListsAsyncBegin(camera, renderContext, m_CameraDepthStencilBufferRT, GetStencilTexture(), startFence);
buildGPULightListsCompleteFence = m_LightLoop.BuildGPULightListsAsyncBegin(camera, renderContext, m_CameraDepthStencilBufferRT, m_CameraStencilBufferCopyRT, startFence);
}
using (new ProfilingSample(cmd, "Render shadows", GetSampler(CustomSamplerId.RenderShadows)))

{
using (new ProfilingSample(cmd, "Build Light list", GetSampler(CustomSamplerId.BuildLightList)))
{
m_LightLoop.BuildGPULightLists(camera, cmd, m_CameraDepthStencilBufferRT, GetStencilTexture());
m_LightLoop.BuildGPULightLists(camera, cmd, m_CameraDepthStencilBufferRT, m_CameraStencilBufferCopyRT);
}
}

10
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/LightLoop.cs


using UnityEngine.Rendering;
using UnityEngine.Rendering;
using System.Collections.Generic;
using System;

}
public void Build( RenderPipelineResources renderPipelineResources,
LightLoopSettings tileSettings,
LightLoopSettings lightLoopSettings,
m_LightLoopSettings = tileSettings;
m_LightLoopSettings = lightLoopSettings;
m_lightList = new LightList();
m_lightList.Allocate();

// If Deferred, enable Fptl. If we are forward renderer only and not using Fptl for forward opaque, disable Fptl
m_isForwardRenderingOnly = useForwardRenderingOnly;
m_isFptlEnabled = !m_isForwardRenderingOnly || tileSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
m_isFptlEnabledForForwardOpaque = tileSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
m_isFptlEnabled = !m_isForwardRenderingOnly || m_LightLoopSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
m_isFptlEnabledForForwardOpaque = m_LightLoopSettings.enableFptlForForwardOpaque; // TODO: Disable if MSAA
if (GetFeatureVariantsEnabled())
{

4
ScriptableRenderPipeline/HDRenderPipeline/Lighting/LightLoop/materialflags.compute


int idx = i * NR_THREADS + threadID;
uint2 uCrd = min( uint2(viTilLL.x + (idx & 0xf), viTilLL.y + (idx >> 4)), uint2(iWidth - 1, iHeight - 1));
if (LOAD_TEXTURE2D(_StencilTexture, uCrd).r == 1.0) // This test if we are the sky/background or a forward opaque (i.e we don't require lighting)
// StencilTexture here contain the result of testing if we are not equal to stencil usage NoLighting. i.e (stencil value != NoLighting). The 1.0 mean true.
// This test if we are the sky/background or a forward opaque (which tag the stencil as NoLighting)
if (LOAD_TEXTURE2D(_StencilTexture, uCrd).r == 1.0)
{
PositionInputs posInput = GetPositionInput(uCrd, invScreenSize);
materialFeatureFlags |= MATERIAL_FEATURE_FLAGS_FROM_GBUFFER(posInput.positionSS);

2
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/CopyStencilBuffer.shader


[earlydepthstencil]
float4 Frag(Varyings input) : SV_Target // use SV_StencilRef in D3D 11.3+
{
return float4(1.0, 0.0, 0.0, 0.0);
return float4(1.0, 0.0, 0.0, 0.0); // 1.0 for true as it passes the condition
}
ENDHLSL

1
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Resources/SubsurfaceScattering.compute


// TODO: Since we have moved to forward SSS, we don't support anymore a bsdfData.normalWS.
// Once we include normal+roughness rendering during the prepass, we will have a buffer to bind here and we will be able to reuse this part of the algorithm on demand.
#if SSS_USE_TANGENT_PLANE
#error ThisWillNotCompile_SeeComment
// Compute the tangent frame in view space.
float3 normalVS = mul((float3x3)viewMatrix, bsdfData.normalWS);
float3 tangentX = GetLocalFrame(normalVS)[0] * unitsPerMm;

6
ScriptableRenderPipeline/HDRenderPipeline/Material/SubsurfaceScattering/SubsurfaceScatteringManager.cs


readonly int m_SSSBuffer0;
readonly RenderTargetIdentifier m_SSSBuffer0RT;
public int sssBufferCount { get; set; }
public int sssBufferCount { get { return k_MaxSSSBuffer; } }
RenderTargetIdentifier[] m_ColorMRTs;
RenderTargetIdentifier[] m_RTIDs = new RenderTargetIdentifier[k_MaxSSSBuffer];

// for SSS
public void InitGBuffers(int width, int height, GBufferManager gbufferManager, CommandBuffer cmd)
{
sssBufferCount = k_MaxSSSBuffer;
m_RTIDs[0] = gbufferManager.GetGBuffers()[0];
}

{
sssBufferCount = k_MaxSSSBuffer;
m_RTIDs[0] = m_SSSBuffer0RT;
cmd.ReleaseTemporaryRT(m_SSSBuffer0);

正在加载...
取消
保存