Add dielectric pbrt material
This commit is contained in:
parent
0480e041cd
commit
2269bd102d
5 changed files with 43 additions and 27 deletions
15
ray-tracing-core/src/math/material.rs
Normal file
15
ray-tracing-core/src/math/material.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use crate::prelude::*;
|
||||
|
||||
pub fn fresnel_real(cos_theta_in: Float, nu1: Float, nu2: Float) -> Float {
|
||||
let nu_rel = nu1 / nu2;
|
||||
let cos_theta_tr = Float::sqrt(1.0 - nu_rel * nu_rel * (1.0 - cos_theta_in * cos_theta_in));
|
||||
|
||||
let rs = ((nu1 * cos_theta_in - nu2 * cos_theta_tr)
|
||||
/ (nu1 * cos_theta_in + nu2 * cos_theta_tr))
|
||||
.powi(2);
|
||||
let rp = ((nu1 * cos_theta_tr - nu2 * cos_theta_in)
|
||||
/ (nu1 * cos_theta_tr + nu2 * cos_theta_in))
|
||||
.powi(2);
|
||||
|
||||
0.5 * (rs + rp)
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
pub mod dir3;
|
||||
pub mod frame;
|
||||
pub mod mat3;
|
||||
pub mod material;
|
||||
pub mod pos3;
|
||||
pub mod sampling;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue