浏览代码
Merge pull request #1222 from Unity-Technologies/Share-GetPreIntegratedFGD-function
Merge pull request #1222 from Unity-Technologies/Share-GetPreIntegratedFGD-function
Share GetPreIntegratedFGD/main
GitHub
7 年前
当前提交
4a8c5ab6
共有 3 个文件被更改,包括 51 次插入 和 29 次删除
-
24ScriptableRenderPipeline/Core/CoreRP/ShaderLibrary/BSDF.hlsl
-
34ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/Lit/Lit.hlsl
-
22ScriptableRenderPipeline/HDRenderPipeline/HDRP/Material/PreIntegratedFGD/PreIntegratedFGD.hlsl
|
|||
TEXTURE2D(_PreIntegratedFGD); |
|||
|
|||
// For image based lighting, a part of the BSDF is pre-integrated. |
|||
// This is done both for specular GGX height-correlated and DisneyDiffuse |
|||
// reflectivity is Integral{(BSDF_GGX / F) - use for multiscattering |
|||
void GetPreIntegratedFGDGGXAndDisneyDiffuse(float NdotV, float perceptualRoughness, float3 fresnel0, out float3 GGXSpecularFGD, out float disneyDiffuseFGD, out float reflectivity) |
|||
{ |
|||
float3 preFGD = SAMPLE_TEXTURE2D_LOD(_PreIntegratedFGD, s_linear_clamp_sampler, float2(NdotV, perceptualRoughness), 0).xyz; |
|||
|
|||
// Pre-integrate GGX FGD |
|||
// Integral{BSDF * <N,L> dw} = |
|||
// Integral{(F0 + (1 - F0) * (1 - <V,H>)^5) * (BSDF / F) * <N,L> dw} = |
|||
// (1 - F0) * Integral{(1 - <V,H>)^5 * (BSDF / F) * <N,L> dw} + F0 * Integral{(BSDF / F) * <N,L> dw}= |
|||
// (1 - F0) * x + F0 * y = lerp(x, y, F0) |
|||
GGXSpecularFGD = lerp(preFGD.xxx, preFGD.yyy, fresnel0); |
|||
|
|||
// Pre integrate DisneyDiffuse FGD: |
|||
// z = DisneyDiffuse |
|||
// Remap from the [0, 1] to the [0.5, 1.5] range. |
|||
disneyDiffuseFGD = preFGD.z + 0.5; |
|||
|
|||
reflectivity = preFGD.y; |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue