Understanding 3D icons
3D icons in Twinfinity are at its core, sprites. A sprite is a 2D graphic or image used within a 3D environment, often for icons, textures, or other flat, billboard-like visual elements. In the Twinfinity embedded API we have added the possibility to add icons in the 3D scene, sprites, that can later be interacted with like any object in the 3d scene. In order for you to use 3D icons we recommend you use a sprite atlas.
3D icons are, in contrast to 2D labels, rendered in the 3D context. This means that they are placed in the 3D model and will be visible or hidden in the same way that 3D objects are. If a 3D icon for example is placed behind a wall from the cameras point of view the wall will hide the icon. 2D labels are placed ontop of the rendered canvas and will always be drawn ontop of the model, almost as if the camera is filming through a glass pane.
A sprite atlas in the is a large image containing a collection of smaller images or sprites, which are individual graphics that can be used the Twinfinity Viewer. Using a sprite atlas is an efficient way to manage and organize multiple textures because it reduces the overhead of switching between different textures during rendering. When a 3D scene is rendered, the appropriate sections of the sprite atlas are selected and applied to the 3D icons, allowing for a more streamlined and resource-efficient rendering process. This allows for a vast amount of 3D icons being added to the scene without a big impact on performance.
In this example, we show how 3D icons can be defined and placed in your Twinfinity App:
3D icons can be used as buttons inside the 3D context and can have their own click event. This example shows