浏览代码

HDRenderPipeline: Fix EOL and shader compil issue for AO

/Branch_Batching2
Sebastien Lagarde 7 年前
当前提交
d42c60fe
共有 8 个文件被更改,包括 8 次插入42 次删除
  1. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/CommonAmbientOcclusion.hlsl
  2. 4
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Composition.hlsl
  3. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Denoising.hlsl
  4. 2
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Estimation.hlsl
  5. 4
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl
  6. 2
      Assets/ScriptableRenderPipeline/ShaderLibrary/CommonLighting.hlsl
  7. 25
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassProducer.asset
  8. 9
      Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassProducer.asset.meta

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/CommonAmbientOcclusion.hlsl


float SampleDepth(uint2 unPositionSS)
{
float z = LOAD_TEXTURE2D(_CameraDepthTexture, unPositionSS).x;
return LinearEyeDepth(z, _ZBufferParams) + CheckBounds(uv, z); // TODO: We should use the stencil to not affect the sky and save CheckBounds cost
return LinearEyeDepth(z, _ZBufferParams) + CheckBounds(float2(0.5, 0.5), z); // TODO: We should use the stencil to not affect the sky and save CheckBounds cost - also uv can't be out of bounds on xy... so put a constant here
}
half3 SampleNormal(BSDFData bsdfData)

4
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Composition.hlsl


SAMPLER2D(sampler_MainTex);
float4 _MainTex_TexelSize;
half4 Frag(Varyings input)
half4 Frag(Varyings input) : SV_Target0
float uv = posInput.positionSS;
float2 uv = posInput.positionSS;
float2 delta = _MainTex_TexelSize.xy / _Downsample; // TODO: is it correct, we have already bilateral upsample here ?

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Denoising.hlsl


{
// input.positionCS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw);
float uv = posInput.positionSS;
float2 uv = posInput.positionSS;
#if defined(AO_DENOISE_HORIZONTAL)

2
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/AmbientOcclusion/Resources/Estimation.hlsl


{
// input.positionCS is SV_Position
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw);
float uv = posInput.positionSS;
float2 uv = posInput.positionSS;
half3 unused;
BSDFData bsdfData;

4
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassLoop.hlsl


{
LightLoopContext context;
#ifdef APPLY_AMBIENT_OCCLUSION
context.ambientOcclusion = LOAD_TEXTURE2D(_AmbientOcclusionTexture, unPositionSS).x;
context.ambientOcclusion = LOAD_TEXTURE2D(_AmbientOcclusionTexture, posInput.unPositionSS).x;
#else
context.ambientOcclusion = 1.0;
#endif

{
LightLoopContext context;
#ifdef APPLY_AMBIENT_OCCLUSION
context.ambientOcclusion = LOAD_TEXTURE2D(_AmbientOcclusionTexture, unPositionSS).x;
context.ambientOcclusion = LOAD_TEXTURE2D(_AmbientOcclusionTexture, posInput.unPositionSS).x;
#else
context.ambientOcclusion = 1.0;
#endif

2
Assets/ScriptableRenderPipeline/ShaderLibrary/CommonLighting.hlsl


// Ref: Moving Frostbite to PBR - Gotanda siggraph 2011
float GetSpecularOcclusion(float NdotV, float ambientOcclusion, float roughness)
{
return saturate(pow(NdotV + ambientOcclusion, exp2(-16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);
return saturate(PositivePow(NdotV + ambientOcclusion, exp2(-16.0 * roughness - 1.0)) - 1.0 + ambientOcclusion);
}
//-----------------------------------------------------------------------------

25
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassProducer.asset


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 31c50a63970c0c843ab7cbf7d67d5b33, type: 3}
m_Name: TilePassProducer
m_EditorClassIdentifier:
m_TileSettings:
enableTileAndCluster: 1
enableSplitLightEvaluation: 1
enableComputeLightEvaluation: 0
enableComputeFeatureVariants: 1
enableClustered: 1
enableFptlForOpaqueWhenClustered: 1
enableBigTilePrepass: 1
diffuseGlobalDimmer: 1
specularGlobalDimmer: 1
tileDebugByCategory: 0
m_PassResources: {fileID: 11400000, guid: 42086e81f4f0c724f96f7f09cc995354, type: 2}

9
Assets/ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/TilePassProducer.asset.meta


fileFormatVersion: 2
guid: bf8cd9ae03ff7d54c89603e67be0bfc5
timeCreated: 1486997442
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存