Commit dd61227
useLargeWorldRendering on engine enables floatingOrigin and highMatrixPrecision. Add ability to useFloatingOrigin per-scene (#17334)
This PR solves 2 major bugs in floatingoriginmode.
- Previously I was updating the creationOptions object but that didn't
actually update the underlying performanceConfigurator's precision, so
we were getting CPU-side calculation imprecision.
- Additionally, the floatingOriginOffset value was tied to the most
recently created scene's active camera, and didn't support multi-scene.
After this change:
- engine creation **useLargeWorldRendering** will both set
useHighPrecisionMatrix on engine and set all scenes to useFloatingOrigin
upon creation
- scene creation **useFloatingOrigin** can be used instead of the above
if user wants only some scenes to useFloatingOrigin (doing this can
improve perf for scenes that are not large worlds as we skip matrix
offsetting). If this option is used, must be used in conjunction with
engine's useHighPrecisionMatrix to achieve full precision)
- offset will always be tied to the current rendering scene's active
camera
Tested with this playground [#P3E9YP#255
](https://playground.babylonjs.com/?snapshot=refs/pull/17334/merge#P3E9YP#255)
which enables swapping between scenes and testing combinations of
floatingOrigin on / off
---------
Co-authored-by: Georgina Halpern <[email protected]>1 parent 836516f commit dd61227
File tree
4 files changed
+71
-33
lines changed- packages
- dev/core/src
- Engines
- Materials
- tools/tests/test/visualization
4 files changed
+71
-33
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
| 136 | + | |
136 | 137 | | |
137 | 138 | | |
138 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
139 | 151 | | |
140 | 152 | | |
141 | 153 | | |
| |||
2019 | 2031 | | |
2020 | 2032 | | |
2021 | 2033 | | |
| 2034 | + | |
2022 | 2035 | | |
2023 | 2036 | | |
2024 | 2037 | | |
| |||
2037 | 2050 | | |
2038 | 2051 | | |
2039 | 2052 | | |
2040 | | - | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
2041 | 2056 | | |
2042 | 2057 | | |
2043 | 2058 | | |
| |||
Lines changed: 21 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
78 | | - | |
| 84 | + | |
79 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
80 | 92 | | |
81 | 93 | | |
82 | | - | |
| 94 | + | |
83 | 95 | | |
84 | 96 | | |
85 | 97 | | |
86 | | - | |
| 98 | + | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
90 | | - | |
| 102 | + | |
91 | 103 | | |
92 | 104 | | |
93 | 105 | | |
| |||
106 | 118 | | |
107 | 119 | | |
108 | 120 | | |
109 | | - | |
110 | | - | |
| 121 | + | |
| 122 | + | |
111 | 123 | | |
112 | | - | |
| 124 | + | |
113 | 125 | | |
114 | 126 | | |
115 | | - | |
| 127 | + | |
116 | 128 | | |
117 | | - | |
| 129 | + | |
118 | 130 | | |
119 | 131 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 139 | | |
143 | 140 | | |
144 | | - | |
145 | | - | |
146 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
147 | 146 | | |
148 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
149 | 151 | | |
150 | 152 | | |
151 | 153 | | |
| |||
2016 | 2018 | | |
2017 | 2019 | | |
2018 | 2020 | | |
2019 | | - | |
2020 | | - | |
2021 | | - | |
2022 | | - | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
2023 | 2024 | | |
2024 | 2025 | | |
2025 | 2026 | | |
| |||
2779 | 2780 | | |
2780 | 2781 | | |
2781 | 2782 | | |
2782 | | - | |
| 2783 | + | |
2783 | 2784 | | |
2784 | 2785 | | |
2785 | | - | |
2786 | | - | |
2787 | | - | |
| 2786 | + | |
| 2787 | + | |
2788 | 2788 | | |
2789 | 2789 | | |
2790 | | - | |
| 2790 | + | |
2791 | 2791 | | |
2792 | 2792 | | |
2793 | 2793 | | |
| |||
5340 | 5340 | | |
5341 | 5341 | | |
5342 | 5342 | | |
| 5343 | + | |
| 5344 | + | |
| 5345 | + | |
5343 | 5346 | | |
5344 | 5347 | | |
5345 | 5348 | | |
| |||
5354 | 5357 | | |
5355 | 5358 | | |
5356 | 5359 | | |
| 5360 | + | |
| 5361 | + | |
| 5362 | + | |
5357 | 5363 | | |
5358 | 5364 | | |
5359 | 5365 | | |
| |||
5684 | 5690 | | |
5685 | 5691 | | |
5686 | 5692 | | |
| 5693 | + | |
| 5694 | + | |
| 5695 | + | |
| 5696 | + | |
| 5697 | + | |
| 5698 | + | |
| 5699 | + | |
5687 | 5700 | | |
5688 | 5701 | | |
5689 | 5702 | | |
| |||
5758 | 5771 | | |
5759 | 5772 | | |
5760 | 5773 | | |
5761 | | - | |
5762 | | - | |
5763 | 5774 | | |
5764 | 5775 | | |
5765 | 5776 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2857 | 2857 | | |
2858 | 2858 | | |
2859 | 2859 | | |
2860 | | - | |
| 2860 | + | |
2861 | 2861 | | |
2862 | 2862 | | |
2863 | 2863 | | |
| |||
2871 | 2871 | | |
2872 | 2872 | | |
2873 | 2873 | | |
2874 | | - | |
| 2874 | + | |
2875 | 2875 | | |
2876 | 2876 | | |
2877 | 2877 | | |
| |||
2885 | 2885 | | |
2886 | 2886 | | |
2887 | 2887 | | |
2888 | | - | |
| 2888 | + | |
2889 | 2889 | | |
2890 | 2890 | | |
2891 | 2891 | | |
| |||
0 commit comments