[FONT=&]Hey so i’m doing a game mostly made in sand and concrete so oren nayar is way better then the default lambert, in 4.17 i was able to switch from lambert to oren nayar with this fonction in the shadingmodels.ush : [FONT=&]
[FONT=&]But this fonction isn’t here anymore in 4.22 how do i switch to oren nayar now ? thanks in advance !
(Oren nayar is still in the BRDF library)
I would like to know this as well.
Would like to know this too, since it seems to have changed in recent versions.
Well, it seems that they split it up between ShadingModels.ush and BRDF.ush.
On BRDF you’ll find the three methods defined as functions. I havne’t tried yet but ShadingModels inherit from BRDF so you probably should change the six calls to this function.
float3 Diffuse_OrenNayar( float3 DiffuseColor, float Roughness, float NoV, float NoL, float VoH )
float a = Roughness * Roughness;
float s = a;// / ( 1.29 + 0.5 * a );
float s2 = s * s;
float VoL = 2 * VoH * VoH - 1; // double angle identity
float Cosri = VoL - NoV * NoL;
float C1 = 1 - 0.5 * s2 / (s2 + 0.33);
float C2 = 0.45 * s2 / (s2 + 0.09) * Cosri * ( Cosri >= 0 ? rcp( max( NoL, NoV ) ) : 1 );
return DiffuseColor / PI * ( C1 + C2 ) * ( 1 + Roughness * 0.5 );
You need to change the DefaultLitBxDF function in ShadingModels to use the Diffuse_OrenNayar diffuse model. You’ll need to add in the missing variables that Oren-Nayar needs to call it correctly.