PDF (per solid angle) of the env distribution for a given direction. Evaluates the pixel the direction maps to and converts back to solid-angle measure.
(&self, direction: Vec3)
| 1653 | /// direction. Evaluates the pixel the direction maps to and |
| 1654 | /// converts back to solid-angle measure. |
| 1655 | fn pdf(&self, direction: Vec3) -> f32 { |
| 1656 | let (x, y, sin_theta) = self.direction_to_pixel(direction); |
| 1657 | if sin_theta <= 0.0 { |
| 1658 | return 0.0; |
| 1659 | } |
| 1660 | let pixel_p = self.distribution.pixel_pdf(x, y); |
| 1661 | let omega_per_pixel = (2.0 * std::f32::consts::PI / self.width as f32) |
| 1662 | * (std::f32::consts::PI / self.height as f32) |
| 1663 | * sin_theta; |
| 1664 | pixel_p / omega_per_pixel |
| 1665 | } |
| 1666 | } |
| 1667 | |
| 1668 | // ============================================================ |
no test coverage detected