How to Geolocate A 3D Model Using udStream

How to Geolocate A 3D Model Using udStream


 OVERVIEW

This guide provides the steps to geolocate a 3D polygon (OBJ or FBX) model so that is appears in the correct location within a larger point cloud model, eg. Placing an .obj building within a geolocated city model.

udStream is a dynamic visualisation platform. The screenshots that appear in this guide may vary slightly from the version of udStream you are currently using.

Time to Complete : Approximately 15 minutes.

Before you begin:
This guide sets out the steps required to locate a 3D model into APPROXIMATELY the correct location in the real world. It may prove useful to customers who wish to insert a 3D mesh model into a real world scene.
NOTE: Geolocation is an advanced topic – the steps we spell out here are simplified to give a good visual result, by locating the mesh model in approximately the correct position. .OBJ 3D models are generally not geolocated – and therefore, the results from this process should not be relied upon as accurate survey grade engineering or geospatially correct measurements.

In this example, we will take a 3D wavefront model (.obj ) and insert it into a photogrammetry model of a city.
Let’s say you have received an .OBJ Wavefront model of a high rise building from the property developer. It is a very preliminary design, so no detailed architectural drawings are done yet – the developer has simply created a conceptual design in a very basic design program such as Sketchup.

YOU CAN DOWNLOAD THE SAMPLE BUILDING .OBJ MODEL FROM OUR SERVER AND FOLLOW ALONG WITH THIS GUIDE. To download it, go to:  https://sampleeuclideon.blob.core.windows.net/sample/10068_empire_state_building_v1_L3.obj and then download the accompanying textures here: 
Ensure the textures are downloaded and placed in the same folder as the OBJ - this is where udStream will look for them. Otherwise the Empire State model will appear totally white when loaded in udStream, which is not what we want.
UdStream supports a variety of input formats, including .OBJ & .FBX, however if you were to import this model into UdStream it will not appear in the correct location. This is because the model is not correctly geolocated in world three-dimensional space – it has it’s own origin, scale and coordinate system but it is not correlated to the real- world.

Step 1

It is recommended that you view the .OBJ file first in a simple viewer, different to the one that it was originally created on – this allows you to quickly confirm that it looks OK before we bring into UdStream.

 

 

Take note of the .OBJ and .mtl material files and any materials kept in sub-directories. In this case, the complete list of files included in the model are:

StateBuilding.obj
StateBuilding.mtl

Don’t worry if you don’t understand what all these files mean – there are simply material images that are used by the .OBJ model, but you need to know that you MUST have all the files and the MUST be in the correct directory and location on your drive otherwise the model will not have the material textures and will look blank.

Step 2

Next, you need to find the correct location in the world that the building model should be located The simplest way is to use Google Maps – but you can use any mapping application for this.
In this example, we will chose a location in Euclideon’s home city of Brisbane, Australia. 
In the Google Maps search bar, look for: 
25 Ferry Street, Kangaroo Point, Australia. 
The screenshot below shows the location that our building should be located:

 


The pin shows the block of land where the building will go, but we need to understand the exact co-ordinates. Right-click on this point and select “ What’s here?” you can see a small window has popped up that gives us the approximate co-ordinates -27.471773, 153.036276 (This is lat/long in decimal).
NOTE: Other mapping web pages and applications will have different ways to get these co-ordinates and even Google Maps changes often, so you may need to try different methods to find the co-ordinates.

Step 3

Choose a projection system and translate the co-ordinates into that system. This is where it gets a bit more tricky, but for those of you who are not GIS experts, it is recommended to stick to UTM and WGS84. That means, we need to convert our lat/long coordinate of -27.471773, 153.036276 into a UTM Zone.
One website that can help us is https://www.latlong.net (but again, there are many ways to do this). On this web page, click on the heading “Lat Long to UTM”.


Down below in the green box, enter the Latitude and Longitude and press Convert.
See screenshot below for the result.


This website has taken the Lat/Long coordinates and given us the UTM information:


UTM Easting: 503583.99
        
UTM Northing: 6961309.28
      
UTM Zone: 56J


You don’t need to understand all these numbers, but you must write them down!
The final part of this Step is to understand the SRID / EPSG Code. Every part of the World has many different SRID codes – it is what UdStream uses to display a spherical map into a flat one (more or less – this is a very complex topic!).
Enter the search term “epsg UTM 56J” into your search engine. (56J is the UTM Zone you just wrote down). The first search result, indicates that the EPSG code you are looking for is EPSG: 32756 – WRITE THIS DOWN ALSO.

 

Now you’ve got all the information you need to geo-locate your model in UdStream!

Step 4

Convert in UdStream
Now it’s time to convert the .OBJ using udStream. Assuming you are experienced with converting files, it is a simple case of dragging the primary OBJ model file into the Convert window of UdStream.


Since we are geolocating the model properly, check the “Override Geolocation” box.
In the “SRID” box, enter the EPSG code that you found in Step 3 – 32756.
In the “Global Point Offset” boxes enter the offset EASTING & NORTHING numbers that you found also in Step 3. Easting: 503583.99   Northing: 6961309.28
(Important: Leave the third ‘Z’ box at zero – this is height).
The screenshot above shows the UdStream convert screen ready to begin convert.
Since converting 3D Mesh files (such as .OBJ) can take a long time, it is suggested that you always first convert a model using a very low resolution. This can be done by checking the “Override Resolution” box and choosing a Point resolution of 1m (by default it is set to 0.01m).
Press ‘Begin Convert’. When it is completed, press ‘Add to Scene’, then close the Convert window. You should see something similar to this:


 


The model is now geolocated in approximately the correct location, however is laid down on its’ side – indicating that the X,Y and Z axis are incorrectly set.

