FME Version
Introduction
FME AR (FME Augmented Reality) is an app available for your mobile devices; both iOS and Android. Augmented Reality is essentially adding information to your real-world view (as opposed to Virtual Reality which is creating a totally artificial environment). FME’s AR app is powered by a data format called fmear.
This article covers how to create a fmear format dataset from a 2D CAD drawing. The same techniques can be used to create fmear data from 2D GIS data, such as a map of building footprints. The primary transformer used to turn 2D into 3D is the Extruder.
The FME AR mobile app is still in development, and the articles in this tutorial series may not reflect its current state. The app should not be used in production. The FME AR mobile app for Android has been deprecated; see FME AR Mobile App on Android Deprecation.
Step-by-step Instructions
Part 1: Create Walls
1. Read in CAD Data
Start FME Workbench and open a blank workspace. Add a Bently MicroStation Design (V8) reader to the canvas and browse to the 3DBuildingForFMEAR.dgn dataset, which is available for download from the Files section on this article.
In the Select Feature Types dialog, select all of the feature types except for Default.
2. Extrude Walls
First, let’s create the walls. Add an Extruder transformer to the Walls (Lower) reader feature type. In the parameters, set the Direction to Vertical and the Distance to 10.
3. Write to FME AR
Let’s write our data out to FME AR and explore it in the mobile app. Add an FME Augmented Reality (FME AR) writer to the canvas. Browse to a location to save the file and name the file HouseDataset.fmear.
In the Select Feature Type dialog, select all of the features. Connect the Walls (Lower) writer feature type to the Walls (Lower) Extruder. Then connect the Windows writer feature type to the Offsetter.
4. Run the workspace
Run the workspace, then upload the dataset to either your phone or a cloud-based hosting platform such as Dropbox or Google Drive.
The building model is now in fmear format and can be used in the FME AR app. However, it is fairly basic and there are improvements that can be made; for example, punch holes in the wall to represent the windows.
5. View Dataset in FME AR
On your device, open the FME AR app. Point your device at a flat plane until the dot grid appears (tabletops or floors work best).
Then click the orange icon in the bottom to open the file browser. Select the location of your dataset (or add it to your device). After the FMEAR model appears, you can toggle the layers on and off, we will have more layers in future parts.
Part 2: Create Windows
6. Extrude and Offset Windows
We need to extrude the windows as well as the doors. Add another Extruder to the canvas and connect it to the Windows reader feature type. In the parameters, set the Direction to Vertical and the Distance to 4.
The window bases don't normally sit at ground level. We will need to offset them a bit. Add an Offsetter to the canvas and connect t to the Extruder coming from the Windows reader feature type. In the parameters, set the Z Offset to 3.
7. Create ID for Window
To punch out holes for the windows, we will use the CSGBuilder, but this transformer handles only pairs of features, so each section of the wall must be paired with a maximum of one window. A second window in the same wall would be ignored.
Luckily, the walls in the source model have already been cut into pieces to meet this requirement:
So before we can use the CSGBuilder (Constructive Solid Geometry), we will need to do a few things first. Add a Counter to the canvas and connect it to the Offsetter. We will use this to give a unique ID to each window. In the parameters, set the Count Attribute Names Count to WindowID.
8. Identify Neighbors
Add a NeighborFinder to the canvas and connect the Base input port to the Extruder coming from the Walls (Lower) reader feature type. Next, connect the Candidate input port to the Counter.
This transformer will identify the ID of the window (if any) that cuts through a wall section. In the parameters, ensure that Number of Neighbors to Find is set to 1 and then set the Maximum Distance to 0.1. Next, expand Attribute Accumulation and enable Merge Attributes. This will tag each wall feature with its matching WindowID.
If you run the workspace now, you can inspect the results of the MatchedBase output port on the Neighborfinder transformer in Visual Preview, to prove that each wall with a window now has a WindowID attribute.
9. Punch-Out Windows
Now we are ready to use the CSGBuilder. Add a CSGBuilder to the canvas and connect the NeighborFinder MatchedBase output port to the A input port. Then connect the Counter to the B input port.
In the parameters, enable Group Processing then set the Group By to WindowID.
This will punch the window through the wall where there is a matching ID number.
10. Connect Windows to Writers
The final part of this task is to connect the correct features to the correct FME AR writer feature type. Remove any existing writer connections, then connect the following.
- The NeighborFinder UnmatchedBase output port represents walls without a window, so connect them to the Walls (Lower) writer feature type.
- The CSGBuilder Difference output port represents walls with a window, so connect them to the Walls (Lower) writer feature type as well.
- The CSGBuilder Intersection output port represents windows, so connect them to the Windows writer feature type.
Note that the UnmatchedBase output port on the Neighborfinder was moved up for screenshot clarity. This is done by right-clicking on the output ports and selecting Move Up or Down.
11. View Walls and Windows in FME AR
Now save and re-run the workspace. Inspect the output in the FME AR app. It might not look any different at first, but turn off the Windows layer and there are holes in the wall features
Part 3: Creating Backdrops
12. Add Backdrop Reader
Another improvement is to add a backdrop to the floor and boundary features. Start by adding a PNG (Portable Network Graphics) reader to the canvas and browse to the 3DBuildingBackgrop1.png dataset.
13. Set Face and Appearance
Now we need to set the face and appearance to use the new png. Add a FaceReplacer transformer to the canvas and connect it to the Floor reader feature type. We can accept the default parameters.
Next, add an AppearanceSetter to the canvas and connect the Geometry input port to the FaceReplacer then connect the PNGRaster reader feature type to the Appearance input port.
In the AppearanceSetter parameters, expand the Texture Coordinate Generation Parameters, then set the Texture Mapping Type to From Top View.
14. Orient Floor
You could write out the floor right now if you are using your own data. But this example requires the image to be reoriented as it is applied to the wrong side of the floor. Add an Orienter to the canvas and connect it to the Output port on the ApperanceSetter. We can accept the default parameters.
15. Connect Floor Writer Feature Type and View Output
The floor is ready to be written out. Connect the Floor writer feature type to the Output port on the ApperanceSetter.
Now save and re-run the workspace. Inspect the output in the FME AR app.
Part 4: Create Boundary (Optional)
The following is an optional section to create a background boundary for the AR model.
16. Add Another PNG Reader
Add another PNG (Portable Network Graphics) reader to the canvas and browse to the 3DBuildingBackgdrop2.png dataset.
17. Set Face and Appearance
Duplicate the FaceReplacer and AppearanceSetter. Connect the FaceReplacer to the Boundary reader feature type, then connect the second PNGRASTER reader feature type to the Appearance input port on the AppearanceSetter.
18. Offset Boundary
We want the boundary image to appear below the house, to do this we will use the Offsetter. Add an Offsetter to the canvas and connect it to the Output port on the AppearanceSetter_2. In the parameters, set the Z Offset to -0.1.
19. Connect Boundary Writer Feature Type and View Output
The boundary is ready to be written out. Connect the boundary writer feature type to the Offsetter_2.
Now save and re-run the workspace. Inspect the output in the FME AR app.
Comments
0 comments
Please sign in to leave a comment.