diff --git a/src/main.rs b/src/main.rs index eebc51d..f58a1eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,8 +91,8 @@ pub fn main() -> Result<(), Box> { Rc::new(PhongMaterial { colour: ColourRgbF::from_named(NamedColour::Red), diffuse_strength: 0.05, - smoothness: 20.0, - specular_strength: 250.0, + smoothness: 100.0, + specular_strength: 1.0, }), )), ], diff --git a/src/raycasting.rs b/src/raycasting.rs index b53c7ac..daad86f 100644 --- a/src/raycasting.rs +++ b/src/raycasting.rs @@ -135,7 +135,7 @@ impl Intersect for Sphere { } else { let location = ray.point_at(distance); let normal = (location - self.centre).normalize(); - let tangent = normal.cross(&Vector3::z_axis()); + let tangent = normal.cross(&Vector3::z_axis()).normalize(); let cotangent = normal.cross(&tangent); let retro = -ray.direction; Some(IntersectionInfo { @@ -169,7 +169,7 @@ impl Plane { normal.normalize(); let mut axis_closest_to_tangent = Vector3::zeros(); axis_closest_to_tangent[normal.iamin()] = T::one(); - let cotangent = normal.cross(&axis_closest_to_tangent); + let cotangent = normal.cross(&axis_closest_to_tangent).normalize(); let tangent = normal.cross(&cotangent); Plane { normal,