Step 5

Rotate Object (if needed)
Next, you need to use a software application to change the XYZ rotation. Again, there are other ways to do this, but we will be using Blender - an open source 3D application that can be downloaded from http://www.blender.org/.
Download Blender from the above link, then open the program and import your OBJ model.


Note that now the model automatically appears to be the correct way up. This is because the gaming industry has a standard for axis that is different to the geospatial industry (meaning, models created for one industry are often ‘laid over’ in the other industry!).


Next, Export the model as OBJ and try various XYZ settings. In this case I have set “X forward, Z up” (this may change) – see screenshot below.

Nowiif I import the OBJ back into Blender, you can see that the building model is laying down.


When you bring the OBJ model back in UdStream, and choose the correct conversion settings again, the model should be oriented the correct way. If not, then repeat these steps and try different combinations of forward and up.
Go back into UdStream and convert the new OBJ with changed orientation and use the correct geolocation and resolutions settings.


Now the building is correctly aligned and appears in almost the correct location. However, it appears to be floating above the ground over where it should be situated.
Note also that we actually wanted the building to be in the location highlighted by the blue shaded area. We have 2 ways to fix this:

 

1)     Simply relocate the object inside UdStream and select ‘Export’, so save the combined files as a Json Project.
2)     Determine the X,Y and Z (height) offset to get it into the correct location and then re-convert in udStream with these new additional offsets.
In our case, the building is actually at the correct height… it is simply that the Map Height is not set correctly. From UdStream, locate the Settings panel. Under “Maps & Elevation, locate the “Map Height” slider bar. Press Ctrl + Left Mouse Click the Map Height slider bar - then manually enter the map height as ‘0’ metres.
Now, the building appears at the correct height:



Step 6

Final Location Adjustment
As shown above, the building is still not at exactly the correct location.
SOLUTION 1 - Relocate the object inside UdStream and select ‘Export’.
Select the ‘Translate’ Gizmo from the top menu bar:

 

Click the model to be moved, a white dot with three arrowed arms appears on the model.


Next, click the coloured arm for the direction you wish to move the model, and holding the mouse drag the model in that direction.



In the example above, the building has been moved a few block to the right.
To save this change, Select ‘Projects’ from the top menu bar, then ‘Export’. Save your .JSON file in a directory on your local drive.
SOLUTION 2 - Determine REMAINING X,Y and Z offset and then reconvert with these new additional offsets.
To determine the approximate offset still required, align the compass to North and measure the distance EAST and NORTH that the building needs to move. In this case, right mouse click the corner of the building, Select ‘Add New Item’, then ‘Begin Line Measurement’ (screenshot below).


 


Next, right click on the point where the building corner should be and “Add Node Here”. This will give the amount that you need to move the building EAST (39.068m). Then do this again from the North East corner of the building to determine how far SOUTH the building needs to move.


 


In this example, the building must move a further 39.068m EAST and -55.254m NORTH (ie SOUTH).
Now reset the UdStream Convert window and load the OBJ back in but this time use:
Override Geolocation (tick) 
SRID: 32756
Global Point Offset:
Easting: 503619.398 (503580.33 + 39.068) 
Northing: 6961228.66 (6961283.91 – 55.254)
Third Box (Z): 0
This time leave the Point resolution at the default of 0.01m since we are more confident of the location and want to see the best quality conversion result.
Note: the default resolution is calculated as 0.01m – however, it is not always accurate. In this case, converting at 0.01m takes a long time and the result is not really much better than 0.1m. Therefore, we would suggest 0.1m is a much better trade-off between quality and time to convert – but the choice is yours!


 

Step 7

Final Check
From the screenshot above you can see the building now appears in the correct spot on the map, however there may be an issue with the scale since it overlaps the Southern end of the block it was supposed to fit on.
The user must check whether the model is actually scaled wrong, as care must be taken!
Although not advised, it is possible within UdStream to change the scale.
To do so, select the ‘Scale’ Gizmo from the top menu panel:

A white dot with 3 arms will appear on the model.
Click the centre white dot to resize the scale of the height, length and depth all simultaneously. With the dot clicked, hold down the mouse button and drag to the left. This will scale all the dimensions of the model appropriately.


The final result should look like so:

 

Congratulations, you have now correctly geolocated the model.

Let us know how you went with geolocating your models over on our Community Forums.


    • Related Articles

    • HOW TO: Advanced Geolocation Features in udStream

      udStream and Geolocation udStream by default supports a list of EPSG/SRID and support for more EPSG codes are added with each release. However, should you have an EPSG code that is not supported, you can try adding in its Well-Known-Text (WKT). ...
    • udStream Quick Start Guide

      Registering an account Before downloading and installing udStream you will need to go to  https://udstream.euclideon.com to register an account. When you navigate to the site, click  Register . Enter your name and email. You will be sent an email ...
    • HOW TO: Convert my models to UDS (Unlimited Detail Format)

      Converting my models to UDS For a list of supported file types, see the Knowledge Base article 'Supported File Types'. Introduction The real power of udStream lies in converting all Supported point cloud and 3D data types into our proprietary format ...
    • HOW TO: Supported EPSG codes for Conversion

      SUPPORTED EPSG CODES udStream supports the following EPSG codes for geolocated models: SUPPORTED CODE DETAILS 2230 NAD83 / California zone 6 (ftUS) 2238 NAD83 / Florida North (ftUS) 2248 NAD83 / Maryland (ftUS) 2250 NAD83 / Massachusetts Island ...
    • HOW TO: Reset Transforms

      Using Reset Transform to fix geolocating issues When loading non-geolocated models, udStream will try to load the model into screen space (based on where you point your mouse to). There are special cases when datasets are not geolocated to a specific ...