@@ -12,7 +12,7 @@ import { diffuseColor, diffuseContribution, specularColor, specularColorBlended,
1212import { normalView , clearcoatNormalView , normalWorld } from '../accessors/Normal.js' ;
1313import { positionViewDirection , positionView , positionWorld } from '../accessors/Position.js' ;
1414import { Fn , float , vec2 , vec3 , vec4 , mat3 , If } from '../tsl/TSLBase.js' ;
15- import { mix , normalize , refract , length , clamp , log2 , log , exp , smoothstep , inverseSqrt } from '../math/MathNode.js' ;
15+ import { mix , normalize , refract , length , clamp , log2 , log , exp , smoothstep } from '../math/MathNode.js' ;
1616import { div } from '../math/OperatorNode.js' ;
1717import { cameraPosition , cameraProjectionMatrix , cameraViewMatrix } from '../accessors/Camera.js' ;
1818import { modelWorldMatrix } from '../accessors/ModelNode.js' ;
@@ -313,21 +313,14 @@ const evalIridescence = /*@__PURE__*/ Fn( ( { outsideIOR, eta2, cosTheta1, thinF
313313
314314// This is a curve-fit approximation to the "Charlie sheen" BRDF integrated over the hemisphere from
315315// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF".
316- // The low roughness fit (< 0.25) uses an inversesqrt/log model to accurately capture the sharp peak.
317316const IBLSheenBRDF = /*@__PURE__ */ Fn ( ( { normal, viewDir, roughness } ) => {
318317
319318 const dotNV = normal . dot ( viewDir ) . saturate ( ) ;
320319 const r2 = roughness . mul ( roughness ) ;
320+ const rInv = roughness . add ( 0.1 ) . reciprocal ( ) ;
321321
322- const a = roughness . lessThan ( 0.25 ) . select (
323- inverseSqrt ( roughness ) . mul ( - 1.57 ) ,
324- r2 . mul ( - 3.33 ) . add ( roughness . mul ( 6.27 ) ) . sub ( 4.40 )
325- ) ;
326-
327- const b = roughness . lessThan ( 0.25 ) . select (
328- log ( roughness ) . mul ( - 0.46 ) . sub ( 0.64 ) ,
329- r2 . mul ( 0.92 ) . sub ( roughness . mul ( 1.79 ) ) . add ( 0.35 )
330- ) ;
322+ const a = float ( - 1.9362 ) . add ( roughness . mul ( 1.0678 ) ) . add ( r2 . mul ( 0.4573 ) ) . sub ( rInv . mul ( 0.8469 ) ) ;
323+ const b = float ( - 0.6014 ) . add ( roughness . mul ( 0.5538 ) ) . sub ( r2 . mul ( 0.4670 ) ) . sub ( rInv . mul ( 0.1255 ) ) ;
331324
332325 const DG = a . mul ( dotNV ) . add ( b ) . exp ( ) ;
333326
0 commit comments