npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aframe-loader-3dtiles-component

v1.0.6

Published

A component for displaying OGC 3D Tiles.

Downloads

10

Readme

aframe-loader-3dtiles-component

Version License Build Status

An A-Frame component for displaying OGC 3D Tiles based on nytimes/three-loader-3dtiles.

DemosAPIInstallationUsageContributingRoadmap

The loader uses the loaders.gl library, which is part of the vis.gl platform, openly governed by the Urban Computing Foundation. Development of the loader started at The New York Times R&D as an effort deliver massive 3D and Geographical journalism to readers. This A-Frame components makes 3D Tiles more accessible to creators and brings immersitve journalism into mixed realities on the web.

Demos

Demos are available here.

Installation

Browser

The following example loads the library from CDN, as well as missing required components for handling KTX2/basis_universal glTFs.

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
  <script src='https://cdn.jsdelivr.net/npm/[email protected]/examples/js/utils/WorkerPool.js'></script>
  <script src='https://cdn.jsdelivr.net/npm/[email protected]/examples/js/loaders/KTX2Loader.js'></script>
  <script src="https://cdn.jsdelivr.net/npm/aframe-loader-3dtiles-component/dist/aframe-loader-3dtiles-component.min.js"></script>
</head>

Usage

The following example sets up a basic scene with a RealityCapture photogrammetry model.

<body>
    <a-scene environment="preset: default">
      <a-camera id="camera"></a-camera>
      <a-entity
        id="freeman-tiles"
        position="0 2.6 0"
        rotation="-90 180 0"
        scale="2 2 2"
        loader-3dtiles="
         url: https://int.nyt.com/data/3dscenes/ONA360/TILESET/0731_FREEMAN_ALLEY_10M_A_36x8K__10K-PN_50P_DB/tileset_tileset.json; 
         maximumSSE: 48;
         cameraEl: #camera;
        "
      >
      </a-entity>
    </a-scene>
</body>

npm

Install via npm:

npm install aframe-loader-3dtiles-component

Then require and use.

require('aframe');
require('aframe-loader-3dtiles-component');

API

| Property | Type | Description | Default Value | |----------|------|-------------|---------------| | url | string | The URL of the tileset. For example if using Cesium ION, it would have the form: https://assets.cesium.com/[ASSET_ID]/tileset.json. Can be updated at runtime.| '' | | cameraEl | selector | A selector for the camera whose position is used to determine which tiles to display at which LOD. If a cameraEl value is not provided then component uses document.querySelector('a-scene').camera to find a-camera primitive or entity with camera component. For more info see Camera Requirement note below. The component automatically switches the camera in response to the camera-set-active event. | '' | | maximumSSE | int | maximumScreenSpaceError (Optional) determines the distance from tiles in which they are refined, depending on their geometrical size. Increase the value to load lower LOD tiles from the same view distance (increases performance). Cannot be updated at runtime. | 16 | | maximumMem | int | maximumMemoryUsage (Optional) determines maximum GPU memory (MB) to use for displaying tiles. May go over the limit if tiles within the camera viewport exceed that amount. Cannot be updated at runtime. | 32 | | distanceScale | number | (Optional) 0-1 scale for the LOD quality. A lower value loads tiles from lower LODs (increases performance). Can be updated at runtime.| 1.0 | | pointcloudColoring | string | (Optional) When viewing point clouds, which datum determines the color of a point. Possible values: 'white', 'intensity', 'classification', 'elevation', 'rgb'.| 'white' | | pointcloudElevationRange | array | (Optional) When viewing point clouds colored by their elevation, what are the minimum and maximum height values.| 0, 400 | | wireframe | boolean | (Optional) When viewing b3dm (mesh) tiles, show meshes as wireframe. Can be updated at runtime. | false | | showStats | boolean | (Optional) Attaches a box with tilestats to the scene, useful for debugging. | false | | cesiumIONToken | string | (Optional) A Cesium ION access token when loading tilesets from Cesium ION. | '' |

Camera Requirement

To use the loader-3dtiles component, your A-Frame scene must have a camera defined using <a-camera> or the camera component . The component will attempt to use one of these automatically, or you can specify your own selector with the cameraEl property.

The camera is used to provide dynamic levels of detail (LOD) for 3D tiles. If no suitable camera is found the tiles will not display and an error is shown on the console 3D Tiles: Please add an active camera or specify the target camera via the cameraEl property.

Compatability with THREE.Cache

Currently, three-loader-3dtiles does not support the use of THREE.Cache which is enabled by default in A-Frame. In its default setting, the cache does not recognize repeated loads of tiles, which causes the cache to overflow. Therefore, the loader-3dtiles component disables THREE.Cache if it is enabled and displays a warning: 3D Tiles loader cannot work with THREE.Cache, disabling.

Contributing

Refer to CONTRIBUTING.MD for general contribution instructions.

Roadmap

Suggestions for future work include:

  • More elaborate test cases.
  • Better integration with the inspector.
  • Test AR scenarios.
  • Test point-cloud scenarios.
  • Could THREE.Cache be used manually?
  • Conversion to Typescript.

This repository is maintained by the Research & Development team at The New York Times and is provided as-is for your own use. For more information about R&D at the Times visit rd.nytimes.com