Commit 595b0a7
authored
Fix spotlight basis (#20272)
# Objective
- Fix a visual regression introduced by #20191 where theres a slight
green line in lighting example between cube and plane
bestRanar:
> I know some minor shadow differences were expected after
> #20191
> But the new green line below the front face of the cube in lighting
seems interesting. Is that expected?
>
https://pixel-eagle.com/project/b25a040a-a980-4602-b90c-d480ab84076d/run/11500/compare/11494?screenshot=3D+Rendering/lighting.png
## Solution
It turns out, i accidentally unflipped the x and y axis in the basis
construction of spotlights to actually match the JCGT paper. This wasn't
something i realized at the time, but its just a handedness flip. This
means that the handedness flip Aceeri was asking about in #20191 which I
just extracted from the orthonormalize implementation was just there to
correct for a mistranslation in the original implementation, probably.
So this means we can just yeet it, because two handedness flips means
none at all. And indeed, removing the extra flip fixes the regression.
So now the code is more straightforward and understandable and it works
:D
Most of the diff is updating the comments to reflect this new knowledge.
## Testing
- lighting example1 parent f808216 commit 595b0a7
File tree
3 files changed
+5
-22
lines changed- crates
- bevy_light/src
- bevy_pbr/src/render
- bevy_render/src
3 files changed
+5
-22
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
| 174 | + | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 176 | + | |
179 | 177 | | |
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
183 | 181 | | |
184 | 182 | | |
185 | | - | |
186 | | - | |
187 | 183 | | |
188 | 184 | | |
189 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | 65 | | |
81 | 66 | | |
82 | 67 | | |
| |||
103 | 88 | | |
104 | 89 | | |
105 | 90 | | |
106 | | - | |
| 91 | + | |
107 | 92 | | |
108 | 93 | | |
109 | 94 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
0 commit comments