MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / ray_for_pixel_jittered

Method ray_for_pixel_jittered

tools/bloom-reference/src/main.rs:998–1009  ·  view source on GitHub ↗

Sub-pixel-jittered ray. `jitter` is in [0,1)² and samples different points within the pixel for multi-sample AA. Phase 1 always used (0.5, 0.5); Phase 2 lets the caller supply random offsets per sample.

(
        &self,
        pixel: UVec2,
        image_size: UVec2,
        jitter: Vec2,
    )

Source from the content-addressed store, hash-verified

996 /// always used (0.5, 0.5); Phase 2 lets the caller supply random
997 /// offsets per sample.
998 fn ray_for_pixel_jittered(
999 &self,
1000 pixel: UVec2,
1001 image_size: UVec2,
1002 jitter: Vec2,
1003 ) -> Ray {
1004 let ndc_x = (2.0 * ((pixel.x as f32 + jitter.x) / image_size.x as f32) - 1.0) * self.aspect;
1005 let ndc_y = 1.0 - 2.0 * ((pixel.y as f32 + jitter.y) / image_size.y as f32);
1006 let scale = (self.fov_y_radians * 0.5).tan();
1007 let dir = self.forward + self.right * ndc_x * scale + self.up * ndc_y * scale;
1008 Ray::new(self.position, dir)
1009 }
1010}
1011
1012// ============================================================

Callers 1

renderFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected