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.
*.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 InputStreamFactory of 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 not data objects themselves, you can still use the data model to access properties of individual points to build expressions for use in styling. Use ILcdDataModelDescriptor.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 version 1.0 of the OGC 3D Tiles specification. Specifically, it supports:
  • Decoding tileset.json with full metadata support, including property values and ranges
  • B3DM payloads
  • Both GLTF 1.0 and GLTF 2.0 in the B3DM payloads
  • PNTS payloads
There is partial support for version 1.1. It is possible to decode a 1.1 model, but the model cannot be visualized in a LuciadLightspeed view. However, you can serve the model using a LuciadFusion OGC 3D Tiles service, and then visualize it using LuciadRIA.

Known limitations

  • The source file must be an external tileset (.json) with batched 3D model (.b3dm) or point cloud (.pnts) 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.
  • 3D Tiles 1.1 tilesets can be decoded but not visualized.

Requirements

  • The current implementation requires JRE 1.2 or higher.
  • 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 Details

  • Constructor Details

    • TLcdOGC3DTilesModelDecoder

      public TLcdOGC3DTilesModelDecoder()
  • Method Details

    • getInputStreamFactory

      public ILcdInputStreamFactory getInputStreamFactory()
      Description copied from interface: ILcdInputStreamFactoryCapable
      Returns the input stream factory that is used.
      Specified by:
      getInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Returns:
      the input stream factory that is used.
    • setInputStreamFactory

      public void setInputStreamFactory(ILcdInputStreamFactory aInputStreamFactory)
      Description copied from interface: ILcdInputStreamFactoryCapable
      Sets the input stream factory to be used.
      Specified by:
      setInputStreamFactory in interface ILcdInputStreamFactoryCapable
      Parameters:
      aInputStreamFactory - the input stream factory to be used.
    • getDisplayName

      public String getDisplayName()
      Description copied from interface: ILcdModelDecoder
      Returns a short, displayable name for the format that is decoded by this ILcdModelDecoder.
      Specified by:
      getDisplayName in interface ILcdModelDecoder
      Returns:
      the displayable name of this ILcdModelDecoder.
    • canDecodeSource

      public boolean canDecodeSource(String aSourceName)
      Description copied from interface: ILcdModelDecoder
      Checks whether this model decoder can decode the specified data source. It is acceptable for this method to return true for a source name while decode throws 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:
      canDecodeSource in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be verified; typically a file name or a URL.
      Returns:
      true if this decoder can likely decode the data specified by the source name, false otherwise.
      See Also:
    • decode

      public ILcdModel decode(String aSourceName) throws IOException
      Description copied from interface: ILcdModelDecoder
      Creates a new model from the given data source.
      Specified by:
      decode in interface ILcdModelDecoder
      Parameters:
      aSourceName - the data source to be decoded; typically a file name or a URL.
      Returns:
      A model containing the decoded data. While null is 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: