Skip to content

Commit

Permalink
example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
scott223 committed Nov 26, 2023
1 parent eb688f3 commit 751b853
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ lto = true # Enable link-time optimization
codegen-units = 1 # Reduce number of codegen units to increase optimizations
panic = 'abort' # Abort on panic
strip = false # Strip symbols from binary*
debug = true
debug = false

[profile.dev]
strip = false
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Simple Raytracer for simple 3D scenes, made in Rust. Objective is to learn Rust,
- scene and configuration input from JSON
- ...

![Render example](https://github.com/scott223/raytracer/blob/main/render1200.png?raw=true)
Render of different objects (cube, sphere, .obj file import (100k triangles) and materials (lambertian, glass, fuzzy metal). This render of 1200x1200 pixels with 2000 samples per pixel took about 30 minutes to complete on MacBook Air M2.


## todo's
- adaptive sampling
- BRDF materials
Expand Down
8 changes: 4 additions & 4 deletions input/config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"img_width": 600.0,
"img_height": 600.0,
"samples": 12,
"max_depth": 8,
"img_width": 1200.0,
"img_height": 1200.0,
"samples": 2048,
"max_depth": 12,
"sky_color": {
"r": 0.3,
"g": 0.5,
Expand Down
26 changes: 21 additions & 5 deletions input/scene.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@
"camera_focus_dist": 800.0
},
"elements": [
{
"JSONSphere": {
"center": {
"x": 420,
"y": 60,
"z": 100.0
},
"radius": 60,
"material": {
"Dielectric": {
"index_of_refraction": 1.5
}
},
"attractor": true
}
},
{
"JSONObj": {
"filepath": "input/obj/dragon.obj",
Expand Down Expand Up @@ -59,9 +75,9 @@
"material": {
"Metal": {
"albedo": {
"r": 0.2,
"g": 0.2,
"b": 0.73
"r": 0.3,
"g": 0.3,
"b": 0.83
},
"fuzz": 0.1
}
Expand Down Expand Up @@ -437,8 +453,8 @@
"DiffuseLight": {
"albedo": {
"r": 10.0,
"g": 10.0,
"b": 10.0
"g": 8.0,
"b": 8.0
}
}
},
Expand Down
Binary file added render1200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed renders/render.png
Binary file not shown.
2 changes: 1 addition & 1 deletion src/render/integrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl RenderIntegrator {
// set pixel color, but first divide by the number of samples to get the average and return
*band_item = (color / sum_sample_weight)
.clamp()
.linear_to_gamma(2.2);
.linear_to_gamma(2.5);
}
}

Expand Down

0 comments on commit 751b853

Please sign in to comment.