Skip to content

Commit

Permalink
and using them
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Feb 28, 2024
1 parent 91d4dde commit 41c0a57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion crates/bevy_pbr/src/render/pbr_fragment.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ fn pbr_input_from_standard_material(
let NdotV = max(dot(pbr_input.N, pbr_input.V), 0.0001);

#ifdef VERTEX_UVS
let uv_transform = mat3x3<f32>(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
let uv_transform = mat3x3<f32>(
pbr_bindings::material.uv_transform_x.x, pbr_bindings::material.uv_transform_x.y, pbr_bindings::material.uv_transform_x.z,
pbr_bindings::material.uv_transform_y.x, pbr_bindings::material.uv_transform_y.y, pbr_bindings::material.uv_transform_y.z,
0.0, 0.0, 1.0
);
var uv = (uv_transform * vec3(in.uv, 1.0)).xy;

#ifdef VERTEX_TANGENTS
Expand Down
6 changes: 5 additions & 1 deletion crates/bevy_pbr/src/render/pbr_prepass_functions.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ fn prepass_alpha_discard(in: VertexOutput) {
var output_color: vec4<f32> = pbr_bindings::material.base_color;

#ifdef VERTEX_UVS
let uv_transform = mat3x3<f32>(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
let uv_transform = mat3x3<f32>(
pbr_bindings::material.uv_transform_x.x, pbr_bindings::material.uv_transform_x.y, pbr_bindings::material.uv_transform_x.z,
pbr_bindings::material.uv_transform_y.x, pbr_bindings::material.uv_transform_y.y, pbr_bindings::material.uv_transform_y.z,
0.0, 0.0, 1.0
);
let uv = (uv_transform * vec3(in.uv, 1.0)).xy;
if (pbr_bindings::material.flags & pbr_types::STANDARD_MATERIAL_FLAGS_BASE_COLOR_TEXTURE_BIT) != 0u {
output_color = output_color * textureSampleBias(pbr_bindings::base_color_texture, pbr_bindings::base_color_sampler, uv, view.mip_bias);
Expand Down

0 comments on commit 41c0a57

Please sign in to comment.