Add more 3d objects

This commit is contained in:
Jonathan Flueren 2022-07-19 17:10:04 +02:00
parent 99277995be
commit ee49ce9ecb
3 changed files with 15963 additions and 9 deletions

8023
obj/Coffee Cup.obj Normal file

File diff suppressed because it is too large Load diff

7928
obj/cat.obj Normal file

File diff suppressed because it is too large Load diff

View file

@ -189,7 +189,10 @@ fn from_obj(path: &str) -> HittableList {
} }
}*/ }*/
let material = Arc::new(Lambertian::new(&Color::new(0.4, 0.2, 0.1))); //let material = Arc::new(Lambertian::new(&Color::new(0.4, 0.2, 0.3)));
//let material = Arc::new(Dielectric::new(2.0));
let material = Arc::new(Metal::new(&Color::new(0.9, 0.9, 0.7), 0.0));
let cornell_box = tobj::load_obj(path, &tobj::GPU_LOAD_OPTIONS); let cornell_box = tobj::load_obj(path, &tobj::GPU_LOAD_OPTIONS);
let (models, materials) = cornell_box.expect("Failed to load OBJ file"); let (models, materials) = cornell_box.expect("Failed to load OBJ file");
@ -266,23 +269,23 @@ fn main() {
let aspect_ratio = 16.0 / 9.0; let aspect_ratio = 16.0 / 9.0;
let image_width = 1000; let image_width = 1000;
let image_height = (image_width as f64 / aspect_ratio) as u32; let image_height = (image_width as f64 / aspect_ratio) as u32;
let samples_per_pixel = 1_u32; let samples_per_pixel = 25_u32;
let max_depth = 20; let max_depth = 25;
let vfov = 80.0; let vfov = 60.0;
let lookfrom = Point3::new(3.0, 1.0, 3.0); let lookfrom = Point3::new(500.0, 500.0, 200.0);
let lookat = Point3::new(0.0, 0.2, 2.0); let lookat = Point3::new(0.0, 100.0, 0.0);
let vup = Vec3::new(0.0, 1.0, 0.0); let vup = Vec3::new(0.0, 1.0, 0.0);
let dist_to_focus = 3.0; let dist_to_focus = 300.0;
let aperture = 0.1; let aperture = 0.1;
// limit rayon multithreading thread count // limit rayon multithreading thread count
let thread_count = 4; // if 0, for each logical cpu core a thread wil be created let thread_count = 0; // if 0, for each logical cpu core a thread wil be created
if thread_count > 0 { if thread_count > 0 {
env::set_var("RAYON_NUM_THREADS", thread_count.to_string()); env::set_var("RAYON_NUM_THREADS", thread_count.to_string());
} }
let world = from_obj("obj/baum.obj"); let world = from_obj("obj/cat.obj");
// World // World
// let world = random_world(); // let world = random_world();