March 30, 2018

Unreal Studio brings CityEngine neighborhood to life

By Ken Pimentel

Brazil’s favelas are dense with colorful, unconventional architecture. These sprawling hillside neighborhoods were first built around major metropolitan areas by displaced soldiers in the late 1800s, then continued to grow organically as rural Brazilians migrated to urban areas. The houses are built from low-cost or found materials over the course of generations, making a hodge-podge of architectural style and color.

Blog-body-image_real-favela.jpg

It’s not surprising that such an environment inspired designer Matthias Buehler of vrbn.io, an urban planning consultancy firm, to create a scale model of a fictional favela with Esri’s CityEngine urban planning software. “I had seen a favela once in southern Brazil,” says Buehler, “and I liked the combination of topography, dense vegetation and maze-like architecture.” Buehler, along with fellow artist Cyrill Oberhaensli, first built the CityEngine model in 2014, and recently gave it a fresh update for real-time rendering with Unreal Engine.
 

The favela model was exported to Unreal Engine via Datasmith, the CAD transfer tool in Epic’s new Unreal Studio. Datasmith reads the files exported from CityEngine and converts the entire scene for an optimized result in Unreal Engine. Epic first showed the integration of CityEngine and Datasmith at Siggraph 2017 when they worked with Esri and HOK (a well-known global design, architecture, engineering and planning firm) to create a demo of CityEngine and Unreal Engine, but wanted to use the favela project to push Datasmith’s capabilities even further.

“With CityEngine, you can not only have entire cities represented but also everything else around it,” says Pierre-Félix Breton, Senior Technical Product Manager at Epic. “For an architect, placing their new design in the context of its surroundings is very valuable. The advantage of using Unreal Engine is that you can then virtually experience the entire context of the design.”

CityEngine’s developers were also involved in optimizing the workflow, and improved CityEngine to more directly match what Unreal Engine needed. “The favela project gave us an opportunity to really test the limits of CityEngine,” says Simon Haegler, Software Developer at Esri. “We pushed all the knobs to eleven.”

Creating a Favela

CityEngine uses custom scripts (called rules) to lay out a neighborhood and populate the scene with procedural streets and buildings. CityEngine rules can control the size and appearance of buildings, streets, sidewalks, and foliage, and the distribution of other urban elements like telephone lines and trash cans.

blog-body-img-1.jpg

Favela’s procedural buildings, walkways, and foliage in CityEngine

Materials can also be rule-based. Buehler prepared a number of textures for different types of facades, and used rules to combine and apply the textures based on building dimensions and other factors. Colors and even distress, cracks, and dirt can also be varied using rules.

Because building is always ongoing in a favela, loose building materials and tools are often lying around. Incidentals like pallets, bricks, buckets, and trash bags were created as low-poly models in Autodesk Maya and Maxon Cinema 4D. After importing the models to CityEngine, the models were instanced and distributed using custom rules.

When all models and instances were in place, the scene topped out at about 150 million polygons.

blog-body-img-2.jpg

Rule-driven asset distribution on incidental scene elements

Exporting the Favela

In the first version of the model created in 2014, Buehler reduced the total number of materials in the scene by reusing them where possible. In his 2014 video about the first favela model, he included a few stills rendered with Maxwell Render. Even with material reduction, each frame took 10-40 hours to render. This is an insurmountable barrier to experiencing the design—it needs to be interactive to reach the goal of an “experience”.

Datasmith for CityEngine natively provides optimizations that facilitate real-time playback within Unreal Engine. Instanced CityEngine elements like foliage can easily send poly counts sky-high when treated as individual objects during export. The Datasmith exporter takes CityEngine instances and translates them to Unreal Engine instances, reducing memory usage and optimizing real-time playback. Models imported to CityEngine and distributed as instances, such as loose building materials, A/C units, and trash cans, were also converted to Unreal Engine instances by Datasmith.

“The Datasmith exporter is written in a way that it’s not necessary to do anything special,” says Haegler. “It’s pretty much click and go.”

blog-body-img-3.jpg

Exporting the favela model from CityEngine

blog-body-img-4.jpg

Favela model after import to Unreal Engine

“During the beta period, we worked directly with Esri to improve Datasmith,” says Pimentel. He adds that Esri was the first partner Epic worked with on improving the API, and that during iterative testing they improved export speed by more than 10x.

Once the scene was imported to Unreal Engine, Benjamin Neukom, Software Engineer at Esri, made a few adjustments to materials and lighting. Since only a few materials in the favela model are reflective, he was able to use Screenspace Reflections rather than Reflection Captures.

Neukom used dynamic lighting rather than baked lighting “because we wanted fast iterations to get a good feeling for the overall mood of the scene.” To give the impression of light shining from the windows of background buildings, Neukom saved the expense of using actual lights by using an Emissive Mask to cause high-intensity pixels on these buildings to glow.

“By working with Esri, we were able to fully prove the Datasmith API,” says Pimentel. “The testing process revealed many areas where complexity of Esri data was a bottleneck. Improvements were made on both sides of the pipeline that will benefit all of our users.”

Where It’s Going

Epic and Esri see the recent release of Unreal Studio, a suite of plug-ins, templates, and training on the CAD-to-Unreal pipeline, as an important step in the rise of real-time rendering in the architectural visualization space.

“Architecture has depended on static imagery for some time now, but this blocks natural interaction and the opportunity to experience design on a human scale,” says Pimentel. “Now, architects, planners, and designers can rapidly iterate on their proposals and then experience the result immersively.”

He adds that the improvement in real-time engines has been a driver for this evolution—with real-time rendering, you get the possibility of immersive experiences. The rapid adoption of Unreal Engine, shown in a recent CGArchitect survey, is evidence of this trend. Although VR isn’t yet mainstream for urban planning, “the interest is there. It’s just been difficult to get the complex data into a real-time engine without a lot of data preparation, but we’ve now tackled that issue with Esri,” says Pimentel.

“Real-time rendering opens up the possibility of bringing people together in a collaborative environment to better understand design. We’re breaking down the barriers one by one, and opening the door to an interesting future.”.

Ready to try Unreal Studio? Download the free beta here.