Probability (per pixel, NOT per solid angle) that this pixel would be chosen by `sample_pixel`. For MIS we need this in a form we can compare with the BRDF's PDF, which is per solid angle — the Environment wrapper handles the conversion.
(&self, x: u32, y: u32)
| 1462 | /// form we can compare with the BRDF's PDF, which is per solid |
| 1463 | /// angle — the Environment wrapper handles the conversion. |
| 1464 | fn pixel_pdf(&self, x: u32, y: u32) -> f32 { |
| 1465 | if self.total_weight <= 0.0 { |
| 1466 | return 0.0; |
| 1467 | } |
| 1468 | let w = self.width as usize; |
| 1469 | let h = self.height as usize; |
| 1470 | if x as usize >= w || y as usize >= h { |
| 1471 | return 0.0; |
| 1472 | } |
| 1473 | // Reconstruct pixel weight / total. |
| 1474 | let row_base = y as usize * (w + 1); |
| 1475 | let px_p_given_row = self.conditional[row_base + x as usize + 1] |
| 1476 | - self.conditional[row_base + x as usize]; |
| 1477 | let row_total = self.marginal[y as usize + 1] - self.marginal[y as usize]; |
| 1478 | row_total * px_p_given_row |
| 1479 | } |
| 1480 | } |
| 1481 | |
| 1482 | /// Inverse-CDF inversion: returns the largest index i such that |