Add more to writeup
This commit is contained in:
parent
33f3cadeba
commit
b49f171f32
15 changed files with 203 additions and 67 deletions
1
assignment-1b/.gitignore
vendored
1
assignment-1b/.gitignore
vendored
|
@ -7,3 +7,4 @@
|
||||||
*.pdf
|
*.pdf
|
||||||
perf.data*
|
perf.data*
|
||||||
flamegraph.svg
|
flamegraph.svg
|
||||||
|
showcase.png
|
||||||
|
|
|
@ -7,9 +7,10 @@ ZIP := zip
|
||||||
PANDOC := pandoc
|
PANDOC := pandoc
|
||||||
CONVERT := convert
|
CONVERT := convert
|
||||||
|
|
||||||
HANDIN := hw1b.michael.zhang.zip
|
HANDIN := ./hw1b.michael.zhang.zip
|
||||||
BINARY := ./raytracer1b
|
BINARY := ./raytracer1b
|
||||||
WRITEUP := writeup.pdf
|
WRITEUP := ./writeup.pdf
|
||||||
|
SHOWCASE := ./showcase.png
|
||||||
SOURCES := Cargo.toml $(shell find -name "*.rs")
|
SOURCES := Cargo.toml $(shell find -name "*.rs")
|
||||||
|
|
||||||
EXAMPLES := $(shell find examples -name "*.txt")
|
EXAMPLES := $(shell find examples -name "*.txt")
|
||||||
|
@ -31,9 +32,12 @@ $(BINARY): $(SOURCES)
|
||||||
cargo build --profile release-handin
|
cargo build --profile release-handin
|
||||||
mv target/docker/release-handin/raytracer1b $@
|
mv target/docker/release-handin/raytracer1b $@
|
||||||
|
|
||||||
$(HANDIN): $(BINARY) $(WRITEUP) Makefile Cargo.toml Cargo.lock README.md $(EXAMPLES_PNG) $(EXAMPLES_PPM)
|
$(HANDIN): $(BINARY) $(WRITEUP) Makefile Cargo.toml Cargo.lock README.md $(EXAMPLES_PNG) $(EXAMPLES_PPM) $(SHOWCASE)
|
||||||
$(ZIP) -r $@ src examples $^
|
$(ZIP) -r $@ src examples $^
|
||||||
|
|
||||||
|
$(SHOWCASE): examples/soft-shadow-demo.png
|
||||||
|
cp $< $@
|
||||||
|
|
||||||
examples/%.ppm: examples/%.txt $(SOURCES)
|
examples/%.ppm: examples/%.txt $(SOURCES)
|
||||||
cargo run --release -- -o $@ $<
|
cargo run --release -- -o $@ $<
|
||||||
|
|
||||||
|
@ -44,4 +48,6 @@ writeup.pdf: writeup.md $(EXAMPLES_PNG)
|
||||||
$(PANDOC) -o $@ $<
|
$(PANDOC) -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(HANDIN) $(BINARY) $(WRITEUP) $(EXAMPLES_PPM) $(EXAMPLES_PNG)
|
rm -rf target/docker \
|
||||||
|
$(HANDIN) $(BINARY) $(WRITEUP) $(SHOWCASE) \
|
||||||
|
$(EXAMPLES_PPM) $(EXAMPLES_PNG)
|
||||||
|
|
|
@ -14,6 +14,10 @@ sources, and the ppm files are the corresponding outputs. They have been
|
||||||
generated by running this program. For convenience, pngs have also been provided
|
generated by running this program. For convenience, pngs have also been provided
|
||||||
using imagemagick.
|
using imagemagick.
|
||||||
|
|
||||||
|
## Showcase image
|
||||||
|
|
||||||
|
The showcase image can be found at `/showcase.png`.
|
||||||
|
|
||||||
## Building from source
|
## Building from source
|
||||||
|
|
||||||
The Makefile currently uses Docker to produce a more consistent build. If you
|
The Makefile currently uses Docker to produce a more consistent build. If you
|
||||||
|
|
15
assignment-1b/examples/depth-cueing-demo.txt
Normal file
15
assignment-1b/examples/depth-cueing-demo.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
imsize 640 480
|
||||||
|
eye -2.5 2 -5
|
||||||
|
viewdir -0.2 0 -1
|
||||||
|
hfov 90
|
||||||
|
updir 0 1 0
|
||||||
|
bkgcolor 0.4 0.4 0.4
|
||||||
|
|
||||||
|
depthcueing 0.4 0.4 0.4 1 0.1 60 0
|
||||||
|
light 0 5 -7.5 1 1 1 1
|
||||||
|
|
||||||
|
mtlcolor 1 0.8 0.7 1 1 1 0.6 0.6 0 10
|
||||||
|
sphere -5 2 -10 2
|
||||||
|
sphere -3 2 -20 2
|
||||||
|
sphere 1.5 2 -30 2
|
||||||
|
sphere 13 2 -60 2
|
|
@ -3,21 +3,21 @@ eye 0 0 15
|
||||||
viewdir 0 0 -1
|
viewdir 0 0 -1
|
||||||
hfov 90
|
hfov 90
|
||||||
updir 0 1 0
|
updir 0 1 0
|
||||||
bkgcolor 0.1 0.1 0.1
|
bkgcolor 0.4 0.4 0.4
|
||||||
|
|
||||||
light 0 3 3 0 0.3 0.3 0.4
|
light 0 5 5 1 0.7 0.7 0.8
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0 0.4 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0 0.4 0 1
|
||||||
sphere -10 0 0 2
|
sphere -10 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.2 0.4 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.4 0 1
|
||||||
sphere -5 0 0 2
|
sphere -5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.4 0.4 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.4 0.4 0 1
|
||||||
sphere 0 0 0 2
|
sphere 0 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.6 0.4 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.6 0.4 0 1
|
||||||
sphere 5 0 0 2
|
sphere 5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.8 0.4 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.8 0.4 0 1
|
||||||
sphere 10 0 0 2
|
sphere 10 0 0 2
|
||||||
|
|
|
@ -3,21 +3,21 @@ eye 0 0 15
|
||||||
viewdir 0 0 -1
|
viewdir 0 0 -1
|
||||||
hfov 90
|
hfov 90
|
||||||
updir 0 1 0
|
updir 0 1 0
|
||||||
bkgcolor 0.1 0.1 0.1
|
bkgcolor 0.4 0.4 0.4
|
||||||
|
|
||||||
light 0 3 3 0 0.3 0.3 0.4
|
light 0 5 5 1 0.7 0.7 0.8
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.2 0 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0 0 1
|
||||||
sphere -10 0 0 2
|
sphere -10 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.2 0.2 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0 1
|
||||||
sphere -5 0 0 2
|
sphere -5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.2 0.4 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.4 0 1
|
||||||
sphere 0 0 0 2
|
sphere 0 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.2 0.6 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.6 0 1
|
||||||
sphere 5 0 0 2
|
sphere 5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.2 0.8 0 1
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.8 0 1
|
||||||
sphere 10 0 0 2
|
sphere 10 0 0 2
|
||||||
|
|
|
@ -3,21 +3,21 @@ eye 0 0 15
|
||||||
viewdir 0 0 -1
|
viewdir 0 0 -1
|
||||||
hfov 90
|
hfov 90
|
||||||
updir 0 1 0
|
updir 0 1 0
|
||||||
bkgcolor 0.1 0.1 0.1
|
bkgcolor 0.4 0.4 0.4
|
||||||
|
|
||||||
light 0 3 3 0 0.3 0.3 0.4
|
light 0 5 5 1 0.7 0.7 0.8
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0 15
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0 15
|
||||||
sphere -10 0 0 2
|
sphere -10 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.2 15
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.2 15
|
||||||
sphere -5 0 0 2
|
sphere -5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.4 15
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.4 15
|
||||||
sphere 0 0 0 2
|
sphere 0 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.6 15
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.6 15
|
||||||
sphere 5 0 0 2
|
sphere 5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.8 15
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.8 15
|
||||||
sphere 10 0 0 2
|
sphere 10 0 0 2
|
||||||
|
|
16
assignment-1b/examples/multiple-lights-demo.txt
Normal file
16
assignment-1b/examples/multiple-lights-demo.txt
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
imsize 640 480
|
||||||
|
eye 0 0 -2
|
||||||
|
viewdir 0 0 -1
|
||||||
|
hfov 90
|
||||||
|
updir 0 1 0
|
||||||
|
bkgcolor 0.4 0.4 0.4
|
||||||
|
|
||||||
|
light -5 5 -7.5 1 1 1 1
|
||||||
|
light 5 5 -7.5 1 1 1 1
|
||||||
|
|
||||||
|
mtlcolor 0.4 0.6 1 1 1 1 0.2 0.6 0 10
|
||||||
|
sphere 0 -2 -10 2
|
||||||
|
|
||||||
|
mtlcolor 0.8 0.4 0.4 1 1 1 0.2 0.6 0 10
|
||||||
|
sphere -2.5 2.5 -10 1
|
||||||
|
sphere 2.5 2.5 -10 1
|
|
@ -3,21 +3,21 @@ eye 0 0 15
|
||||||
viewdir 0 0 -1
|
viewdir 0 0 -1
|
||||||
hfov 90
|
hfov 90
|
||||||
updir 0 1 0
|
updir 0 1 0
|
||||||
bkgcolor 0.1 0.1 0.1
|
bkgcolor 0.4 0.4 0.4
|
||||||
|
|
||||||
light 0 3 3 0 0.3 0.3 0.4
|
light 0 5 5 1 0.7 0.7 0.8
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.4 2
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.4 2
|
||||||
sphere -10 0 0 2
|
sphere -10 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.4 6
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.4 6
|
||||||
sphere -5 0 0 2
|
sphere -5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.4 10
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.4 10
|
||||||
sphere 0 0 0 2
|
sphere 0 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.4 50
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.4 50
|
||||||
sphere 5 0 0 2
|
sphere 5 0 0 2
|
||||||
|
|
||||||
mtlcolor 0 1 0 1 1 1 0.1 0.2 0.4 100
|
mtlcolor 0.6 1 0.4 1 1 1 0.2 0.2 0.4 100
|
||||||
sphere 10 0 0 2
|
sphere 10 0 0 2
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
imsize 640 480
|
imsize 1920 1080
|
||||||
eye 0 0 15
|
eye 0 0 15
|
||||||
viewdir 0 0 -1
|
viewdir 0 0 -1
|
||||||
hfov 60
|
hfov 60
|
||||||
updir 0 1 0
|
updir 0 1 0
|
||||||
bkgcolor 0.1 0.1 0.1
|
bkgcolor 0.4 0.4 0.4
|
||||||
|
|
||||||
depthcueing 0.1 0.1 0.1 1 0.2 100 0
|
depthcueing 0.4 0.4 0.4 1 0.1 60 0
|
||||||
|
|
||||||
light -10 10 -3 0 0.8 0.8 0.8
|
light -10 10 -3 0 0.8 0.8 0.8
|
||||||
light -10 10 -3 1 0.8 0.8 0.8
|
light -10 10 -3 1 0.8 0.8 0.8
|
||||||
|
|
||||||
mtlcolor 0 0.5 0.5 1 1 1 0.2 0.4 0 10
|
mtlcolor 0 0.5 0.5 1 1 1 0.2 0.7 0.2 10
|
||||||
sphere -1 -2 -5 2
|
sphere -1 -2 -5 2
|
||||||
sphere 3 -5 -1 0.5
|
sphere 10 -10 -40 1
|
||||||
|
|
||||||
mtlcolor 0.5 0.5 1 0.4 0.4 0.4 0.2 0.4 0 10
|
mtlcolor 0.5 0.5 1 0.4 0.4 0.4 0.2 0.7 0.4 10
|
||||||
sphere 1 2 -3 3
|
sphere 1 2 -3 3
|
||||||
sphere -6 3 -4 1
|
sphere -6 3 -4 1
|
||||||
|
|
||||||
mtlcolor 1.0 0 0.5 0.6 0.4 0.2 0.2 0.4 0 10
|
mtlcolor 1.0 0 0.5 0.6 0.4 0.2 0.2 0.6 0.8 10
|
||||||
sphere 20 20 -50 6
|
sphere 20 20 -50 6
|
||||||
|
|
||||||
mtlcolor 0.5 0 0.5 0.6 0.4 0.2 0.2 0.4 0 10
|
mtlcolor 0.5 0 0.5 0.6 0.4 0.2 0.2 0.5 0 10
|
||||||
sphere -6 -4 -8 7
|
sphere -6 -4 -8 7
|
||||||
|
|
||||||
mtlcolor 0.8 0 0.3 0.6 0.4 0.2 0.2 0.4 0 10
|
mtlcolor 0.8 0 0.3 0.6 0.4 0.2 0.2 0.4 0.2 10
|
||||||
cylinder -2 2 -3 0 0 5 1 4
|
cylinder -2 2 -3 0 0 5 1 4
|
||||||
|
|
||||||
mtlcolor 0.8 0.8 0.3 0.6 0.4 0.2 0.2 0.4 0 10
|
mtlcolor 0.8 0.8 0.3 0.6 0.4 0.2 0.2 0.8 0.2 10
|
||||||
sphere -40 35 -80 7
|
sphere -40 35 -80 7
|
||||||
sphere -25 20 -60 5
|
sphere -25 20 -60 5
|
||||||
sphere -12.5 15 -40 3
|
sphere -12.5 15 -40 3
|
||||||
sphere -6 11 -20 1.5
|
sphere -7 14 -30 2
|
||||||
|
|
||||||
mtlcolor 0.5 1 0.5 0.2 0.4 0.8 0.2 0.4 0 10
|
mtlcolor 0.5 1 0.5 0.2 0.4 0.8 0.2 0.4 0 10
|
||||||
cylinder 5 1 -2 1 -2 1 1 2
|
cylinder 5 1 -2 1 -2 1 1 2
|
||||||
|
|
|
@ -4,15 +4,16 @@ viewdir 0 0 -1
|
||||||
hfov 60
|
hfov 60
|
||||||
updir 0 1 0
|
updir 0 1 0
|
||||||
bkgcolor 0.5 0.5 0.5
|
bkgcolor 0.5 0.5 0.5
|
||||||
depthcueing 0.5 0.5 0.5 1 0.4 40 20
|
|
||||||
|
depthcueing 0.5 0.5 0.5 1 0.4 60 0
|
||||||
|
|
||||||
light 10 10 -10 1 1 1 1
|
light 10 10 -10 1 1 1 1
|
||||||
|
|
||||||
mtlcolor 0.5 1 0.5 1 1 1 0.2 1 0 10
|
mtlcolor 0.5 1 0.5 1 1 1 0.2 1 0.1 5
|
||||||
sphere 5 5 -20 5
|
sphere 4.5 4.5 -20 4.5
|
||||||
sphere -5 -5 -20 5
|
sphere -4.5 -4.5 -20 4.5
|
||||||
|
|
||||||
mtlcolor 1 0.5 0.5 1 1 1 0.2 1 0 10
|
mtlcolor 1 0.5 0.5 1 1 1 0.2 0.8 0 5
|
||||||
sphere -10 0 -30 4
|
sphere -10 0 -30 4
|
||||||
sphere -20 0 -30 4
|
sphere -20 0 -30 4
|
||||||
sphere -30 0 -30 4
|
sphere -30 0 -30 4
|
||||||
|
|
|
@ -4,7 +4,7 @@ use ordered_float::NotNan;
|
||||||
|
|
||||||
use crate::{ray::Ray, utils::min_f64};
|
use crate::{ray::Ray, utils::min_f64};
|
||||||
|
|
||||||
use super::{illumination::IntersectionContext};
|
use super::illumination::IntersectionContext;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Sphere {
|
pub struct Sphere {
|
||||||
|
@ -21,9 +21,7 @@ impl Sphere {
|
||||||
&self,
|
&self,
|
||||||
ray: &Ray,
|
ray: &Ray,
|
||||||
) -> Result<Option<IntersectionContext>> {
|
) -> Result<Option<IntersectionContext>> {
|
||||||
let a = ray.direction.x.powi(2)
|
let a = ray.direction.norm();
|
||||||
+ ray.direction.y.powi(2)
|
|
||||||
+ ray.direction.z.powi(2);
|
|
||||||
let b = 2.0
|
let b = 2.0
|
||||||
* (ray.direction.x * (ray.origin.x - self.center.x)
|
* (ray.direction.x * (ray.origin.x - self.center.x)
|
||||||
+ ray.direction.y * (ray.origin.y - self.center.y)
|
+ ray.direction.y * (ray.origin.y - self.center.y)
|
||||||
|
|
|
@ -3,6 +3,7 @@ use nalgebra::{Matrix3, Vector3};
|
||||||
use ordered_float::NotNan;
|
use ordered_float::NotNan;
|
||||||
|
|
||||||
/// Finds the minimum of an iterator of f64s, ignoring any NaN values
|
/// Finds the minimum of an iterator of f64s, ignoring any NaN values
|
||||||
|
#[inline]
|
||||||
pub fn min_f64<I>(i: I) -> Option<f64>
|
pub fn min_f64<I>(i: I) -> Option<f64>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = f64>,
|
I: Iterator<Item = f64>,
|
||||||
|
@ -14,6 +15,7 @@ where
|
||||||
|
|
||||||
/// Finds the minimum of an iterator of f64s using the given predicate, ignoring
|
/// Finds the minimum of an iterator of f64s using the given predicate, ignoring
|
||||||
/// any NaN values
|
/// any NaN values
|
||||||
|
#[inline]
|
||||||
pub fn min_f64_by_key<I, F>(i: I, f: F) -> Option<f64>
|
pub fn min_f64_by_key<I, F>(i: I, f: F) -> Option<f64>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = f64>,
|
I: Iterator<Item = f64>,
|
||||||
|
|
|
@ -3,36 +3,118 @@ geometry: margin=2cm
|
||||||
output: pdf_document
|
output: pdf_document
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# Raytracer part B
|
||||||
|
|
||||||
This project implements a raytracer with Blinn-Phong illumination implemented.
|
This project implements a raytracer with Blinn-Phong illumination implemented.
|
||||||
The primary formula that is used by this implementation is:
|
The primary formula that is used by this implementation is:
|
||||||
|
|
||||||
$$
|
\begin{equation}
|
||||||
I_{\lambda} = k_a O_{d\lambda} +
|
I_{\lambda} =
|
||||||
|
k_a O_{d\lambda} +
|
||||||
\sum_{i=1}^{n_\textrm{lights}} \left(
|
\sum_{i=1}^{n_\textrm{lights}} \left(
|
||||||
IL_{i\lambda} \left[
|
IL_{i\lambda} \left[
|
||||||
k_d O_{d\lambda} \textrm{max} \{
|
k_d O_{d\lambda} \max ( 0, \vec{N} \cdot \vec{L_i} ) +
|
||||||
% 0, \overrightarrow{N} \middot \vec{L_i}
|
k_s O_{s\lambda} \max ( 0, \vec{N} \cdot \vec{H_i} )^n
|
||||||
\}
|
|
||||||
\right]
|
\right]
|
||||||
\right)
|
\right)
|
||||||
$$
|
\end{equation}
|
||||||
|
|
||||||
|
Where:
|
||||||
|
|
||||||
|
- $I_{\lambda}$ is the final illumination of the pixel on an object
|
||||||
|
- $k_a$ is the material's ambient reflectivity
|
||||||
|
- $k_d$ is the material's diffuse reflectivity
|
||||||
|
- $k_s$ is the material's specular reflectivity
|
||||||
|
- $n_\textrm{lights}$ is the number of lights
|
||||||
|
- $IL_{i\lambda}$ is the intensity of light $i$
|
||||||
|
- $O_{d\lambda}$ is the object's diffuse color
|
||||||
|
- $O_{s\lambda}$ is the object's specular color
|
||||||
|
- $\vec{N}$ is the normal vector to the object's surface
|
||||||
|
- $\vec{L_i}$ is the direction from the intersection point to the light $i$
|
||||||
|
- $\vec{H_i}$ is halfway between the direction to the light $i$ and the
|
||||||
|
direction to the viewer
|
||||||
|
- $n$ is the exponent for the specular component
|
||||||
|
|
||||||
## Varying $k_a$
|
## Varying $k_a$
|
||||||
|
|
||||||
![Varying $k_a$](examples/ka-demo.png){width=240px}
|
$k_a$ is the strength of ambient light. It's used as a coefficient for the
|
||||||
|
object's diffuse color, which keeps a constant value independent of the
|
||||||
|
positions of the object, light, and the viewer. In the image below, I varied
|
||||||
|
$k_a$ between 0.2 and 1. Note how the overall color of the ball increases or
|
||||||
|
decreases in brightness when all other factors remain constant.
|
||||||
|
|
||||||
|
![Varying $k_a$](examples/ka-demo.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
## Varying $k_d$
|
## Varying $k_d$
|
||||||
|
|
||||||
![Varying $k_d$](examples/kd-demo.png){width=240px}
|
TODO
|
||||||
|
|
||||||
|
![Varying $k_d$](examples/kd-demo.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
## Varying $k_s$
|
## Varying $k_s$
|
||||||
|
|
||||||
![Varying $k_s$](examples/ks-demo.png){width=240px}
|
TODO
|
||||||
|
|
||||||
|
![Varying $k_s$](examples/ks-demo.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
## Varying $n$
|
## Varying $n$
|
||||||
|
|
||||||
![Varying $n$](examples/n-demo.png){width=240px}
|
$n$ is the exponent saying how big the radius of the specular highlight should
|
||||||
|
be. In the equation, increasing the exponent usually leads to smaller shines. In
|
||||||
|
the image below, I varied $n$ between 2 and 100. Note how the size of the shine
|
||||||
|
is more focused but covers a smaller area as $n$ increases.
|
||||||
|
|
||||||
|
![Varying $n$](examples/n-demo.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
|
## Multiple lights
|
||||||
|
|
||||||
|
Multiple lights are handled by multiplying each light against an intensity
|
||||||
|
level, and then added together. Unfortunately, this means that the intensity of
|
||||||
|
each light can't be too bright. We rely on the image to not use lights that are
|
||||||
|
too bright. Because this may result in color values above 1.0, the final value
|
||||||
|
is clamped against 1.0. Below is an example of a scene with two lights; one to
|
||||||
|
the left and one to the right:
|
||||||
|
|
||||||
|
![Multiple lights](examples/multiple-lights-demo.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
|
## Shadows
|
||||||
|
|
||||||
|
Shadows are implemented by pointing a second ray between the intersection point
|
||||||
|
of the original view ray and each light. If the light has something obstructing
|
||||||
|
it in the middle, the light's effect is not used.
|
||||||
|
|
||||||
|
The soft shadow effect is realized by jittering rays across an area. In my
|
||||||
|
implementation, a jitter radius of about 1.0 is used, and 75 rays are shot into
|
||||||
|
uniformly sampled points within that radius. This also has the side effect that
|
||||||
|
rays that are closer to the original ray are sampled more frequently. Each of
|
||||||
|
these rays produces either 0 or 1 depending on if it was obstructed by the
|
||||||
|
object. Taking the proportion of rays that hit as a coefficient for the shadow,
|
||||||
|
we can get some soft shadow effects like this:
|
||||||
|
|
||||||
|
![Soft shadows](examples/soft-shadow-demo.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
|
## Depth Cueing
|
||||||
|
|
||||||
|
Depth cueing is when the objects further from the viewer have a lower opacity to
|
||||||
|
"fade" into the background in some sense. A good example of this can be seen in
|
||||||
|
the image below; note how the objects are less and less bright the further they
|
||||||
|
are away from the eye.
|
||||||
|
|
||||||
|
![Depth cueing](examples/depth-cueing-demo.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
|
## Shortcomings of the model
|
||||||
|
|
||||||
|
The model cannot be used to represent TODO
|
||||||
|
|
||||||
# Arbitrary Objects
|
# Arbitrary Objects
|
||||||
|
|
||||||
![Varying $n$](examples/objects.png){width=240px}
|
![Objects in the scene](examples/objects.png){width=360px}
|
||||||
|
\
|
||||||
|
|
||||||
|
|
11
participation/2023-02-15.md
Normal file
11
participation/2023-02-15.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Participation Question 1
|
||||||
|
|
||||||
|
**What are the complications that you can imagine that results from including
|
||||||
|
the points on the side of the triangle in the triangle or not?**
|
||||||
|
|
||||||
|
_Hint: Two triangles that share a border may have problems._
|
||||||
|
|
||||||
|
# Participation Question 2
|
||||||
|
|
||||||
|
**When d11 \* d22 - d12 \* d12 = 0, the system will have no solution. When might
|
||||||
|
this happen, and what does it mean?**
|
Loading…
Reference in a new issue