• Stars
    star
    223
  • Rank 177,660 (Top 4 %)
  • Language
    C#
  • License
    Other
  • Created over 5 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A 3D Tiles implementation in Unity

Unity3DTiles

Unity3DTiles is a Unity based implementation of the 3DTiles open format for streaming and rendering large static models such as those generated by photogrammetry pipelines. The benefit of the 3D Tiles specification is that it allows one generic rendering implementation to support datasets tiled using a number of different data structures such as binary, quad, or oct trees. It also supports sparse data representations so it can adapt well to datasets with variable detail density.

Implementation Details

Reference information about the object model and tree traversal algorithm can be found here.

Supported Features

Please note that since initial development completed, the 3d-tiles specification has evolved. The tileset.json schema use is now modestly out of date and should be updated in the near future.

Tile Format Support

  • Batched b3dm
  • Instanced i3dm
  • Point Cloud pnts - Implemented but untested
  • Composite cmt

Tileset Feature Support

  • Bounding Volumes
    • Sphere
    • Box
    • Region
  • viewerRequestVolume
  • Geometric Error - possible minor bugs in calculation
  • Tile.Content
  • Transforms - Basic support but does not handle changes after load
  • Add Refinement
  • Replace Refinement
  • Frustum culling
  • Tree traversal
  • Recursive tilesets

Dependencies

  • Unity3DTiles depends on the C-Sharp-Promise Library whose DLL has been imbedded in the plugins directory of this project.
  • This project utilizes an automatically generated schema to parse the 3D Tiles format. Instructions for updating this schema can be found here.
  • This project also depends on UnityGLTF. To simplify usage and avoid compilation issues for different platforms, a version of the UnityGLTF package has been checked into the Assets/UnityGLTF folder so that users do not need to build it independently. Some minor modifications to the UnityGLTF package were necessary. The modifications as well as the procedure for updating the package can be found here.
  • The Newtonsoft Json.NET package from the Unity Asset Store has been installed to support efficient deserialization of json.

Scenes

This project contains several sample scenes.

  • MainWeb - Loads a sample tileset with settings tuned for web
  • MainHololens - Similar to MainWeb but tuned for HoloLens. Contains a few HoloLens specific configuration scripts
  • GenericWeb - Builds a generic web package that can ingest tilesets dynamically from URL parameters
  • SampleModelLoader - Used to test loading different tile formats such as GLTF, GLTB, and B3DM

To import into your own project, simply copy the following folders

  • Unity3DTiles
  • UnityGLTF
  • JsonDotNet
  • Plugins
  • Resources

Configuration

To get started, simply add a TilesetBehaviour to an empty game object. You can configure the TilesetBehaviour renderer using the SceneOptions and TilesetOptions objects. The Url parameter is typically an HTTP url but in the examples we have added a script to convert a StreamingAsset relative path to a full path at runtime so that the example assets can be included along with the code.

Scene Options

  • Maximum Tiles To Process Per Frame - Loading large numbers of tiles per frame can decrease load times but introduce choppy performance (especially on the web) when many tiles are being loaded at once.
  • Cache Target Size - Controls the total number of tiles that will be kept in memory at any given time. The cache can exceed this size if more tiles are need to render the current viewpoint. Setting this too low will mean tiles are constantly re-requested and impact performance when changing views. Setting this too high will result in more memory being used which can cause crashes on platforms such as the web or hololens.
  • Cache Max Size - Sets the target maximum number of tiles that can be loaded into memory at any given time. Beyond this limit, unused tiles will be unloaded as new requests are made.
  • Max Cache Unload Ratio - Controls the number of tiles that will be unloaded per frame when the cache becomes too full. Setting too high can cause choppy performance. Setting too low will slow the loading of new tiles as they will wait for old tiles to be unloaded.
  • Max Concurrent Requests - Manages how many downloads can occurs simultaneously. Larger results in faster load times but this should be tuned for the particular platform you are deploying to.
  • Clipping cameras - the set of cameras that should be used to determine which tiles to load. Typically this will just be the main camera (and that is the default if not specified). Adding more cameras will decrease performance.
  • GLTF Shader Override - Overrides shader override of individual tilesets.
  • DefaultCameraTranslation - Default camera position in right-handed tileset coordinates.
  • DefaultCameraRotation - Default camera rotation quaternion in right-handed tileset coordinates.

