Compare commits

..

No commits in common. "42f3daefaa2dcebe91cbfbb90c2e3f804aa6f5a2" and "d3153032b137a735b2117c0a580139041b442233" have entirely different histories.

5 changed files with 475 additions and 570 deletions

954
rtiow/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,4 @@
[workspace] [workspace]
resolver = "2"
members = [ members = [
"noise_explorer", "noise_explorer",

View File

@ -4,12 +4,11 @@ use crate::{
cuboid::Cuboid, cuboid::Cuboid,
hitable::Hit, hitable::Hit,
hitable_list::HitableList, hitable_list::HitableList,
material::{Dielectric, DiffuseLight, Isotropic, Lambertian, Material, Metal}, material::{Lambertian, Material, Metal},
renderer::Scene, renderer::Scene,
sphere::Sphere, sphere::Sphere,
texture::{EnvMap, Texture}, texture::{EnvMap, Texture},
}; };
use chrono::IsoWeek;
use serde::Deserialize; use serde::Deserialize;
use std::{collections::HashMap, fs::File, io::BufReader, path::PathBuf, sync::Arc}; use std::{collections::HashMap, fs::File, io::BufReader, path::PathBuf, sync::Arc};
use stl::STL; use stl::STL;
@ -47,10 +46,6 @@ impl TryFrom<Config> for Scene {
for mc in c.materials { for mc in c.materials {
let v: Arc<dyn Material> = match mc.material { let v: Arc<dyn Material> = match mc.material {
Materials::Metal { albedo, fuzzy } => Arc::new(Metal::new(albedo, fuzzy)), Materials::Metal { albedo, fuzzy } => Arc::new(Metal::new(albedo, fuzzy)),
Materials::Dielectric { ref_idx } => Arc::new(Dielectric::new(ref_idx)),
Materials::DiffuseLight { texture } => Arc::new(DiffuseLight::new(texture)),
Materials::Isotropic { texture } => Arc::new(Isotropic::new(texture)),
Materials::Lambertian { texture } => Arc::new(Lambertian::new(texture)),
}; };
if materials.insert(mc.name.clone(), v).is_some() { if materials.insert(mc.name.clone(), v).is_some() {
return Err(ConfigError::DuplicateMaterial(mc.name)); return Err(ConfigError::DuplicateMaterial(mc.name));
@ -178,15 +173,6 @@ struct MaterialConfig {
enum Materials { enum Materials {
#[serde(rename = "metal")] #[serde(rename = "metal")]
Metal { albedo: [f32; 3], fuzzy: f32 }, Metal { albedo: [f32; 3], fuzzy: f32 },
#[serde(rename = "dielectric")]
Dielectric { ref_idx: f32 },
// TODO(wathiede): these all take Textures, for now, only support RGB
#[serde(rename = "diffuse_light")]
DiffuseLight { texture: [f32; 3] },
#[serde(rename = "isotropic")]
Isotropic { texture: [f32; 3] },
#[serde(rename = "lambertian")]
Lambertian { texture: [f32; 3] },
} }
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]

View File

@ -111,12 +111,7 @@ pub struct Opt {
pub use_accel: bool, pub use_accel: bool,
/// Output directory /// Output directory
#[structopt( #[structopt(parse(from_os_str), default_value = "/tmp/tracer")]
short = "o",
long = "output",
parse(from_os_str),
default_value = "/tmp/tracer"
)]
pub output: PathBuf, pub output: PathBuf,
} }

View File

@ -1,74 +1,49 @@
[scene] [scene]
width = 768 width = 768
height = 512 height = 768
subsamples = 100 #subsamples = 1000
[camera] [camera]
lookfrom = [0.0, 50.0, 100.0] lookfrom = [0.0, 30.0, -100.0]
lookat = [0.0, 10.0, 0.0] lookat = [0.0, 0.0, 0.0]
fov = 45 fov = 45
aperture = 0.0 aperture = 0.0
focus_dist = 10.0 focus_dist = 10.0
time_min = 0.0 time_min = 0.0
time_max = 1.0 time_max = 1.0
[[materials]]
name = "light1"
type = "isotropic"
texture = [20, 10, 10]
[[materials]]
name = "yellow"
type = "isotropic"
texture = [1, 1, 0]
[[materials]]
name = "magenta"
type = "lambertian"
texture = [1, 0, 1]
[[materials]] [[materials]]
name = "green" name = "green"
type = "diffuse_light"
texture = [0, 1, 0]
[[materials]]
name = "metal"
type = "metal" type = "metal"
albedo = [1, 1, 1] albedo = [0, 1, 0]
fuzzy = 0 fuzzy = 1.5
[[materials]] [[materials]]
name = "glass" name = "blue"
type = "dielectric" type = "metal"
ref_idx = 1.5 albedo = [0, 0, 1]
fuzzy = 1.5
[[materials]]
name = "red"
type = "metal"
albedo = [1, 0, 0]
fuzzy = 1.5
[[hitables]] [[hitables]]
type = "sphere" type = "cuboid"
center = [-30.0, 0.0, 0.0] min = [-10.0, -10.0, -10.0]
radius = 10 max = [10.0, 10.0, 10.0]
material_name = "yellow" material_name = "green"
[[hitables]] [[hitables]]
type = "sphere" type = "sphere"
center = [30.0, 0.0, 0.0] center = [30.0, 0.0, 0.0]
radius = 10 radius = 10
material_name = "green" material_name = "blue"
[[hitables]]
type = "sphere"
center = [0.0, -10.0, 0.0]
radius = 10
material_name = "metal"
[[hitables]]
type = "sphere"
center = [0.0, 0.0, -30.0]
radius = 10
material_name = "magenta"
[[hitables]] [[hitables]]
type = "stl" type = "stl"
path = "/net/nasx.h.xinu.tv/x/3dprint/stl/stanford_dragon.stl" path = "/net/nasx.h.xinu.tv/x/3dprint/stl/stanford_dragon.stl"
scale = 200 scale = 200
material_name = "glass" material_name = "red"
#[[hitables]]
#type = "sphere"
#center = [0.0, 50.0, -100.0]
#radius = 10
#material_name = "light1"
[envmap] [envmap]
path = "/home/wathiede/src/xinu.tv/raytracers/rtiow/renderer/images/52681723945_e1d94d3df9_6k.jpg" path = "/home/wathiede/src/xinu.tv/raytracers/rtiow/renderer/images/52681723945_e1d94d3df9_6k.jpg"