虛幻引擎公式推導中的重要性採樣(輻照度項)


3

我目前正在嘗試了解虛幻引擎中的IBL,關於該公式有很多事情我不了解。虛幻通過進行分割和近似來近似陰影方程的鏡面反射項。

enter image description here

這是虛幻如何對鏡面照度項的環境貼圖進行預過濾。

float3 PrefilterEnvMap(float Roughness, float3 R )
{
    float3 N = R;
    float3 V = R;
    float3 PrefilteredColor = 0;
    const uint NumSamples = 1024;
    for(uint i = 0; i < NumSamples; i++ )
    {
        float2 Xi = Hammersley( i, NumSamples );
        float3 H = ImportanceSampleGGX( Xi, Roughness, N );
        float3 L = 2 * dot  ( V, H ) * H - V;
        float NoL =saturate( dot  ( N, L ) );
        if ( NoL > 0 )
        {
            PrefilteredColor += EnvMap.SampleLevel( EnvMapSampler, L, 0 ).rgb * NoL;
            TotalWeight += NoL;
        }
    }
    return PrefilteredColor / TotalWeight;
}

我的問題是為什麼總重量是飽和的總和(點(N,L))。我對重要性抽樣的理解是,我們應該將抽樣與用於抽樣的pdf分開。在這種情況下,根據我在here上看到的內容,pdf應該是

$$ p_i(wm,wo)= \ frac {D(wm)(wm \ cdot wg)} {4 | wo \ cdot wm |} $$

我在虛幻引擎中的pbr參考是herehere

3

I just read notes on moving frostbite to pbr and I found the derivation of the method above. So I will just show the derivation here and quote some of the explanation.

enter image description here

One can notice an extra〈n·l〉in the LD term as well as a different weighting 1/(∑Ni〈n·l〉). These empirical terms have been introduce by Karis to allows to improve the reconstructed lighting integral which suffers from coarse hypothesis of separability of this integral. There is no mathematical derivation for these terms, goal was to have an exact match with a constant L(l).

So it turns out the pdf is weighted on the DFG term. As for dot(N,l), the term is introduced to minimize the error that is caused by split sum approximation. But I am actually still wondering what is the intuition on that empirical term.