You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Eta and `LdotX` is taken from the leaf BTDF node. With refractions from Dielectrics, we get just `1/LdotX`, for Delta Transmission we get `1/VdotN` since its the same
// Compute Inifinite Scatter and extinction between two parallel infinite planes.
647
+
//
648
648
// It's a specialization of what would be a layer of two identical smooth BRDF and BTDF with arbitrary Fresnel function and beer's
649
-
// extinction on the BRDFs (not BTDFs), all applied on a per micro-facet basis (layering per microfacet, not whole surface).
649
+
// extinction, all applied on a per micro-facet basis (layering per microfacet, not whole surface) so the NDFs of two layers would be correlated.
650
650
//
651
-
// We actually allow you to use different reflectance nodes R_u and R_b, the NDFs of both layers remain the same but Reflectance Functions to differ.
651
+
// We actually allow you to use different reflectance nodes R_u and R_b, the NDFs of both layers remain the same but Reflectance Functions differ.
652
652
// Note that e.g. using different Etas for the Fresnel used for the top and bottom reflectance will result in a compound Fresnel!=1.0
653
653
// meaning that in such case you can no longer optimize the BTDF contributor into a DeltaTransmission but need a CookTorrance with
654
654
// an Eta equal to the ratio of the first Eta over the second Eta (note that when they're equal the ratio is 1 which turns into Delta Trans).
655
-
//
655
+
// This will require you to make an AST that "seems wrong" that is where neither of the Etas of the CFresnel nodes match the Cook Torrance one.
656
+
//
656
657
// Because we split BRDF and BTDF into separate expressions, what this node computes differs depending on where it gets used:
658
+
// Note the transformation in the equations at the end just makes the prevention of 0/0 or 0*INF same as for a non-extinctive equation, just check `R_u*R_b < Threshold`
// Note the transformation at the end just makes the prevention of 0/0 or 0*INF same as for a non-extinctive equation, just check `R_u*R_b < Threshold`
672
+
// --------------------
673
+
// Bottom BRDF as multiplied with CThinInfiniteScatterCorrection node with `reflectanceTop`
674
+
// Null BRDF
675
+
// Delta Transmission Beer extinction
676
+
// Null BRDF
677
+
// Top BRDF as multiplied with CThinInfiniteScatterCorrection node but with `reflectanceBottom` (but corellated so you always hit the same microfacet leading to no refraction)
678
+
// ------------------
660
679
//
661
-
//Note: This node can be also used to model non-linear color shifts of Diffuse BRDF multiple scattering if one plugs in the albedo as the extinction.
680
+
//The obvious downside of using this node for transmission is that its impossible to get "milky" glass because a spread of refractions is needed
662
681
classCThinInfiniteScatterCorrectionfinal : public obj_pool_type::INonTrivial, public IExprNode
663
682
{
664
683
protected:
@@ -736,7 +755,7 @@ class CFrontendIR final : public CNodePool
736
755
// - Delta Reflection -> Any Cook Torrance BxDF with roughness=0 attached as BRDF
737
756
// - Smooth Conductor -> above multiplied with Conductor-Fresnel
738
757
// - Smooth Dielectric -> Any Cook Torrance BxDF with roughness=0 attached as BRDF on both sides of a Layer and BTDF multiplied with Dielectric-Fresnel (no imaginary component)
739
-
// - Thindielectric -> Any Cook Torrance BxDF multiplied with Dielectric-Fresnel .... TODO description ....
758
+
// - Thindielectric Correlated -> Any Cook Torrance BxDF multiplied with Dielectric-Fresnel, then Delta Transmission as BTDF with fresnels
740
759
// - Plastic -> Similar to layering the above over Diffuse BRDF, its of uttmost importance that the BTDF is Delta Transmission.
args.logger.log("Perpendicular Transparency node of correct type must be attached, but is %u of type %s",ELL_ERROR,perpTransmittance,args.pool->getTypeName(perpTransmittance).data());
33
33
returntrue;
34
34
}
35
+
if (constauto* const thick=args.pool->getObjectPool().deref(thickness); !thick || thick->getKnotCount()!=0)
36
+
{
37
+
args.logger.log("Monochromatic Thickness node must be attached, but is %u of type %s",ELL_ERROR,thickness,args.pool->getTypeName(thickness).data());
@@ -825,35 +816,29 @@ auto SContext::genMaterial(const CElementBSDF* bsdf, system::ISystem* debugFileW
825
816
mul->lhs = deltaTransmission._const_cast();
826
817
mul->rhs = thinInfiniteScatterH;
827
818
}
828
-
// we're rethreading the fresnel here
819
+
// We need to attach the other glass interface as another layer because the Etas need to be reciprocated because the interactions are flipped
820
+
leaf->coated = frontIR->reverse(retval);
821
+
// we're rethreading the fresnel here, but needed to be careful to not apply thindielectric scatter correction and volumetric absorption / Mitsuba extra factor twice
829
822
btdfH = correctedTransmissionH;
830
823
}
831
-
else// beautiful thing we can reuse the same BxDF nodes for a transmission function without touching Etas or anything!
824
+
else
825
+
{
826
+
// beautiful thing we can reuse the same BxDF nodes for a transmission function without touching Etas or anything!
832
827
btdfH = brdf->lhs;
828
+
leaf->brdfBottom = brdfH;
829
+
}
833
830
}
834
-
leaf->btdf = mul(btdfH,factorH);
835
-
// By default, all non-transmissive scattering models in Mitsuba are one-sided = all transmissive are two sided
// TODO: `_bsdf->plastic.nonlinear` , do we use beer?
841
+
// TODO: `_bsdf->plastic.nonlinear` to let the backend know the multiscatter should match provided albedo? Basically provided albedo is not the color at every bounce but after all bounces
0 commit comments