Computes the radiance reflected off a surface towards the eye given the differential irradiance from a given direction
| 66 | // Computes the radiance reflected off a surface towards the eye given |
| 67 | // the differential irradiance from a given direction |
| 68 | inline Float3 CalcLighting(const Float3& normal, const Float3& lightIrradiance, |
| 69 | const Float3& lightDir, const Float3& diffuseAlbedo, const Float3& position, |
| 70 | const Float3& cameraPos, float roughness, bool includeSpecular, Float3 specAlbedo) |
| 71 | { |
| 72 | Float3 lighting = diffuseAlbedo * InvPi; |
| 73 | |
| 74 | if(includeSpecular && Float3::Dot(normal, lightDir) > 0.0f) |
| 75 | { |
| 76 | Float3 view = Float3::Normalize(cameraPos - position); |
| 77 | const float nDotV = Saturate(Float3::Dot(normal, view)); |
| 78 | Float3 h = Float3::Normalize(view + lightDir); |
| 79 | |
| 80 | Float3 fresnel = Fresnel(specAlbedo, h, lightDir); |
| 81 | |
| 82 | float specular = GGX_Specular(roughness, normal, h, view, lightDir); |
| 83 | lighting += specular * fresnel; |
| 84 | } |
| 85 | |
| 86 | return lighting * lightIrradiance; |
| 87 | } |
| 88 | |
| 89 | } |
nothing calls this directly
no test coverage detected