Tileset Options

  • Name - Name of the tileset, must be unique when loading multiple tilesets. Defaults to Url if null or empty.
  • Url - The http address of the tileset json file you want to load. Tiles for this tileset should typically be located in the same folder as the json file
  • Show - Initially Disable / Enable rendering of tiles for this tileset. Does not disable loading or frustum culling.
  • Maximum Screen Space Error - Controls how much detail is rendered. Lower SSE results in more detail
  • Skip Screen Space Error Multiplier - Used to avoid loading high level (low resolution) tiles. Increasing this results in more high level tiles being skipped when loading
  • Load siblings - If a tile is in view and needs to be rendered, also load its siblings even if they are not visible. Especially useful when using colliders so that raycasts outside the users field of view can succeed. Increases load time and number of tiles that need to be stored in memory.
  • Translation - Tileset translation in right-handed tileset coordinates.
  • Rotation - Tileset rotation quaterion in right-handed tileset coordinates.
  • Scale - Tileset scale in right-handed tileset coordinates.
  • Max Depth - can be used to limit how far down the tree tiles are rendered. Most useful for debugging.
  • GLTF Multithreaded Load - can increase performance but can also crash on some platforms that don't support multiple threads
  • GLTF maximum LOD - typically default is fine unless the tiles themselves specify LOD information
  • GLTF Shader Override - If set to null UnityGLTF will use the StandardShader for GLTF assets. This can have dramatic performance impacts on HoloLens. This allows a different shader to be used when instantiation GLTF assets. Also see Unity3DTilesetStyle which provides a flexible way to change style properties such as shaders at runtime on a tile by tile basis.
  • Debug Draw Bounds - Draw tile bounds

The Generic Web Scene

A generic web build configuration is available which reads the tileset to load at runtime based on a URL parameter. Options may also be overridden by URL parameters.

Building the Generic Web Scene

  1. Configure the Unity build for the WebGL platform and enable only the "GenericWeb" scene
  2. Click Build (or Build and Run if you want to test locally), and select the folder Unity3DTilesWeb for output.

Using the Generic Web Scene

The generic web build recognizes the following URL parameters:

  • SceneOptions - URL to JSON file overriding any subset of Unity3DTilesetSceneOptions (see above and/or Unity3DTilesetOptions.cs).
  • Scene - URL to JSON file containing scene to load (see SceneManifest.cs).
  • Tileset - URL to single tileset to load.
  • TilesetOptions - URL to JSON overriding any subset of single tileset Unity3DTilesetOptions (see above and/or Unity3DTilesetOptions.cs).

Tileset is ignored if Scene is specified.

When combined with Scene, TilesetOptions overrides per-tileset options in the scene manifest, if any.

When running in the Unity editor use the SceneOptions and SceneUrl inspectors instead of the SceneOptions and Scene URL parameters. Also, any tilesets pre-populated in the TilesetOptions list inspector will be loaded at start.

URLs starting with "data://" will be loaded from the Unity StreamingAssets folder.

When running in a web browser (not the Unity editor):

  • Relative URLs will be interpreted relative to the window location URL.
  • Any request params in the window location URL other than those above will be passed on to subsidiary fetches.

Examples:

http://uri.to/generic/web/deployment/index.html?Tileset=data://SampleTileset/tileset.json

http://uri.to/generic/web/deployment/index.html?Tileset=http://uri.to/tileset.json&TilesetOptions=http://uri.to/tileset_options.json&SceneOptions=http://uri.to/scene_options.json&ExtraParam1=foo&ExtraParam2=bar

http://uri.to/generic/web/deployment/index.html?Tileset=../tileset/tileset.json&TilesetOptions=../tileset/options.json&SceneOptions=../scene_options.json

http://uri.to/generic/web/deployment/index.html?Scene=../scene.json&TilesetOptions=../tileset_options.json&SceneOptions=../scene_options.json

Generic Web Scene User Interface

Upon load the generic web build will place the camera at a default position (which can be overriden in the scene options). There will be a heads up display (HUD) with some info in the upper left. Several keyboard and mouse interactions are implemented. The HUD will show a summary of the available actions.

Two navigation modes are included: mouse orbit and mouse fly. The initial navigation mode is orbit. Drag the mouse to rotate the model, and use the mouse wheel to move in and out. Drag the right mouse button to roll the camera. Click on the model and press "c" to change the orbit center. Hit "f" to fit the view to the model, and hit "v" to reset to the default viewpoint.

Hit "n" to switch to fly navigation (and hit "n" again to toggle back to orbit). In fly mode drag the mouse to re-orient the camera. Use the right mouse button to roll the camera. Hit w/s/a/d/q/e to translate fwd/back/left/right/up/down.

