Cycles: Fix for transmissive microfacet sampling
This is an alternate fix for T40964 which resolves bad handling of caustics reported in T45609. There were too much transmission rays being discarded by the original fix, which caused by caustic light being totally disabled. There is still some room for investigation why exactly original paper didn't work that well, could be caused by the way how the pdf is calculated. In any case current results seems rather correct now.
This commit is contained in:
parent
55fead4767
commit
12b7850d4f
Notes:
blender-bot
2023-02-14 08:49:50 +01:00
Referenced by issue #45641, VSE MetaStrip cut crash Referenced by issue #45609, The "Filter Glossy" option is broken, makes refractive caustics harder to sample rather than easier.
|
@ -382,10 +382,6 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
|
|||
float cosHO = dot(Ht, I);
|
||||
float cosHI = dot(Ht, omega_in);
|
||||
|
||||
/* those situations makes chi+ terms in eq. 33, 34 be zero */
|
||||
if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
float D, G1o, G1i;
|
||||
|
||||
/* eq. 33: first we calculate D(m) with m=Ht: */
|
||||
|
@ -412,7 +408,7 @@ ccl_device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, con
|
|||
* pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */
|
||||
float common = D * (m_eta * m_eta) / (cosNO * Ht2);
|
||||
float out = G * fabsf(cosHI * cosHO) * common;
|
||||
*pdf = G1o * cosHO * fabsf(cosHI) * common;
|
||||
*pdf = G1o * fabsf(cosHO * cosHI) * common;
|
||||
|
||||
return make_float3(out, out, out);
|
||||
}
|
||||
|
@ -735,10 +731,6 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
|
|||
float cosHO = dot(Ht, I);
|
||||
float cosHI = dot(Ht, omega_in);
|
||||
|
||||
/* those situations makes chi+ terms in eq. 25, 27 be zero */
|
||||
if(dot(Ht, N) <= 0.0f || cosHO * cosNO <= 0.0f || cosHI * cosNI <= 0.0f)
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
/* eq. 25: first we calculate D(m) with m=Ht: */
|
||||
float alpha2 = alpha_x * alpha_y;
|
||||
float cosThetaM = min(dot(N, Ht), 1.0f);
|
||||
|
@ -764,7 +756,7 @@ ccl_device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc
|
|||
* pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2 */
|
||||
float common = D * (m_eta * m_eta) / (cosNO * Ht2);
|
||||
float out = G * fabsf(cosHI * cosHO) * common;
|
||||
*pdf = G1o * cosHO * fabsf(cosHI) * common;
|
||||
*pdf = G1o * fabsf(cosHO * cosHI) * common;
|
||||
|
||||
return make_float3(out, out, out);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue