Computes the difuse and specular contribution from the sun, given a 2D random sample point representing a location on the surface of the light
| 190 | // Computes the difuse and specular contribution from the sun, given a 2D random sample point |
| 191 | // representing a location on the surface of the light |
| 192 | static Float3 SampleSunLight(const Float3& position, const Float3& normal, RTCScene scene, |
| 193 | const Float3& diffuseAlbedo, const Float3& cameraPos, |
| 194 | bool includeSpecular, Float3 specAlbedo, float roughness, |
| 195 | float u1, float u2, Float3& irradiance) |
| 196 | { |
| 197 | // Treat the sun as a spherical area light that's very far away from the surface |
| 198 | const float sunDistance = 1000.0f; |
| 199 | const float radius = std::tan(DegToRad(AppSettings::SunSize)) * sunDistance; |
| 200 | Float3 sunLuminance = AppSettings::SunLuminance(); |
| 201 | Float3 sunPos = position + AppSettings::SunDirection.Value() * sunDistance; |
| 202 | return SampleSphericalAreaLight(position, normal, scene, diffuseAlbedo, cameraPos, includeSpecular, |
| 203 | specAlbedo, roughness, u1, u2, radius, sunPos, sunLuminance, irradiance); |
| 204 | } |
| 205 | |
| 206 | // Generates a full list of sample points for all integration types |
| 207 | void GenerateIntegrationSamples(IntegrationSamples& samples, uint64 sqrtNumSamples, uint64 tileSizeX, uint64 tileSizeY, |
no test coverage detected