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
I view these two patterns as optimization at the wrong level of abstraction. I would suggest instead that inside MicrofacetTransmission it knows how to use the logic of the optimized SpecularTransissiion BxDF when roughness is 0, or there is a factory function that will return a SpecularTranmission BxDF when the roughess parameters are 0.
Then you can implement this optimization pattern once in a central location and then it is applied everywhere, rather than just in the materials where one remembers to do this roughness dependent switching between these two BxDFs.
If one did this change and the one suggested in #29, the glass material would be simplified from:
var isSpecular = ( uRoughness === 0 && vRoughness === 0 );
var microfacetDistribution = null;
if( ! isSpecular )
microfacetDistribution = new TrowbridgeReitzDistribution( uRoughness, vRoughness );
if( reflectance !== BLACK )
var fresnel = new FresnelDielectric( 1, ior );
if( isSpecular )
bsdfs.add( new SpecularReflection( reflectance, fresnel ) );
else
bsdfs.add( new MicrofacetReflection( reflectance, microfacetDistribution, fresnel ) )
if( transmittance !== BLACK )
if( isSpecular )
bsdfs.add( new SpecularTransmission( transmittance, 1, ior, mode ) );
else
bsdfs.add( new MicrofacetTransmission( transmittance, microfacetDistribution, 1, ior ) )
To just the very clear and concise:
var microfacetDistribution = new TrowbridgeReitzDistribution( uRoughness, vRoughness );
var fresnel = new FresnelDielectric( 1, ior );
bsdfs.add( new MicrofacetReflection( reflectance, microfacetDistribution, fresnel ) );
bsdfs.add( new MicrofacetTransmission( transmittance, microfacetDistribution, 1, ior ) );
Which to me would be a major improvement for readability, clarify and for maintenance.
The text was updated successfully, but these errors were encountered:
These two code patterns (here as pseudo code) are used a lot in the creation of the materials:
And
I view these two patterns as optimization at the wrong level of abstraction. I would suggest instead that inside MicrofacetTransmission it knows how to use the logic of the optimized SpecularTransissiion BxDF when roughness is 0, or there is a factory function that will return a SpecularTranmission BxDF when the roughess parameters are 0.
Then you can implement this optimization pattern once in a central location and then it is applied everywhere, rather than just in the materials where one remembers to do this roughness dependent switching between these two BxDFs.
If one did this change and the one suggested in #29, the glass material would be simplified from:
To just the very clear and concise:
Which to me would be a major improvement for readability, clarify and for maintenance.
The text was updated successfully, but these errors were encountered: