Skip to content

Commit 4eb6e45

Browse files
authored
use affine not mat4 inverse in light probes (#20708)
# Objective - keep it affine for better inverse ## Solution - ## Testing - reflection probes example
1 parent 56d37fa commit 4eb6e45

File tree

1 file changed

+3
-3
lines changed
  • crates/bevy_pbr/src/light_probe

1 file changed

+3
-3
lines changed

crates/bevy_pbr/src/light_probe/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ where
143143
C: LightProbeComponent,
144144
{
145145
// The transform from world space to light probe space.
146-
light_from_world: Mat4,
146+
light_from_world: Affine3A,
147147

148148
// The transform from light probe space to world space.
149149
world_from_light: Affine3A,
@@ -543,7 +543,7 @@ where
543543
) -> Option<LightProbeInfo<C>> {
544544
environment_map.id(image_assets).map(|id| LightProbeInfo {
545545
world_from_light: light_probe_transform.affine(),
546-
light_from_world: light_probe_transform.to_matrix().inverse(),
546+
light_from_world: light_probe_transform.affine().inverse(),
547547
asset_id: id,
548548
intensity: environment_map.intensity(),
549549
affects_lightmapped_mesh_diffuse: environment_map.affects_lightmapped_mesh_diffuse(),
@@ -633,7 +633,7 @@ where
633633
// Transpose the inverse transform to compress the structure on the
634634
// GPU (from 4 `Vec4`s to 3 `Vec4`s). The shader will transpose it
635635
// to recover the original inverse transform.
636-
let light_from_world_transposed = light_probe.light_from_world.transpose();
636+
let light_from_world_transposed = Mat4::from(light_probe.light_from_world).transpose();
637637

638638
// Write in the light probe data.
639639
self.render_light_probes.push(RenderLightProbe {

0 commit comments

Comments
 (0)