Skip to content

The native runtime for three.js: three.js, down to the metal. 45× smaller than Electron, on a Sony PS3, and path-traced at 60 fps on ray-tracing GPUs.

The origin test's marker stands behind the camera, not through it (#294)

YX442a9dce7e1b
diff --git a/renderer/src/live/inplace_tests.rs b/renderer/src/live/inplace_tests.rs
index 8a7c28a..d96c8f3 100644
--- a/renderer/src/live/inplace_tests.rs
+++ b/renderer/src/live/inplace_tests.rs
@@ -5389,12 +5389,13 @@ fn wall_seen_from(at: Vec3, marker: bool) -> Option<(LiveCore, Vec<u8>)> {
w.set_object(10, "wall".into(), None, Kind::Mesh { geometry: 2, material: 5, own_blas: true, materials: vec![] }, true, false).unwrap();
w.set_transform(10, at + Vec3::new(0.0, 0.0, -50.0), glam::Quat::IDENTITY, Vec3::ONE).unwrap();
if marker {
- // (The scene's first instance stands where the camera does: the empty slots stand at that point.)
+ // (The scene's first instance stands where the camera does: the empty slots stand at that point. Its quad is 5 m
+ // behind the camera, in its own space: a quad through the camera has every camera ray begin on a triangle, and
+ // what hardware traversal returns for such a ray differs with the position and with the GPU.)
w.set_material(1, serde_json::from_value(serde_json::json!({ "name": "m", "color": [0.5, 0.5, 0.5], "opacity": 1, "metalness": 0, "roughness": 1, "emissive": [0, 0, 0], "emissiveIntensity": 0.0, "doubleSided": true })).unwrap());
- w.set_geometry(3, Geometry { positions: vec![-0.1, -0.1, 0.0, 0.1, -0.1, 0.0, 0.1, 0.1, 0.0, -0.1, 0.1, 0.0], normals: [0.0, 0.0, 1.0].repeat(4), uvs: vec![0.0; 8], indices: vec![0, 1, 2, 0, 2, 3], groups: vec![], colors: vec![] }).unwrap();
+ w.set_geometry(3, Geometry { positions: vec![-0.1, -0.1, 5.0, 0.1, -0.1, 5.0, 0.1, 0.1, 5.0, -0.1, 0.1, 5.0], normals: [0.0, 0.0, 1.0].repeat(4), uvs: vec![0.0; 8], indices: vec![0, 1, 2, 0, 2, 3], groups: vec![], colors: vec![] }).unwrap();
w.set_object(3, "marker".into(), None, Kind::Mesh { geometry: 3, material: 1, own_blas: true, materials: vec![] }, true, false).unwrap();
- // (Turned edge-on to the view: the camera in its plane sees nothing of it.)
- w.set_transform(3, at, glam::Quat::from_rotation_y(std::f32::consts::FRAC_PI_2), Vec3::ONE).unwrap();
+ w.set_transform(3, at, glam::Quat::IDENTITY, Vec3::ONE).unwrap();
}
w.set_object(4, "camera".into(), None, Kind::Camera(camera(50.0, None, manual(8.0))), true, false).unwrap();
w.set_transform(4, at, glam::Quat::IDENTITY, Vec3::ONE).unwrap();