2024-05 New in the Twinfinity API

2024-05 New in the Twinfinity API

In the first week of May we released a new version of the @twinfinity/core (4.1.0) and this new update contains some really nice features. In this post we break down the changes, show you some examples and give you some background to what has been changed and how it can help you when usint the Twinfinity API.

Lets just make it easier

Lazy loading - We’ve introduced lazy loading, this means that it is no longer necessary to apply visual changes as before. When you make changes they will be applied automatically. This also means that geometries will be loaded and unloaded as you go improving overall performance.

IfcClasses - We also added a new and improved API for working with BimIfcClass which makes it easier and more intuitive to, in a performant way, detect what ifc class and type (category) a IFC Product has. Check out the example playgrounds below to give it a try.

Units! - The IfcProperties now have units, if specified in the IFC, will now carry over to your digital twin, you will find the unit on the property in the API. This will allow you to add units to numerical values in your site or app when applicable. You will need to reparse your files for this to take effect.

… and look better

No more war of the ants! - When it comes to rendering some really nice bug fixes and features have been added with this version. First of all we’ve tracked down and solved the bug that in certain cases gave objects a look of static tv noise. This was something that was really taking away from the user experience and we are happy that this is now resolved.

Normal… normals? - As you may have experienced, especially in piping and duct models, the normals were pointing in the wrong direction creating either objects that looked like they were turned inside out or when turning backface culling off being almost black. This has now been addressed so when turning backface culling off, like this:

api.viewer.performance.isBackfaceCullingEnabled = false;

the model will now look correct. Please note that disabling backface culling may have an effect on performance.

 

image-20240508-071047.png
Backface culling enabled
image-20240508-071127.png
Backface culling disabled with fixed normals

 

The colors, look at the colors!

In this release we introduce the possibility to use HSV in your scenes. HSV which stands for Hue, Saturation, Value is an alternative color model that, when enabled, allows for more control of how the colors of your scene turn out.

Hue controls the overall color of the scene allowing you to add a tint to the entire scene. Saturation allows you to controll how vibrant your colors are to be and finally the Value controls the overall brightness of the scene.

By leveraging HSV like this you can get colors that are closer to the actual RGB value in the renderer scene.

 

 

image-20240508-115520.png
Scene with ,custom color schema

 

 

image-20240508-115407.png
Same color schema with HSV adjustments

 

Playground examples

We always try to show you what we’ve done and how it works and the Twinfinity Playground is the perfect place for us to showcase our updates, and for you to play around with the code to get a feel for the new functionallity.

Here is a playground showing some of the changes we’ve made in this version:

Twinfinity Playground showcasing changes in 4.1.0

Just as I was writing this, Christoffer from our dev team sent me this awesome playground showcasing the HSV changes in a more… colorful way

Twinfinity Playground - HSV Disco!

Find out more

For more information about the Twinfinity API check out help.twinfinity.com and docs.twinfinity.com. If you want to try it out for yourself the quickest way is to just visist our playground at playground.twinfinity.dev.

If you are considering Twinfinity for your digital twin project, app or website you can reach us by booking a demo. Make sure to add a comment what it is you are interested in so that we can meet your needs as best we can.

All the best! Have fun out there

/Tobias