Do a projection of the colors onto the SG's
| 212 | |
| 213 | // Do a projection of the colors onto the SG's |
| 214 | static void SolveProjection(SGSolveParams& params) |
| 215 | { |
| 216 | Assert_(params.SampleDirs != nullptr); |
| 217 | Assert_(params.SampleValues != nullptr); |
| 218 | |
| 219 | // Project color samples onto the SGs |
| 220 | for(uint32 i = 0; i < params.NumSamples; ++i) |
| 221 | ProjectOntoSGs(params.SampleDirs[i], params.SampleValues[i], params.OutSGs, params.NumSGs); |
| 222 | |
| 223 | // Weight the samples by the monte carlo factor for uniformly sampling the sphere/hemisphere |
| 224 | float monteCarloFactor = ((2.0f * Pi) / params.NumSamples); |
| 225 | if(params.Distribution == SGDistribution::Spherical) |
| 226 | monteCarloFactor *= 2.0f; |
| 227 | |
| 228 | // Fudge factor to help correct the intensity from our bad projection algorithim |
| 229 | if(params.Distribution == SGDistribution::Spherical && params.NumSGs == 9) |
| 230 | monteCarloFactor *= Pi / 2.46373701f; |
| 231 | |
| 232 | for(uint32 i = 0; i < params.NumSGs; ++i) |
| 233 | params.OutSGs[i].Amplitude *= monteCarloFactor; |
| 234 | } |
| 235 | |
| 236 | // Solve the set of spherical gaussians based on input set of data |
| 237 | void SolveSGs(SGSolveParams& params) |
no test coverage detected