浏览代码

Merge pull request #527 from EvgeniiG/Unity-2017.3

Fix small issues with the Disney Diffuse BRDF
/Add-support-for-light-specular-color-tint
GitHub 7 年前
当前提交
d4f061ad
共有 5 个文件被更改,包括 10 次插入1007 次删除
  1. 8
      ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl
  2. 1
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.cs
  3. 5
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl
  4. 5
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitReference.hlsl
  5. 998
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LtcData.DisneyDiffuse.cs

8
ScriptableRenderPipeline/Core/ShaderLibrary/ImageBasedLighting.hlsl


}
}
// Remap from [0, 1.5] to [0, 1] range.
acc.z /= 1.5;
acc /= sampleCount;
return acc / sampleCount;
// Remap from the [0.5, 1.5] to the [0, 1] range.
acc.z -= 0.5;
return acc;
}
uint GetIBLRuntimeFilterSampleCount(uint mipLevel)

1
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.ARGB2101010, RenderTextureReadWrite.Linear);
m_PreIntegratedFGD.filterMode = FilterMode.Bilinear;
m_PreIntegratedFGD.wrapMode = TextureWrapMode.Clamp;

5
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


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

// envDiffuseLighting is used for refraction in this Lit material. Use the weight to balance between transmission and reflection
diffuseLighting = lerp(directDiffuseLighting + bakeDiffuseLighting, accLighting.envDiffuseLighting, accLighting.envDiffuseLightingWeight);
specularLighting = accLighting.dirSpecularLighting + accLighting.punctualSpecularLighting + accLighting.areaSpecularLighting + accLighting.envSpecularLighting;
// Rescale the GGX to account for the multiple scattering.
specularLighting *= 1 + bsdfData.fresnel0 * preLightData.energyCompensation;
#ifdef DEBUG_DISPLAY

5
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LitReference.hlsl


if (NdotL > 0.0)
{
float3 H = normalize(L + V);
float LdotH = dot(L, H);
float LdotV = dot(L, V);
float disneyDiffuse = DisneyDiffuse(NdotV, NdotL, LdotH, bsdfData.perceptualRoughness);
float disneyDiffuse = DisneyDiffuse(NdotV, NdotL, LdotV, bsdfData.perceptualRoughness);
// diffuse Albedo is apply here as describe in ImportanceSampleLambert function
float4 val = SampleEnv(lightLoopContext, lightData.envIndex, L, 0);

998
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/LtcData.DisneyDiffuse.cs
文件差异内容过多而无法显示
查看文件

正在加载...
取消
保存