Files
-
- 10 MB
- Download
Introduction
This workspace demonstrates some basic approaches for how to add to and manipulate the appearance of 3D data, including raster texture overlays and color styling of solids. This workflow reads 3D buildings from CAD, uses a point cloud from LAS data to generate terrain, applies GeoTIFF orthophoto textures to the terrain, and then styles the buildings by height. The output is written to a 3D PDF.
The ability to style a 3D city model on a conditional factor, such as a delineated height, provides a powerful tool for data visualization, quickly identifying a group of buildings as being distinct from another on some given attribute. This highlights important features and adds another layer of information.
Source Data
GeoTIFF orthophotos, DWG 3D buildings and LAS point clouds
Step-by-step Instructions
1. Add Source Data
The source data we have DWG buildings, a LAS point cloud and two GeoTIFF orthophotos.
When reading in 3D_buildings.dwg, set the parameters:
-
Group Entities by: Attribute Schema
- To expose the BuildingID attribute.
2. Split the Ooint Cloud: PointCloudSplitter
In addition to the X, Y, and Z components, most point clouds have another component, which stores the point cloud classification. This classification is typically used to distinguish between the elevation of the ground, vegetation, and the buildings. In this example, all points classified as ground are split from the rest.
Connect the LAS point cloud to a PointCloudSplitter, in the parameters:
- Split By: classification
-
Unique Values to Keep: 2
- For ground classifications
3. Clip the Orthophoto and Create a Single Raster: Clipper and RasterMosaicker
By using the point cloud as the Clipper and the orthophotos as Candidate, all Candidates are clipped to the bounding box of the point cloud. The RasterMosaicker creates a single raster feature from the source orthophotos.
4. Create TIN: TINGenerator
Connect the Split output port of the PointCloudSplitter to the Points/Lines input port of a TINGenerator transformer. The TINGenerator creates a triangulated irregular network (TIN) from the point cloud. The surface tolerance determines which input points are added as vertices to the model. The larger the value, the more input points that will be filtered out, and the faster the surface model will be constructed.
- Surface Tolerance: 1
5. Prepare the Buildings: Aggregator, Bound Extractor, and TestFilter
The source Autodesk DWG CAD file consists of several features per building. To style all buildings consistently, connect them to an Aggregator transformer.
-
Group Processing: Enable
- Group By: BuildingID
To demonstrate two different styles, all buildings are split into two groups based on their height (z). This is done by using the BoundsExtractor to extract the minimum bounding rectangle of the feature’s coordinates into new attributes and then using the TestFilter to filter out whether the maximum is above or below 40m.
In the TestFilter, set Port Definitions to:
-
If: @Value(_zmax) < 40
- Output Port: < 40m
-
If Else: @Value(_zmax) > 40
- Output Port: > 40m
6. Add Appearance: AppearanceSetter
Appearances may define details of the color of a 3D surface, including its reaction to lighting, or define a texture of a surface.
6.1 Color of 3D surfaces
Add two AppearanceSetter transformers to the canvas. Double-click on the transformer to open its parameter window and click on the ellipse of the GeometryXquery field.
- Right Value: Interior Node
The Geometry XQuery parameter defines which part of a feature’s geometry the appearance is applied to. Many 3D features contain geometry organized in levels, and setting the Hierarchy Position to Interior Node ensures the appearance is applied to the parts that represent the visible building surfaces so the color appears correctly.
For buildings under 40m, set the following parameters in the AppearanceSetter:
- Diffuse Color: 0.666667,0,0
- Specular Color: 0,0,0
- Shininess: 0
- Alpha: 1
For buildings taller than 40m, in another AppearanceSetter transformer, set the following parameters:
- Diffuse Color: 85,170,255
- Specular Color: 1,1,1
- Emissive Color: 0,0,1
- Shininess: 1
- Alpha: 0.85
These color parameters produce two contrasting styles: A bright and shiny, nearly glass-like appearance and a dark matte color with low reflection.
Diffuse color defines the actual color of the object rather than the reflection. The most obvious effect on the appearance seems to be caused by the specular color. It defines the color of the reflection. A bright specular color can also support the shininess of a surface, while dark tones are useful for a matte effect. For bright and shiny effects it is a good idea to choose a bright emissive color which goes well with the diffuse color. Maximum shininess and some transparency helps to create a glass-like effect. For dark and more dull effects, or to avoid emissive color at all to reduce reflection, it is safe to choose black. Ambient color was avoided in these examples because the effects in the resulting 3D PDF document were minimal.
After experimenting with different settings, check the results in a native viewer of the chosen format. The results can be very different to the representation you see in the Data Inspector, since all color parameters are largely dependent on the 3D light settings of the different viewers.
6.2 Raster Overlay: AppearanceSetter
Next, connect the TINSurface output port from the TINGenerator to the Geometry input port of a new AppearanceSetter transformer. Then, connect the output of the RasterMosaicker to the Appearance port of the AppearanceSetter.
This setup allows the TINSurface geometry to be styled using the appearance from the orthophoto. Since the raster extent matches the surface model:
- Texture Mapping Type: From Top View
7. Write Data
Add a 3D PDF writer to the canvas. Add two feature types to this writer named buildings and terrain. The data is written to a 3D PDF and represents the 3D model in two different layers. To add another feature type to the same writer, right-click Feature Types under the 3D PDF writer in the Navigator and select Add Writer Feature Types.
When running the workspace, remember to adjust Rejected Feature Handling to Continue Translation. This setting can be found in the Navigator > Workspace Parameters > Translation.
Run workspace.
Completed Workspace
3D PDF output in Adobe Reader
Additional Information
Instead of a single color, different textures can be applied as an appearance to the buildings. Explore the AppearanceSetter parameters to adjust or apply different textures.
Data Attribution
The data used here originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.