     if( cos_in <= 0.0f || cos_out <= 0.0f )
         return make_float4( 0.0f );
 
-    const float3 N            = p.shading_normal;
-    const float  diffuse_pdf  = diffusePDF( w_out, N, w_in );
-    const float  specular_pdf = specularPDF( w_out, N, w_in );
-    const float  pdf          = optix::lerp( specular_pdf, diffuse_pdf, diffuse_weight );
-
-    const float3 diff_val     = diffuseEval( w_out, N, w_in );
-    const float3 spec_val     = specularEval( w_out, N, w_in );
-    return make_float4( spec_val + diff_val, pdf );
-    
-    /*
-    legion::ONB  onb( p.shading_normal );
-    const float3 H          = optix::normalize( w_out + w_in );
-    const float  spec_pdf   = specularPDF( w_out, p.shading_normal, w_in ); 
-    const float  spec_coeff = 0.25f / 
-                              ( alpha_u * alpha_v * sqrtf( cos_in*cos_out ) ) *
-                              wardExpTerm( 1.0f/alpha_u, 1.0f/alpha_v, H, onb );
-    const float3 spec_val   = spec_coeff * spec_reflectance;
-
-    const float pdf =  optix::lerp( spec_pdf, diff_pdf, diffuse_weight );
-    return make_float4( pdf*( spec_val + diff_val ), pdf );
-    */
+    const float3 N = p.shading_normal;
+    return wardEvalPDF( w_out, N, w_in, diffuse_weight);
 }
 
 

        else if (xi1 < 0.5f)
        {
            xi1 = 4.0f * (xi1 - 0.25f);
            phi_h = legion::PI - atanf(alpha_v * tanf(0.5f * legion::PI * xi1) / alpha_u);
        }
        else if (xi1 < 0.75f)
        {
            xi1 = 4.0f * (xi1 - 0.5f);
            phi_h = legion::PI + atanf(alpha_v * tanf(0.5 * legion::PI * xi1) / alpha_u);
        }
        else
        {
            xi1 = 4.0f * (xi1 - 0.75f);
            phi_h = legion::PI*2.0f - atanf(alpha_v * tanf( 0.5f * legion::PI * xi1) / alpha_u);
        }

        float cos_phi_h = cosf( phi_h );


        // calculate pdf
        const float3 N = p.shading_normal;
        const float4 ward = wardEvalPDF( w_out, N, sample.w_in, diffuse_weight);
        sample.pdf        = ward.w;
        sample.f_over_pdf = sample.pdf > 0.00001f            ? 
                            make_float3( ward )/ sample.pdf  :
                            make_float3( 0.0f );
        sample.is_specular = 0u; 
    }
