When normals aren’t normal

Hey, it’s been a while since my last post and I’ll take a second to tell you why….I got a new job as CTO of a little company called The Carto Group. I niavely thought that nothing would change and I could do all my normal day to day blogs, tweets and awesome screenshots….how wrong I was! Being a grown up is hard work! There was all this new stuff like “responsibility” (whatever that means) and employees….furthermore there were these things called “proposals” which constantly need to be written and then tweaked until the last 30 seconds of submission. It is a whole new world and one that I will share in future posts.

Back to normals….vertex normals are a 3D geometry thing. Essentially they tell the object which orientation the faces should have, if you ever had a play with Sketchup, you’ll remember how the inside of a building was always darker than the outside, this was because the software was telling you that the inside of the faces were facing inwards and the outside of the faces, facing outwards…..sometimes this would go wrong and you would get wrongly coloured faces, this would be due to the vertex normals (hereon called just normals) being the wrong way around.

Image obtained courtesy of Polycount.com – Perfect example of inverted normal on face

Now, there are normals and there are normals….in the gaming industry it is quite common to have issues with normals and you simply take the model into Blender, Unity, MeshLab, 3DS Max or any other 3D modelling software and you fix it with a “reverse normals” button. You can even select individual faces to reverse normals. It really isn’t an issue.

In the geospatial world it is a whole new world of pain…does ArcGIS have a magic “reverse normals” button? Does QGIS? I’ll save you the effort of searching and tell you, NO. Currently no GIS on the market has an option to reverse normals on 3D geospatial data (please correct me in the comments below). The only software which is geospatial that I know of is CityEngine and in fairness, it is more a gaming software than a GIS but it DOES handle geospatial data.

But what about all these cool 3D worlds that are being built? I’ll be honest with you, many are a lie, some are fudged and the others aren’t quite what you think they are. Let’s look at some fancy LOD 2.2 data from CyberCity3D (CC3D) – the data looks awesome, the demos they give of the data rendering on Cesiumjs make it look plain awesome. Not only that, the data is built from photogrammetry and pretty lightweight, light enough to use on mobile and web mapping….here is the sting….The normals are inverted, if you were to bring the data into any other GIS it would look flat until you reversed the ALL the vertex normals, which, in something like CityEngine isn’t too difficult as long as you aren’t doing too much data or care about transformations between coordinate systems (a conversation for another day). When I say that all the normals are reversed I am assuming that Cesiumjs is wrong and Esri, Blender, CityEngine, Unity and Unreal are right….

A good model brought into Cesiumjs and normals are reversed – note the incorrect lighting

Okay, so the normals are all reversed on the CC3D data but because they are ALL reversed it is not a problem as it is consistent. What about if we use buildings from the Trimble 3D Warehouse?….firstly the positional accuracy is shocking but mostly you will find that they have inconsistent normals, many of the faces will be reversed in odd places, again, when doing one or two buildings it is not a problem and can be fixed in CityEngine….but this is not what many of the 3D geospatial people I know do….CityEngine is expensive, so the users convert the data to collada, obj or fbx, THEN fix the normals and THEN convert it back to a geospatial format, usually KML or KMZ which is THEN converted to a geopackage or geodatabase multipatch…..god knows what happens to the data as it is pulled, poked and warped through the washing machine but anyone who considers accuracy would be pulling their hair out. Let’s not even approach those (you know who you are) who simply paint the models inside and out to hide inconsistencies….it doesn’t work that well and can look ugly.

I’ve sampled some of the OSM 3D building data and it has the same normals issues as the 3D warehouse data and the same can be said for a fair few of the open source data I have come across. Let’s be clear, I’m not saying the data is bad or it is wrong, I am merely pointing out that although we have some amazing 3D GIS now, we are lacking the tools for working with the data. Furthermore, a few people need to be a little more honest about their data processes and levels of accuracy.

Of course, there is FME, the ETL which now offers fixing of vertex normals….you guessed it, it is okay for the CC3D type scenarios where you have consistent normals issues but identifying individual issues is a no go.

So what is the answer? At the moment I can only advise you to use CityEngine if you already have 3D geospatial multipatch data which you need to ensure has correct vertex normals. If you are given a non geospatial 3D data and want to bring it in to a 3D GIS, firstly consider whether you will be using Cesium or any other GIS/ 3D GIS, as your normals will need to be inverted or non-inverted, then fix the normals with Blender or if you have 3DS Max, use this. Once all the normals are the way you want them, THEN convert to a geospatial format.

Image of 3D Buildings with inverted normals obtained here: http://www.cybercity3d.com/products?lightbox=dataItem-ipr3vca21

The other day I spotted an “invert normals” button on the new QGIS 3D viewer and also there was mention that GlobalMapper might have something coming….as soon as I hear something I will let you know.

One last question to postulate – Cesium & Esri have agreed a common 3D format exchange, at some point we will be able to work between 3D Tiles and slpk in both respective software….but with the normals issues, how will that work?

Until then, watch your normals!!…..Maybe the next rant should be non-manifold models…..

Dragons8mycat

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.