Skip to content

Commit

Permalink
Optimize textured material brdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Oom committed Aug 28, 2024
1 parent 428c028 commit ef3fd9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tracing/src/material.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use glam::{Vec2, Vec3};
use image::Rgb32FImage;
use image::{GenericImageView, Rgb32FImage};
use rand::{rngs::SmallRng, Rng};
use scene::material::Material;

Expand Down Expand Up @@ -84,7 +84,7 @@ fn diffuse_reflective_brdf(
if let Some(texture) = &texture {
let px = (texture.width() as f32 * outgoing.uv.x).floor();
let py = (texture.height() as f32 * outgoing.uv.y).floor();
let reflectance: Vec3 = texture[(px as u32, py as u32)].0.into();
let reflectance = Vec3::from(unsafe { texture.unsafe_get_pixel(px as u32, py as u32).0 });
reflectance * std::f32::consts::FRAC_1_PI
} else {
reflectance * std::f32::consts::FRAC_1_PI
Expand Down

0 comments on commit ef3fd9c

Please sign in to comment.