See how easy it is to create and link a 3D model to a MOTORCORTEX application:
The GRID 3D widget supports 3D models in GLTF format. GLTF is an open 3D format maintained by the Khronos Group. More information on the format can be found here: https://www.khronos.org/gltf/.
A lot of 3D modeling and CAD tools support exporting a model in GLTF format natively and these models can be use in the 3D widget directly.
A couple of guidelines are important to make the 3D model work properly:
- Binary output format (.glb) is preferred because of more efficient storage and smaller file sizes.
- Model size should be below 10 MB for optimal performance on lower end devices like tablets.
- Enabling shadows are expensive (cost a lot of computing power), especially when using complex scenes.
- Make sure your model has the Z-axis pointing up, also make sure the exporter keeps the z-axis up (some exporters make the y-axis point up). The 3D widgets camera navigation relies on this “z is up” convention to function properly.
Creating 3D models with Blender
Blender is an extremely capable open-source 3D modeler that is ideal for creating 3D models for use in GRID. You can download Blender for your favorite platform from the Blender website: https://www.blender.org/. Here you can also find excellent modeling tutorials that help you get started.
When modeling a Digital Twin in Blender there are some important guidelines:
- The GLTF exporter currently silently renames objects that contain spaces or other special character (like period (".")). This is a problem for objects that you want to link later to motorcortex parameters. Especially avoid putting spaces in Object names, since this will have unexpected results in the 3D view. Periods are okay, but you need to know that they are removed in the GLTF export; “Cube.001” will become Cube001 in the GLTF file.
- In GRID all transforms are done in the object’s local axis frame.
- You can connect your objects together by “parenting” them, the child has then a local axis frame that moves together with its parent object.
- Make sure your object Origin is located at the desired rotation point. One way to change an objects origin in Blender is to first position the 3D Cursor at the desired location and then “Origin to 3D Cursor” from the Object menu.
- Also make sure to “Apply Rotation” and “Apply Scale” to all your moving objects to avoid some strange behavior later.
- When exporting to GLTF from Blender, make sure the “+Y Up” in the “Transform” section of the exporter settings is Off.
- If you are using Object Modifiers, make sure you select “Apply Modifiers” in the “Geometry” section of the GLTF Exporter.
Using a GLTF file in GRID
To use a GLTF file in the GRID 3D Widget the following steps are required:
- Upload your GLTF file(s) in either .gltf or .glb format to your project. You can place you models in a subfolder if that is preferred.
- Create a new JSON configuration file
- In GRID, add a 3D widget to your canvas and in the “model” property select the JSON file. JSON configuration file