diff --git a/blade-graphics/src/vulkan/resource.rs b/blade-graphics/src/vulkan/resource.rs index d1dd720..089219b 100644 --- a/blade-graphics/src/vulkan/resource.rs +++ b/blade-graphics/src/vulkan/resource.rs @@ -323,7 +323,7 @@ impl crate::traits::ResourceDevice for super::Context { image: texture.raw, view_type: map_view_dimension(desc.dimension), format: super::map_texture_format(desc.format), - subresource_range: subresource_range, + subresource_range, ..Default::default() }; diff --git a/blade-render/code/fill-gbuf.wgsl b/blade-render/code/fill-gbuf.wgsl index a2f3e3d..29b1f3e 100644 --- a/blade-render/code/fill-gbuf.wgsl +++ b/blade-render/code/fill-gbuf.wgsl @@ -126,7 +126,8 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { if ((debug.texture_flags & DebugTextureFlags_NORMAL) != 0u) { normal_local = vec3(0.0, 0.0, 1.0); // ignore normal map } else { - let n_xy = entry.normal_scale * textureSampleLevel(textures[entry.normal_texture], sampler_linear, tex_coords, lod).xy; + let raw_unorm = textureSampleLevel(textures[entry.normal_texture], sampler_linear, tex_coords, lod).xy; + let n_xy = entry.normal_scale * (2.0 * raw_unorm - 1.0); normal_local = vec3(n_xy, sqrt(max(0.0, 1.0 - dot(n_xy, n_xy)))); } var normal = qrot(geo_to_world_rot, tangent_space_geo * normal_local); @@ -185,7 +186,7 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { if (debug.view_mode == DebugMode_NormalTexture) { textureStore(out_debug, global_id.xy, vec4(normal_local, 0.0)); } - if (debug.view_mode == DebugMode_NormalFactor) { + if (debug.view_mode == DebugMode_NormalScale) { textureStore(out_debug, global_id.xy, vec4(entry.normal_scale)); } if (debug.view_mode == DebugMode_GeometryNormal) { diff --git a/blade-render/src/model/mod.rs b/blade-render/src/model/mod.rs index feb809e..b421d5a 100644 --- a/blade-render/src/model/mod.rs +++ b/blade-render/src/model/mod.rs @@ -15,7 +15,8 @@ const META_BASE_COLOR: crate::texture::Meta = crate::texture::Meta { y_flip: false, }; const META_NORMAL: crate::texture::Meta = crate::texture::Meta { - format: blade_graphics::TextureFormat::Bc5Snorm, + //Note: "texpresso" doesn't know how to produce signed normalized + format: blade_graphics::TextureFormat::Bc5Unorm, generate_mips: false, y_flip: false, }; diff --git a/blade-render/src/render/mod.rs b/blade-render/src/render/mod.rs index 420794e..4bbedf2 100644 --- a/blade-render/src/render/mod.rs +++ b/blade-render/src/render/mod.rs @@ -51,7 +51,7 @@ pub enum DebugMode { DiffuseAlbedoTexture = 2, DiffuseAlbedoFactor = 3, NormalTexture = 4, - NormalFactor = 5, + NormalScale = 5, GeometryNormal = 6, ShadingNormal = 7, Motion = 8,