@jdultra/threedtiles 11.0.0 → 11.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -100,6 +100,8 @@ Contact: emeric.beaufays@jdultra.com
100
100
  - Center tileset and re-orient geolocated data
101
101
  - draco and ktx2 compression support
102
102
  - point clouds (only through gltf/glb tiles)
103
+ - loading strategy options ("incremental" or "immediate)
104
+
103
105
 
104
106
  OGC3DTiles 1.1 are supported.
105
107
  There is no plan to support .pnts, .i3dm or .cmpt tiles as these formats are deprecated in favor of glb/gltf tiles.
@@ -126,6 +128,56 @@ Many viewers use the maxScreenSpaceError instead of a geometric error multiplier
126
128
  A geometricErrorMultiplier of 1 corresponds to a maxScreenSpaceError of 16.
127
129
  A geometricErrorMultiplier of 0.5 corresponds to a maxScreenSpaceError of 32.
128
130
 
131
+ #### distance bias
132
+ The distance bias allows loading more or less detail close to the camera relative to further away.
133
+ The distance bias simply applies an exponent on tile distance to the camera so you have to balance it out manually with the geometricErrorMultiplier.
134
+
135
+ For example, if you want to load more detail close to the camera, you might do something like this:
136
+ ```
137
+ const ogc3DTile = new OGC3DTile({
138
+ url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
139
+ renderer: renderer,
140
+ geometricErrorMultiplier: 10.0,
141
+ distanceBias: 1.5
142
+ });
143
+ ```
144
+ In this case the higher distance bias will cause less detail to be loaded overall since all calculated distances get raised to the power 1.5.
145
+ To compensate, the geometricErrorMultiplier is set at a higher value.
146
+
147
+ These values need to be adjusted manually based on what is considered relatively close or far from the camera and truly depends on your scene and the relative distance of the camera to the tiles during normal navigation. In other words, it's impossible to have magic bullet values the LOD switch distance can be fine-tuned through those parameters.
148
+
149
+ You can change the distance bias for a tileset at any time:
150
+
151
+ ```
152
+ tileset.setDistanceBias(1.5);
153
+ ```
154
+ ### loading strategy
155
+
156
+ #### Incremental
157
+ Incremental loading is the default and loads all intermediate levels incrementally and keeps them in memory. While this gives a direct feedback on loading progress, the CPU memory footprint is large and overall loading speed is slower than with "immediate" mode.
158
+
159
+ To explicitely set the incremental loading strategy:
160
+ ```
161
+ const ogc3DTile = new OGC3DTile({
162
+ url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
163
+ renderer: renderer,
164
+ loadingStrategy: "INTERMEDIATE"
165
+ });
166
+ ```
167
+
168
+ #### Immediate
169
+
170
+ Immediate loading skips intermediate LODs and immediately loads the ideal LOD. Less data is downloaded (faster load time) and less data is kept in CPU memory but holes will appear until the tiles are loaded.
171
+
172
+ To set the immediate loading strategy:
173
+ ```
174
+ const ogc3DTile = new OGC3DTile({
175
+ url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
176
+ renderer: renderer,
177
+ loadingStrategy: "IMMEDIATE"
178
+ });
179
+ ```
180
+
129
181
  ### load tiles outside of view
130
182
  By default, only the tiles that intersect the view frustum are loaded. When the camera moves, the scene will have to load the missing tiles and the user might see some holes in the model.
131
183
  Instead of this behaviour, you can force the lowest possible LODs to be loaded for tiles outside the view so that there are no gaps in the mesh when the camera moves. This also allows displaying shadows from parts of the scene that are not in the view.
@@ -137,6 +189,16 @@ const ogc3DTile = new OGC3DTile({
137
189
  loadOutsideView: true
138
190
  });
139
191
  ```
192
+ ### draw bounding volume
193
+
194
+ Draw bounding volumes around visible tiles
195
+ ```
196
+ const ogc3DTile = new OGC3DTile({
197
+ url: "https://storage.googleapis.com/ogc-3d-tiles/ayutthaya/tileset.json",
198
+ renderer: renderer,
199
+ drawBoundingVolume: true
200
+ });
201
+ ```
140
202
 
141
203
  ### Google Maps 3D Tiles
142
204
  Google maps 3DTiles can be loaded similarly.
@@ -151,6 +213,29 @@ const ogc3DTile = new OGC3DTile({
151
213
  loadOutsideView: true
152
214
  });
153
215
  ```
216
+
217
+ #### Copyright info
218
+
219
+ This is mostly specific to google tiles but may be used by other vendors.
220
+
221
+ Google requires that, copyright info for producers of the 3D data be displayed.
222
+ A global function #getOGC3DTilesCopyrightInfo returns the list of vendors that need to be displayed.
223
+
224
+ ```
225
+ import { OGC3DTile, getOGC3DTilesCopyrightInfo } from "./tileset/OGC3DTile";
226
+
227
+ ...
228
+
229
+ animate(){
230
+ requestAnimationFrame( animate );
231
+ googleTiles.update(camera);
232
+ tileLoader.update();
233
+ ...
234
+ console.log(getOGC3DTilesCopyrightInfo());
235
+ }
236
+
237
+ ```
238
+
154
239
  ### Callback
155
240
 
156
241
  #### onLoadCallback
@@ -182,6 +267,36 @@ const ogc3DTile = new OGC3DTile({
182
267
  });
183
268
  ```
184
269
 
270
+ #### Update
271
+
272
+ Calling OGC3DTile#update gives a direct feedback on the state of the tileset:
273
+ ```
274
+ function animate() {
275
+ requestAnimationFrame(animate);
276
+
277
+ ogc3DTile.update(camera); // computes what tiles need to be refined and what tiles can be disposed.
278
+ const state = ogc3DTile.tileLoader.update(); // downloads, loads and caches tiles in optimal order.
279
+ }
280
+ ```
281
+
282
+ In the example above, the "state" object may look like this:
283
+
284
+ ```
285
+ {
286
+ numTilesLoaded: 82,
287
+ numTilesRendered: 82,
288
+ maxLOD: 9,
289
+ percentageLoaded: 1
290
+ }
291
+ ```
292
+
293
+ - "numTilesLoaded" gives the number of tiles in the tileset that are loaded and should be visible (including intermediate LODs for the "incremental" loading strategy).
294
+ - "numTilesRendered gives the number of tiles currently rendered.
295
+ - "maxLOD" highest LOD currently rendered
296
+ - "percentageLoaded" property gives an indication of the loading progress. Note that the loading progress may go back and forth a bit while the tree is being expanded but a value of 1 means the tileset is loaded.
297
+
298
+
299
+
185
300
  #### Points callback
186
301
  Add a callback on loaded point tiles in order to set a material or do some logic on the points.
187
302
 
package/dist/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,user-scalable=no,minimum-scale=1,maximum-scale=1"><title>Three 3DTiles viewer sample</title><style>.slidecontainer{width:100%}.slider{-webkit-appearance:none;width:100%;height:15px;border-radius:5px;background:#d3d3d3;outline:0;opacity:.7;-webkit-transition:.2s;transition:opacity .2s}.slider:hover{opacity:1}.slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:25px;height:25px;border-radius:50%;background:#0439aa;cursor:pointer}.slider::-moz-range-thumb{width:25px;height:25px;border-radius:50%;background:#04aa6d;cursor:pointer}</style></head><body><div id="screen"></div><div style="position:absolute;top:1%;z-index:1000;right:1%"><input type="range" min="0.01" max="2.0" value="0.5" , step="0.01" class="slider" id="lodMultiplier"><p style="color:#0439aa">detail multiplier: <span id="multiplierValue">0.5</span></p></div><div style="position:absolute;top:9%;z-index:1000;right:1%"><input type="range" min="10" max="200" value="200" , step="1" class="slider" id="targetFPS"><p style="color:#0439aa">target fps: <span id="targetFPSValue">200</span></p></div><div style="position:absolute;top:18%;z-index:1000;right:1%"><input type="checkbox" id="autorotate"> <span style="color:#0439aa">Auto Rotate</span></div><script src="threedtiles.min.js"></script></body></html>
1
+ <!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,user-scalable=no,minimum-scale=1,maximum-scale=1"><title>Three 3DTiles viewer sample</title><style>.slidecontainer{width:100%}.slider{-webkit-appearance:none;width:100%;height:15px;border-radius:5px;background:#d3d3d3;outline:0;opacity:.7;-webkit-transition:.2s;transition:opacity .2s}.slider:hover{opacity:1}.slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:25px;height:25px;border-radius:50%;background:#0439aa;cursor:pointer}.slider::-moz-range-thumb{width:25px;height:25px;border-radius:50%;background:#04aa6d;cursor:pointer}</style></head><body><div id="screen"></div><div style="position:absolute;top:1%;z-index:1000;right:1%"><input type="range" min="0.01" max="50.0" value="0.5" , step="0.01" class="slider" id="lodMultiplier"><p style="color:#0439aa">detail multiplier: <span id="multiplierValue">0.5</span></p></div><div style="position:absolute;top:9%;z-index:1000;right:1%"><input type="range" min="0.5" max="1.5" value="1.0" , step="0.01" class="slider" id="distanceBias"><p style="color:#0439aa">distance bias: <span id="distanceBiasValue">1.0</span></p></div><div style="position:absolute;top:17%;z-index:1000;right:1%"><input type="range" min="10" max="200" value="200" , step="1" class="slider" id="targetFPS"><p style="color:#0439aa">target fps: <span id="targetFPSValue">200</span></p></div><div style="position:absolute;top:26%;z-index:1000;right:1%"><input type="checkbox" id="autorotate"> <span style="color:#0439aa">Auto Rotate</span></div><script src="threedtiles.min.js"></script></body></html>