浏览代码

Add comment

/main
sebastienlagarde 7 年前
当前提交
ed1cd58c
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 4
      ScriptableRenderPipeline/Core/ShaderLibrary/CommonLighting.hlsl
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl

4
ScriptableRenderPipeline/Core/ShaderLibrary/CommonLighting.hlsl


}
// Ref: Moving Frostbite to PBR - Gotanda siggraph 2011
float GetSpecularOcclusion(float NdotV, float ambientOcclusion, float roughness)
// Return specular occlusion based on ambient occlusion (usually get from SSAO) and view/roughness info
float SpecularOcclusionFromAmbientOcclusion(float NdotV, float ambientOcclusion, float roughness)
// Update ambient occlusion to colored ambient occlusion based on statitics of how light is bouncing in an object and with the albedo of the object
float3 GTAOMultiBounce(float visibility, float3 albedo)
{
float3 a = 2.0404 * albedo - 0.3324;

2
ScriptableRenderPipeline/HDRenderPipeline/Material/Lit/Lit.hlsl


// Add indirect diffuse + emissive (if any) - Ambient occlusion is multiply by emissive which is wrong but not a big deal
bakeDiffuseLighting *= GTAOMultiBounce(lightLoopContext.indirectAmbientOcclusion, bsdfData.diffuseColor);
float specularOcclusion = GetSpecularOcclusion(preLightData.NdotV, lightLoopContext.indirectAmbientOcclusion, bsdfData.roughness);
float specularOcclusion = GetSpecularOcclusionFromAmbientOcclusion(preLightData.NdotV, lightLoopContext.indirectAmbientOcclusion, bsdfData.roughness);
// Try to mimic multibounce with specular color. Not the point of the original formula but ok result.
accLighting.envSpecularLighting *= bsdfData.specularOcclusion * GTAOMultiBounce(specularOcclusion, bsdfData.fresnel0);

正在加载...
取消
保存