Class TLcdOGC3DTilesModelDecoder
java.lang.Object
com.luciad.format.tiled3d.ogc3dtiles.TLcdOGC3DTilesModelDecoder
- All Implemented Interfaces:
ILcdInputStreamFactoryCapable,ILcdModelDecoder
@LcdService(service=ILcdModelDecoder.class,
priority=20000)
public final class TLcdOGC3DTilesModelDecoder
extends Object
implements ILcdModelDecoder, ILcdInputStreamFactoryCapable
This model decoder decodes 3D Tiles tileset files to an
ILcdModel.
Input files
| File | Required | Entry point | Description |
|---|---|---|---|
| tileset.json/root.json | x | File containing the root tile metadata as well as links to the sub-tiles/content. | |
| *.json | Files containing sub-tile metadata as well as links to its sub-tiles/content. | ||
| *.glb | File containing Binary glTF content. See the OGC 3D Tiles specification for more information about this file. | ||
| *.b3dm | File containing Batched 3D Model data See the B3DM documentation for more information about this file. | ||
| *.pnts | File containing batched Point Cloud data See the PNTS documentation for more information about this file. | ||
| *.b3dm_lcd_link | File containing the necessary data for converting from OSGB to Batched 3D Model data. Link files are generated while preprocessing the OSGB dataset. | ||
| LuciadPC | Directory containing the necessary data for retrieving payloads from a Luciad Point Cloud dataset. |
Since all JSON files have the same structure, any of them could be used as entry point. However, only the tile of the JSON file and its children will be decoded.
Supported file transfer protocols
-
This model decoder supports all transfer protocols that are supported by
the
InputStreamFactoryof this decoder.
Model structure
- This model decoder creates a model per entry .json file.
-
This model decoder returns a single read-only
ILcd2DBoundsIndexedModel.
Model descriptor
-
When the tile set contains point cloud data (PNTS), the model descriptor will be an
ILcdDataModelDescriptor. Although the elements in the model are notdata objectsthemselves, you can still use the data model to access properties of individual points to buildexpressionsfor use in styling. UseILcdDataModelDescriptor.getModelTypes()to obtain the single data type that consists of the properties available in the PNTS data. - The type name of the model descriptor is "3D Tiles" for a 3D Tiles 1.0 dataset, and "3D Tiles 1.1" for a 3D Tiles 1.1 dataset.
Model reference
- The decoder assumes a Geocentric reference system.
Model elements
- Each decoded model contains elements that implement
Object.
Sample code
ILcdModelDecoder decoder = new TLcdOGC3DTilesModelDecoder();
ILcdModel model = decoder.decode("tileset.json");
Performance tips
- Due to the amount of data that can be loaded, the size of the textures can impact performance.
- Since OGC 3DTiles relies on a tree structure to determine which tile to load. This means the way this tree is built can impact performance. An ideal tree has enough level of details to avoid loading highly details at an early stage while loading those when fully zoomed-in.
Thread safety
- The decoding of models is thread-safe, as long as no properties are changed during the decoding.
- The decoded models are thread-safe for read access.
Supported versions and specifications
This decoder supports versions 1.0 and 1.1 of the OGC 3D Tiles specification. Specifically, it supports the decoding of:- The
tileset.jsonfile with full metadata support, including property values and ranges - The Batched 3D Model (B3DM) tile format, with glTF 1.0 and glTF 2.0 payloads (OGC 3D Tiles 1.0)
- The Point Cloud (PNTS) tile format (OGC 3D Tiles 1.0)
- The glTF 2.0 tile format (OGC 3D Tiles 1.1)
- EXT_mesh_gpu_instancing
- EXT_meshopt_compression
- KHR_binary_glTF
- KHR_draco_mesh_compression
- KHR_mesh_quantization
- KHR_texture_transform
extensionsRequired glTF property.
Known limitations
- The source file must be an external tileset (
.json) with batched 3D model (.b3dm), point cloud (.pnts) or binary glTF (.glb) contents. - B3DM tiles support is limited to single color-texture.
- B3DM tiles support does not include animations
- B3DM shading is limited to the base color.
- Embedded binary textures are supported. Externally referenced textures are not supported.
- Instanced 3D Model (I3DM) is not supported.
- Composite Tile Model (CMPT) is not supported.
- Complex, hierarchical batch table properties are not supported.
- There is no support for tilesets that hold multiple contents.
- Point cloud data in glTF format is not supported.
Requirements
- The current implementation requires native libraries.
Additional comments
- Since all JSON files have the same structure, any of them could be used as entry point. However, only the tile of the JSON file and its children will be decoded.
Example: decoding and visualizing OGC 3D Tiles data
//First create the model
ILcdModelDecoder decoder =
new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode("https://sampleservices.luciad.com/ogc/3dtiles/marseille-mesh/tileset.json");
//Create a layer for the model using the layer builder
ILspLayer layer = TLsp3DTileLayerBuilder.newBuilder()
.model(model)
.build();
//Add the layer to the Lightspeed view (an ILspView)
view.addLayer(layer);
- Since:
- 2018.0
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanDecodeSource(String aSourceName) Checks whether this model decoder can decode the specified data source.Creates a new model from the given data source.Returns a short, displayable name for the format that is decoded by thisILcdModelDecoder.Returns the input stream factory that is used.voidsetInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory) Sets the input stream factory to be used.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.model.ILcdModelDecoder
canDecodeSource, decodeModelMetadata, decodeModelMetadata, decodeSource, discoverDataSources
-
Field Details
-
TYPE_NAME_1_0
The type name for decoded 3D Tiles 1.0 models.- Since:
- 2024.0
- See Also:
-
TYPE_NAME_1_1
The type name for decoded 3D Tiles 1.1 models.- Since:
- 2024.0
- See Also:
-
TYPE_NAMES
The set of type names this model decoder can produce.- Since:
- 2024.0
-
TYPE_NAME
Deprecated.The type name for the decoded models. This is an alias forTYPE_NAME_1_0.- See Also:
-
-
Constructor Details
-
TLcdOGC3DTilesModelDecoder
public TLcdOGC3DTilesModelDecoder()
-
-
Method Details
-
getInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapableReturns the input stream factory that is used.- Specified by:
getInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Returns:
- the input stream factory that is used.
-
setInputStreamFactory
Description copied from interface:ILcdInputStreamFactoryCapableSets the input stream factory to be used.- Specified by:
setInputStreamFactoryin interfaceILcdInputStreamFactoryCapable- Parameters:
aInputStreamFactory- the input stream factory to be used.
-
getDisplayName
Description copied from interface:ILcdModelDecoderReturns a short, displayable name for the format that is decoded by thisILcdModelDecoder.- Specified by:
getDisplayNamein interfaceILcdModelDecoder- Returns:
- the displayable name of this
ILcdModelDecoder.
-
canDecodeSource
Description copied from interface:ILcdModelDecoderChecks whether this model decoder can decode the specified data source. It is acceptable for this method to returntruefor a source name whiledecodethrows an exception for that same source name.For performance reasons, we strongly recommend that this will only be a simple test. For example: check the file extension of a file, but not that the file exists or contains expected content.
- Specified by:
canDecodeSourcein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be verified; typically a file name or a URL.- Returns:
trueif this decoder can likely decode the data specified by the source name,falseotherwise.- See Also:
-
decode
Description copied from interface:ILcdModelDecoderCreates a new model from the given data source.- Specified by:
decodein interfaceILcdModelDecoder- Parameters:
aSourceName- the data source to be decoded; typically a file name or a URL.- Returns:
- A model containing the decoded data. While
nullis allowed, implementors are advised to throw an error instead. - Throws:
IOException- for any exceptions caused by IO problems or invalid data. Since decoding invalid data almost always results in RunTimeExceptions (NullPointerException, IndexOutOfBoundsException, IllegalArgumentException, ...) on unexpected places, implementations are advised to catch RuntimeExceptions in their decode() method, and wrap them into an IOException, as illustrated in the code snippet below.public ILcdModel decode( String aSourceName ) throws IOException { try (InputStream input = fInputStreamFactory.createInputStream(aSourceName)) { // Perform decoding ... } catch (RuntimeException e) { throw new IOException(e); } }- See Also:
-
TYPE_NAME_1_0,TYPE_NAME_1_1orTYPE_NAMESinstead.