When you click on the model the HUD will show info about the clicked tile. You can show the bounding box of the tile and optionally its parent by hitting 'b'. Hit 'x' to show the axes of the tileset. Hit 'i' to hide the tileset, and 'o' to show the last-hidden tileset. You can also use the number keys to hide/show individual tilesets.

More Repositories

1

3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
JavaScript
1,380
star
2

MMGIS

Multi-Mission Geographical Information System - Web-based Mapping and Spatial Data Infrastructure for Planetary Science Operations - https://nasa-ammos.github.io/MMGIS/
JavaScript
136
star
3

aerie

A software framework for modeling spacecraft.
Java
67
star
4

AIT-Core

Python
43
star
5

VICAR

VICAR, which stands for Video Image Communication And Retrieval, is a general purpose image processing software system that has been developed since 1966 to digitally process multi-dimensional imaging data.
C
42
star
6

aerie-ui

The client application for Aerie.
Svelte
28
star
7

LithoSphere

A Tiled 3D Planetary Web-Based GIS JavaScript Library
TypeScript
24
star
8

AIT-GUI

JavaScript
24
star
9

slim

Software Lifecycle Improvement & Modernization
JavaScript
24
star
10

Landform

Terrain mesh processing toolkit that can generate 3DTiles datasets
C#
19
star
11

AIT-DSN

Python
19
star
12

common-workflow-service

JavaScript
17
star
13

3DTilesSampleData

3D Tiles sample data released from NASA JPL
15
star
14

CameraModelUtilsJS

Set of utilities for visualizing camera models and loading image formats commonly used on JPL Mars missions.
JavaScript
13
star
15

CODEX

Complex Data Explorer
JavaScript
11
star
16

slim-starterkit-python

Template for a basic Python application implementing build, release and publish automation.
Python
9
star
17

openmct-mcws

Open Mission Control Technologies (Open MCT) for Mission Control Web Services (MCWS)
JavaScript
8
star
18

MGViz

Multi-Mission Geographic Information System (MMGIS) Global Navigation Satellite System (GNSS) Visualizer
JavaScript
8
star
19

seq-json-schema

Standardized JSON Schema for authoring multi-mission sequences.
TypeScript
7
star
20

labelocity

Flexible, customizable, multimission automated system for PDS4 label production
Shell
7
star
21

timecraftjs

Time conversion using NAIF CSPICE Toolkit in JavaScript via Emscripten.
HCL
6
star
22

slim-starterkit

Repository template / starter-kit for best-practices in repository project setup, including open source essentials like contributing guides, licenses, code of conducts, issue / PR templates, etc.
5
star
23

AIT-CFS

HTML
5
star
24

aerie-gateway

The API gateway for Aerie.
TypeScript
4
star
25

aerie-lander

An example Merlin mission model
Java
4
star
26

aerie-mission-model-template

This is a template project for starting an Aerie mission model.
Java
4
star
27

aerie-cli

An unofficial CLI for interacting with Aerie planning software
Python
3
star
28

aerie-ampcs

Utility functions to convert a standard XML AMPCS command dictionary to JavaScript.
JavaScript
3
star
29

aerie-docs

The main documentation site for Aerie.
JavaScript
3
star
30

AFIDS-POMM

AFIDS-POMM
Python
3
star
31

slim-cli

Command-line Interface for Software Lifecycle Improvement and Modernization (SLIM)
Python
2
star
32

anms-docs

User Guide and Product Guide source for the ANMS
CMake
2
star
33

slim-config-detect-secrets

Additional configuration for the open-source project detect-secrets to enhance secret type detection and streamline the process.
Python
2
star
34

BSL

BPSec Library (BSL)
2
star
35

BSL-docs

BSL-docs
2
star
36

synopsis

Science Yield improvemeNt via Onboard Prioritization and Summary of Information System (SYNOPSIS)
C
1
star
37

slim-leaderboard

Generates a report of SLIM best practices compliance.
Python
1
star
38

DECISION

Data-driven Efficient Configuration of Instruments by Scientific Intent for Operational Needs (DECISION)
HTML
1
star
39

anms-ace

The AMM CODEC Engine (ACE)
Python
1
star
40

anms-camp

C code generator for AMP
Python
1
star
41

AMPCS

AMMOS Mission Data Processing and Control System
1
star
42

anms

Asynchronous Network Management System (ANMS)
JavaScript
1
star
43

aerie-ts-user-code-runner

TypeScript
1
star
44

aerie-simple-model-power

Simple spacecraft power model for the Aerie modeling and simulation framework
Java
1
star
45

aerie-pmc

Aerie Project Management Committee
1
star