浏览代码

Improve the quality of the FDG texture

/Add-support-for-light-specular-color-tint
Evgenii Golubev 7 年前
当前提交
531047c5
共有 3 个文件被更改,包括 7 次插入3 次删除
  1. 5
      ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs
  3. 3
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

5
ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl


// ----------------------------------------------------------------------------
// Ref: Listing 18 in "Moving Frostbite to PBR" + https://knarkowicz.wordpress.com/2014/12/27/analytical-dfg-term-for-ibl/
float4 IntegrateGGXAndDisneyFGD(float3 V, float3 N, float roughness, uint sampleCount = 4096)
float4 IntegrateGGXAndDisneyFGD(float3 V, float3 N, float roughness, uint sampleCount = 8192)
{
float NdotV = saturate(dot(N, V));
float4 acc = float4(0.0, 0.0, 0.0, 0.0);

acc.z += disneyDiffuse * weightOverPdf;
}
}
// Remap from [0, 1.5] to [0, 1] range.
acc.z /= 1.5;
return acc / sampleCount;
}

2
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs


m_InitPreFGD = CoreUtils.CreateEngineMaterial("Hidden/HDRenderPipeline/PreIntegratedFGD");
// For DisneyDiffuse integration values goes from (0.5 to 1.53125). GGX need 0 to 1. Use float format.
m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.RGB111110Float, RenderTextureReadWrite.Linear);
m_PreIntegratedFGD = new RenderTexture(128, 128, 0, RenderTextureFormat.ARGB2101010, RenderTextureReadWrite.Linear);
m_PreIntegratedFGD.filterMode = FilterMode.Bilinear;
m_PreIntegratedFGD.wrapMode = TextureWrapMode.Clamp;
m_PreIntegratedFGD.hideFlags = HideFlags.DontSave;

3
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


#ifdef LIT_DIFFUSE_LAMBERT_BRDF
diffuseFGD = 1.0;
#else
diffuseFGD = preFGD.z;
// Remap from [0, 1] to [0, 1.5] range.
diffuseFGD = 1.5 * preFGD.z;
#endif
reflectivity = preFGD.y;

正在加载...
取消
保存