@@ -192,7 +192,6 @@ struct LightSample
192
192
//
193
193
struct IsotropicMicrofacetCache
194
194
{
195
- // always valid by construction
196
195
// always valid because its specialized for the reflective case
197
196
static IsotropicMicrofacetCache createForReflection (const float NdotV, const float NdotL, const float VdotL, out float LplusV_rcpLen)
198
197
{
@@ -290,6 +289,36 @@ struct IsotropicMicrofacetCache
290
289
struct AnisotropicMicrofacetCache : IsotropicMicrofacetCache
291
290
{
292
291
// always valid by construction
292
+ static AnisotropicMicrofacetCache create (const float3 tangentSpaceV, const float3 tangentSpaceH)
293
+ {
294
+ AnisotropicMicrofacetCache retval;
295
+
296
+ retval.VdotH = dot (tangentSpaceV,tangentSpaceH);
297
+ retval.LdotH = retval.VdotH;
298
+ retval.NdotH = tangentSpaceH.z;
299
+ retval.NdotH2 = retval.NdotH*retval.NdotH;
300
+ retval.TdotH = tangentSpaceH.x;
301
+ retval.BdotH = tangentSpaceH.y;
302
+
303
+ return retval;
304
+ }
305
+ static AnisotropicMicrofacetCache create (
306
+ const float3 tangentSpaceV,
307
+ const float3 tangentSpaceH,
308
+ const bool transmitted,
309
+ const float rcpOrientedEta,
310
+ const float rcpOrientedEta2
311
+ )
312
+ {
313
+ AnisotropicMicrofacetCache retval = create (tangentSpaceV,tangentSpaceH);
314
+ if (transmitted)
315
+ {
316
+ const float VdotH = retval.VdotH;
317
+ LdotH = transmitted ? refract_compute_NdotT (VdotH<0.0 ,VdotH*VdotH,rcpOrientedEta2);
318
+ }
319
+
320
+ return retval;
321
+ }
293
322
// always valid because its specialized for the reflective case
294
323
static AnisotropicMicrofacetCache createForReflection (const float3 tangentSpaceV, const float3 tangentSpaceL, const float VdotL)
295
324
{
0 commit comments