Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/bevy_solari/src/pathtracer/pathtracer.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn pathtrace(@builtin(global_invocation_id) global_id: vec3<u32>) {
}

// Sample new ray direction from the material BRDF for next bounce and apply BRDF
let next_bounce = evaluate_and_sample_brdf(wo, ray_hit.world_normal, ray_hit.world_tangent, ray_hit.material, &rng);
let next_bounce = evaluate_and_sample_brdf(wo, ray_hit.world_normal, ray_hit.material, &rng);
if next_bounce.pdf == 0.0 { break; }
ray_direction = next_bounce.wi;
ray_origin = ray_hit.world_position + (ray_hit.geometric_world_normal * RAY_T_MIN);
Expand Down
5 changes: 2 additions & 3 deletions crates/bevy_solari/src/scene/brdf.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ enable wgpu_ray_query;
#import bevy_pbr::lighting::{D_GGX, V_SmithGGXCorrelated, specular_multiscatter}
#import bevy_pbr::pbr_functions::{calculate_tbn_mikktspace, calculate_diffuse_color, calculate_F0}
#import bevy_pbr::utils::{rand_f, sample_cosine_hemisphere}
#import bevy_render::maths::PI
#import bevy_render::maths::{PI, orthonormalize}
#import bevy_solari::sampling::{sample_ggx_vndf, ggx_vndf_pdf, ggx_vndf_sample_invalid}
#import bevy_solari::scene_bindings::{ResolvedMaterial, MIRROR_ROUGHNESS_THRESHOLD, brdf_dfg_lut, brdf_dfg_lut_sampler}

Expand All @@ -19,7 +19,6 @@ struct EvaluateAndSampleBrdfResult {
fn evaluate_and_sample_brdf(
wo: vec3<f32>,
world_normal: vec3<f32>,
world_tangent: vec4<f32>,
material: ResolvedMaterial,
rng: ptr<function, u32>,
) -> EvaluateAndSampleBrdfResult {
Expand All @@ -31,7 +30,7 @@ fn evaluate_and_sample_brdf(
let diffuse_weight = mix(df, 0.0, material.metallic);
let specular_weight = 1.0 - diffuse_weight;

let TBN = calculate_tbn_mikktspace(world_normal, world_tangent);
let TBN = orthonormalize(world_normal);
let T = TBN[0];
let B = TBN[1];
let N = TBN[2];
Expand Down