diff --git a/result_image.png b/result_image.png index c3e6261..04c39e1 100644 Binary files a/result_image.png and b/result_image.png differ diff --git a/scenes/cube_on_plane.bin b/scenes/cube_on_plane.bin index 8b24e3d..7100aaf 100644 Binary files a/scenes/cube_on_plane.bin and b/scenes/cube_on_plane.bin differ diff --git a/scenes/cube_on_plane.blend b/scenes/cube_on_plane.blend index b6c28ec..f61bbe9 100644 Binary files a/scenes/cube_on_plane.blend and b/scenes/cube_on_plane.blend differ diff --git a/scenes/cube_on_plane.blend1 b/scenes/cube_on_plane.blend1 index dbe35c2..7b8267d 100644 Binary files a/scenes/cube_on_plane.blend1 and b/scenes/cube_on_plane.blend1 differ diff --git a/scenes/cube_on_plane.gltf b/scenes/cube_on_plane.gltf index 8945edb..3d0b76f 100644 --- a/scenes/cube_on_plane.gltf +++ b/scenes/cube_on_plane.gltf @@ -109,7 +109,7 @@ }, { "mesh":4, - "name":"Suzanne", + "name":"Cube.004", "translation":[ -10, 10, @@ -174,11 +174,11 @@ }, { "doubleSided":true, - "name":"Material.002", + "name":"Material.004", "pbrMetallicRoughness":{ "baseColorFactor":[ - 0.008347976952791214, - 0.8001724481582642, + 0.0012476131087169051, + 0.8003553152084351, 0, 1 ], @@ -245,7 +245,7 @@ ] }, { - "name":"Suzanne", + "name":"Cube.004", "primitives":[ { "attributes":{ @@ -253,7 +253,7 @@ "NORMAL":15, "TEXCOORD_0":16 }, - "indices":17, + "indices":10, "material":3 } ] @@ -387,36 +387,30 @@ { "bufferView":14, "componentType":5126, - "count":555, + "count":14, "max":[ - 1.3671875, - 0.984375, - 0.8515625 + 1, + 1, + 1 ], "min":[ - -1.3671875, - -0.984375, - -0.8515625 + -1, + -1, + -1 ], "type":"VEC3" }, { "bufferView":15, "componentType":5126, - "count":555, + "count":14, "type":"VEC3" }, { "bufferView":16, "componentType":5126, - "count":555, + "count":14, "type":"VEC2" - }, - { - "bufferView":17, - "componentType":5123, - "count":2904, - "type":"SCALAR" } ], "bufferViews":[ @@ -506,32 +500,26 @@ }, { "buffer":0, - "byteLength":6660, + "byteLength":168, "byteOffset":1936, "target":34962 }, { "buffer":0, - "byteLength":6660, - "byteOffset":8596, + "byteLength":168, + "byteOffset":2104, "target":34962 }, { "buffer":0, - "byteLength":4440, - "byteOffset":15256, + "byteLength":112, + "byteOffset":2272, "target":34962 - }, - { - "buffer":0, - "byteLength":5808, - "byteOffset":19696, - "target":34963 } ], "buffers":[ { - "byteLength":25504, + "byteLength":2384, "uri":"cube_on_plane.bin" } ] diff --git a/src/ray.rs b/src/ray.rs index 33d9299..9b9b075 100644 --- a/src/ray.rs +++ b/src/ray.rs @@ -31,6 +31,8 @@ pub fn construct_primary_rays(camera: &Camera, panic!("Non invertible transform Matrix. giving up.") ); + dbg!(camera.transform); + //TODO: take ray multiplier per pixel into account here let mut rays: Vec = Vec::with_capacity(height * width); @@ -59,7 +61,7 @@ fn generate_single_primary_ray(image_width: usize, let direction_view_space: Vector4 = Vector4::new(u as f32 - (image_width as f32 / 2.0), v as f32 - (image_height as f32 / 2.0), - -focal_length, + focal_length, 0.0); //TODO: Rotation is fucked //x rotation has sign wrong, y and z are flipped diff --git a/src/renderer.rs b/src/renderer.rs index 26c8e87..d1457d5 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -75,6 +75,7 @@ fn raytrace(ray: &Ray, scene: &Scene) -> Rgba { // a new closer Point is found if t < smallest_t { smallest_t = t; + //TODO: lighting model is not at all considered. Just a debug hack. clostest_intersection_point = Option::from(isec); let color_vec = model.material().get_base_color_alpha( Vector2::new(0.0, 0.0)