aws-samples / aws-iot-twinmaker-samples

Apache License 2.0
97 stars 77 forks source link

Scene script lib #80

Open hwandersman opened 2 years ago

hwandersman commented 2 years ago

Added @iot-twinmaker/scene-utils lib to enable customers to automate scene creation. Sample command line scripts are provided to create the CookieFactory scene, integrate with the Cesium Ion tiling pipeline, and delete scenes.

Issue #, if available:

Description of changes: Introducing an SDK with command line scripts to automatically manipulate IoT TwinMaker scenes. This library enables customers to manage 3D models that are uploaded to S3 and applied to the scene hierarchy as interactive nodes. A scene node can be a 3D mesh or a built-in augmentation like a tag or motion indicator. You can set the 3D transform of the node and apply a data binding with an entity, component, and property path of a time stream data connector. This SDK also supports adding scene rules to dynamically change an icon or mesh color when data is applied to the scene viewer on your IoT TwinMaker application. Finally, there is an integration with Cesium Ion's REST APIs to compress 3D assets into 3D tiles for consumption in an IoT TwinMaker scene.

Security

This lib uses the AWS JS SDK to connect to IoT TwinMaker and S3. It also has a Cesium client that uses Cesium's REST API to upload 3D models and export 3D tilesets to a customer's S3 bucket.

Customers will use temporary AWS credentials to authenticate into the AWS SDK. To use Cesium customer's must have a Cesium Ion account and an access token with the permissions for writing assets and exports. This access token is used to authenticate into the Cesium REST APIs.

Scripts

Summary of sample command line scripts:

  1. Cookie Factory Sample Use the 3D models in this repo's scenes directory to build the CookieFactory.json scene with the SDK. This sample is meant as a starting point for users with local 3D models they want to add to a scene with all scene features (tags, motion indicator, data binding, rules, etc.).

  2. Cesium Ion File Upload Create an account with Cesium, get an access token, and use it to upload a local file to your Cesium account. Cesium will run its tiling pipeline to generate 3D tiles for your asset. After tiling is complete the tileset will be downloaded into memory and uploaded to your IoT TwinMaker workspace S3 bucket and added to a new scene.

  3. Delete your scene Example to clean up nodes in your scene or delete it from your workspace.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.