Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix normals loading #187

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 6 additions & 5 deletions blade-render/code/fill-gbuf.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,12 @@ fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
debug_buf.entry.flat_normal = flat_normal;
}
if (enable_debug && (debug.draw_flags & DebugDrawFlags_SPACE) != 0u) {
let normal_len = 0.15 * intersection.t;
let side = 0.05 * intersection.t;
debug_line(hit_position, hit_position + normal_len * qrot(geo_to_world_rot, normal_geo), 0xFFFFFFu);
debug_line(hit_position - side * tangent_geo, hit_position + side * tangent_geo, 0x808080u);
debug_line(hit_position - side * bitangent_geo, hit_position + side * bitangent_geo, 0x808080u);
let normal_w = 0.15 * intersection.t * qrot(geo_to_world_rot, normal_geo);
let tangent_w = 0.05 * intersection.t * qrot(geo_to_world_rot, tangent_geo);
let bitangent_w = 0.05 * intersection.t * qrot(geo_to_world_rot, bitangent_geo);
debug_line(hit_position, hit_position + normal_w, 0xFFFFFFu);
debug_line(hit_position - tangent_w, hit_position + tangent_w, 0x808080u);
debug_line(hit_position - bitangent_w, hit_position + bitangent_w, 0x808080u);
}
if (enable_debug && (debug.draw_flags & DebugDrawFlags_GEOMETRY) != 0u) {
let debug_len = intersection.t * 0.2;
Expand Down
2 changes: 1 addition & 1 deletion blade-render/src/model/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
borrow::Cow,
collections::hash_map::{Entry, HashMap},

Check warning on line 3 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (MacOS, macos-latest, x86_64-apple-darwin)

unused imports: `Entry` and `HashMap`

Check warning on line 3 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Linux, ubuntu-latest, x86_64-unknown-linux-gnu)

unused imports: `Entry` and `HashMap`

Check warning on line 3 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Windows, windows-latest, x86_64-pc-windows-msvc)

unused imports: `Entry` and `HashMap`
fmt, hash, mem,
ops::Range,
ptr, str,
Expand Down Expand Up @@ -485,11 +485,11 @@

fn cook(
&self,
source: &[u8],

Check warning on line 488 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (MacOS, macos-latest, x86_64-apple-darwin)

unused variable: `source`

Check warning on line 488 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Linux, ubuntu-latest, x86_64-unknown-linux-gnu)

unused variable: `source`

Check warning on line 488 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Windows, windows-latest, x86_64-pc-windows-msvc)

unused variable: `source`
extension: &str,
meta: Meta,

Check warning on line 490 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (MacOS, macos-latest, x86_64-apple-darwin)

unused variable: `meta`

Check warning on line 490 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Linux, ubuntu-latest, x86_64-unknown-linux-gnu)

unused variable: `meta`

Check warning on line 490 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Windows, windows-latest, x86_64-pc-windows-msvc)

unused variable: `meta`
cooker: Arc<blade_asset::Cooker<Self>>,

Check warning on line 491 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (MacOS, macos-latest, x86_64-apple-darwin)

unused variable: `cooker`

Check warning on line 491 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Linux, ubuntu-latest, x86_64-unknown-linux-gnu)

unused variable: `cooker`

Check warning on line 491 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Windows, windows-latest, x86_64-pc-windows-msvc)

unused variable: `cooker`
exe_context: &choir::ExecutionContext,

Check warning on line 492 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (MacOS, macos-latest, x86_64-apple-darwin)

unused variable: `exe_context`

Check warning on line 492 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Linux, ubuntu-latest, x86_64-unknown-linux-gnu)

unused variable: `exe_context`

Check warning on line 492 in blade-render/src/model/mod.rs

View workflow job for this annotation

GitHub Actions / build (Windows, windows-latest, x86_64-pc-windows-msvc)

unused variable: `exe_context`
) {
match extension {
#[cfg(feature = "asset")]
Expand Down Expand Up @@ -549,7 +549,7 @@
},
base_color_factor: pbr.base_color_factor(),
normal: TextureReference {
source_index: match pbr.base_color_texture() {
source_index: match g_material.normal_texture() {
Some(info) => sources.insert(self.cook_texture(
info.texture(),
META_NORMAL,
Expand Down
2 changes: 1 addition & 1 deletion examples/scene/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl Example {
scene_revision: 0,
camera: ControlledCamera::default(),
debug: blade_render::DebugConfig::default(),
track_hot_reloads: false,
track_hot_reloads: true,
need_accumulation_reset: true,
is_point_selected: false,
is_file_hovered: false,
Expand Down
Loading