Cornel Hillmann – DIGITAL PRODUCTION https://digitalproduction.com Magazine for Digital Media Production Wed, 04 Dec 2024 13:29:20 +0000 en-US hourly 1 https://digitalproduction.com/wp-content/uploads/2024/09/cropped-DP_icon@4x-32x32.png Cornel Hillmann – DIGITAL PRODUCTION https://digitalproduction.com 32 32 236729828 Procedural Worldbuilding mit Unreal https://digitalproduction.com/2024/05/28/procedural-worldbuilding-mit-unreal/ Tue, 28 May 2024 21:18:00 +0000 https://digitalproduction.com/?p=144470
We build realtime environments with Unreal's Procedural Content Generation Framework (PCG) - or do you really want to do everything by hand?
]]>

When Epic Games presented the first experimental version of the PCG framework with Unreal 5.2, the excitement among UE5 users was great at first – procedural tools already existed in the Unreal world before, these were built on a blueprint or C plug-in basis, but of course they do not come close to a native PCG framework or a Houdini integration in terms of possibilities. Generating complex procedural environments was previously only possible via Houdini integration. Well-known early examples of this are titles such as Far Cry 5 or Spiderman (PS4), where gigantic maps were constructed using SideFX’s procedural tools via Houdini Connect with a direct engine connection. The first question that was immediately discussed by aspiring technical artists was: Will Unreal PCG replace Houdini in the short or medium term? Will the time investment in these tools no longer be worth it?

Houdini, Blender, or Unreal?

This is of course not the case, as Houdini will certainly remain an integral part of the pipelines of large developers such as Ubisoft in the future. The highly complex but extremely effective combination of Houdini Digital Assets (HDAs), VEX Scripting and Session Sync is far too far ahead of its time for that. On the other hand, it shows that procedural tools are gaining ground everywhere, as can be seen with Blenders Geometry Nodes. The advantages are obvious: designing complex scenes much faster, while at the same time having total creative control over the result.

The second question that was often discussed in forums in this context was: What role does the environment artist actually still play here? Or, who is in charge here: is this still biomass or already AI? This question is of course understandable, especially in view of the fact that some people can already hear the trumpets of the AI apocalypse sounding. But here, too, the all-clear can be given for the time being, because although dynamic content is generated via PCG algorithms, it is still under the full control and creative will of human brain cells.

In Epic Games Electric Dreams PCG Demo, you navigate through a seemingly endless jungle that always looks alive thanks to the depth of detail and endless variations. PCG parameters can be used to control and change density and scene detail as desired.

The Unreal PCG Era begins

Unreal’s PCG framework is similar in use to the proven Blueprint Visual Scripting System. In the node-based environment, spatial data is tapped, points with PCG properties are generated from it, which in turn are re-sorted, filtered and processed in the data flow in order to then calculate the final position of the points from the conditions of the PCG logic, at which the mesh is generated from its corresponding parameters.

The special PCG graph is also smoothly embedded in the Unreal ecosystem, it can be extended as a component in Blueprint Actors and remains scalable and performant thanks to Nanite’s Virtualised Micropolygon Geometry System. Surprisingly, PCG also works “at runtime”, meaning that PCG graphs can be executed in real time, which literally opens doors to new worlds. Procedural worlds, as already familiar in principle from titles such as No Man’s Sky, can of course also be useful in virtual production, for example to control scene characteristics in real time via user parameters. In the applications and examples from Epic Games to date, the focus has been on landscape and nature, while the complex topic of buildings, infrastructure and cities has been approached rather cautiously. Work is currently still underway to make these areas more user-friendly, as revealed during the developer streams in the Q&A.

UE 5.4: Procedurally into the future

After Epic Games opened the PCG chapter with Unreal 5.2, some details were simplified in version UE 5.3. With version UE 5.4, however, some decisive performance improvements and a whole host of new nodes have now been added to make the workflow much easier. For example, there is now a Water Spline Interop Node, which makes it much easier to sample depth and width along water splines. In order to capture river water body data in particular, mathematical contortions were previously necessary to obtain usable results. A real little surprise in the UE 5.4 preview is the new Biome Core plug-in. Once activated, Epic uses an example level map to demonstrate what the future of standardised biome creation will look like.

With the new PCG Biome Core and Biome Sample plug-in from the Unreal 5.4 preview version, Epic Games uses the new nodes to show what the standardised procedural landscape generation of the future will look like.

On the one hand, this is also a showcase for the new hierarchical logic functions such as recursive subgraphs, and on the other, an initiative for a kind of standard PCG graph template for natural elements that can be adapted to the situation without always having to start from scratch. At the GDC 2024, State of Unreal presentation (is.gd/unreal_gdc_2024), some practical examples were also shown. Lego in particular, one of Epic’s largest partners alongside Disney, demonstrated the flexible application methods for PCG landscapes in the familiar building block look. The new 5.4 PCG features are supported by other innovations that are important for environment design. Nanite Dynamic Tessellation, allows dynamic landscape displacement at runtime, i.e. in real time, for example to change surface details. The Nanite Spline Meshes function, useful for generating roads, for example, has been optimised and is now “production ready”. For heterogeneous volumes, i.e. realistic fire and smoke simulation, there is now better render integration with shadows and transparent objects. In other words, many improvements in detail for landscape themes, in addition to the big show favourites such as the new motion graphics mode and the new animation tools: Motion Matching, automatic retargeting and the great new control rig modules. Unreal Version 5.4 is an impressive update, especially in terms of performance. This paves the way for building huge and detailed real-time environments, whether for open world games or as environments for virtual production.

An overview of the Electric Dreams jungle with the alternative viewport views: Lighting only, Wireframe and Nanite Instances.

Dark calls from the forest: the Electric Dreams demo

To be able to use the new procedural tools in Unreal, the PCG plug-in must first be activated. The easiest way to get a quick overview of the possibilities is with the Electric Dreams example project from Epic Games, which was presented in mid-2023. This impressive example, which certainly makes some hardware demands (recommended minimum graphics equipment: RTX 4080), demonstrates what PCG can achieve using a seemingly endless jungle landscape. If you want to take the forest frenzy to the next level, you can also do so with a VR version, which the enterprising Youtuber JSFILMZ has equipped with additional details such as animals on Artstation (is.gd/artstation_UE_dreams_demo).

It goes without saying that you’ll need a computer with a sporty set-up, as the wild undergrowth with dense undergrowth on a huge terrain is a real challenge. Nevertheless, the jungle madness is made up of surprisingly manageable asset building blocks, as relatively few, but dynamic Quixel asset packages are sufficient to populate the green hell.

The Quixel assets in question are packaged in assemblies that can be edited by right-clicking, as has been the case since version 5.0. If you now want to customise the integrated PCG components of the scene, you can easily do this with the integrated spline curve via the Details panel. This means, for example, adding a point via Alt-Drag so that this section of the landscape is extended along the curve, or moving, copying or duplicating the points of the curve as desired. Parameters such as Seed and Density are easily accessible and additional mesh features can be switched on and off. If you want to quickly try out a different look, all you have to do is swap the scatter presets and the environment is visually customised. Conclusion of the Electric Dreams demo: A breathtaking forest expedition with Unreal’s powerful new PCG tools, which give you an idea of where the procedural journey is heading.

The PCG Engine plugins, PCG demo user parameters in the detail window and the PCG graph of an assembly.

The parametric landscape construction kit

The easiest way to get a quick “aha” experience for the practical application is to start with a fresh scene and try out a typical use case, e.g. a landscape with a building surrounded by dense forest. So, create a new modular map within the Electric Dreams project via File, add landscape material to all landscape tiles and place the Blueprint Actor in the scene via the Content Browser. All the magic now unfolds when you activate the Generate button in the Details panel of the PCG section. As expected, the terrain is now populated with the forest assets and you are free to make one or two adjustments. To generate a recess for the building, another Blueprint Actor is required, which can also be found in the Content Browser: The Actor. Placed in the desired area, it now has a spline curve in the detail window, which can be used to precisely determine the recess boundary to the forest growth.

Once the building has been placed, for example the Medieval Castle Asset from Game Asset Factory for demonstration purposes, which can be quickly assembled in a modular fashion, the landscape can now be precisely customised. The beauty of this procedure is that the spline curve can now be used to determine exactly how close the wild growth should be to the walls and how much space the walls need in the composition. Putting the PCG components together shows the productivity gain that can be achieved here. If this undergrowth had been inserted by hand or painted via Asset Painter as before, the time required would have been many times longer.

Reforesting, starting from scratch

To rebuild PCG Actors from scratch, the PCG plug-in must first be activated. A new scene with PCG Graph, which is placed as a volume in the landscape, is then created via the PCG entry in the Content Browser right-click menu, for example. The Blueprint Actor is now added as an additional element, which in turn contains a spline curve as a component that can now be addressed via a tag.

In blueprint fashion, the corresponding nodes are now linked in the PCG Graph in order to retrieve and process data from the spatial scene information. For example, via “Get Landscape Data” or “World Ray Hit Quary” (to hit several loose objects from one direction, for example), or as in the example just mentioned with “Get Spine Data” to generate landscape points from the curve information, modify them and then spit out the mesh objects at the new coordinates. This can be achieved quickly by using Get DSpline Data to call a Blueprint Actor with its own tag (here DPdemo) and using Spline Sampler to retrieve its spline information in order to then refine the points generated from it using Transform Points and then deliver them to the Static Mesh Spawner Node, where the mesh object is finally generated.

The PCG building blocks: Quixel assets as compunds and then as “Packed Level Actors” blueprints, which can be controlled via details parameters and spline curves

Fortunately, you can use a debug function with keyboard shortcut d to call up the debug visualisation for each node in the PCG graph and use shortcut e to temporarily deactivate the individual nodes. This helps enormously when using the rough debug point view to analyse exactly where the points fall so that you can quickly make improvements without having to generate the entire landscape every time.

A PCG scene setup in a quick test with assets from the Electric Dreams demo. Create forest, define recess via spline, add modular buildings. The castle with forest surroundings is finished.

There are various ways of generating and distributing the various landscape elements such as trees, bushes and tufts of grass, etc. For example, you can use filter functions to filter out points for generation, organise PCG graphs in a nested manner via subgraphs, or simply create new offshoots in the PCG graph, each of which then has its own functions and generates additional mesh types.

If you now want to incorporate additional landscape functions, this can be achieved using additional Blueprint Actors with Spline Component. For example, clear a path through the forest by calling this new Spine Actor in the PCG Graph via a tag and extending its width via the Bounds Modifier Node so that the resulting point mass can then be subtracted from the previous one via the Difference Node. The result is the aforementioned path through the undergrowth, which, like the forest section, can be dynamically modified and expanded.

BU PCG right from the start: PCG volume and blueprint actor with spline, preview of the point distribution via debug mode, Quixel Alden trees as mesh output at the point positions. Then added a branch for grass detail and small bushes. Then to clear a path in between, a Blueprint Actor with Spline and Bounds modification via Difference Node from the previous one

Other components from the Unreal landscape system can of course be perfectly combined with PCG Graphs, such as the river, lake and ocean elements of the Unreal Water plug-in. Once activated, the water landscape parts are now available and as the lake and river have inbuilt splines to shape the form, these can of course also be accessed via the PCG Graph.

For example, if you now place a lake (Water Body Lake) in the scene, you can now call it up in the PCG Graph via get Spline Data by defining All Actors of Class as the selection method and On Interior in the spline sample. The generated point mass must now be expanded slightly via Transform Points scaling and subtracted as before, so that the piece of forest in the landscape is then dynamically pushed back.

The “Basic Forest” from Hyper in the island demo. With a “World Ray Hit Quarry” the surface information such as rock or grass area is retrieved via Unreal Physical Material. In the PCG main graph, the data flow passes through the packed subgraphs, including the exclude subgraph, until the points are passed through filter transformation to mesh generation. The frequently used “Self-Pruning” node excludes overlaps. In the subgraphs shown below, you can see how the data is formed from the “Density propagation”, the custom user parameter “Density” is integrated for control and the excluded landscape parts are sorted out via Difference.

With this method, quite complex constructions can now be built, where different splines and parameters interact dynamically in a controllable way in order to control component weighting in addition to density, scale and feature activation. The Electric Dreams demo discussed at the beginning is a good showcase for this, as the PCG Graphs from Epic Games demonstrate that everything is possible in terms of complexity. Points quantity deducted. To address a lake with the corresponding spline via the Unreal Water plug-in, all you have to do is select the pond via Class Selection and move the forest back via Difference.

Also works: PCG constructions for components

Of course, PCG Graphs also work for the generation of man-made structures such as walls, roads and buildings. As the system is still quite new and the documentation is rather sparse so far, we have to rely on examples from Unreal users, who have been able to discover solutions through trial and error. As already mentioned, it is to be expected that this area will be better documented and easier to use in the near future.

In this example, the PCG Graph generates a point from the world position of the Blueprint Actor, which is then multiplied and positioned via Transform Points to form the base area. The result is merged to create a spline, from which the meshes are then generated via a spline sampler. This results in the ground floor from the meshes of the building segment. With a point offset on the Z-axis, the storeys and the top roof with structure are now created.

In principle, building structures are no different to landscape vegetation: points are generated, filtered according to parameters, multiplied and controlled, and then placed as a mesh at the end. For example, as a PCG component in a Blueprint Actor, which is positioned in the map. In the PCG graph, the first point in the world position is then generated via Get Actor Data, this is then copied several times via Transform Points, moved, merged, redivided via Spline Sampler and then generated as a static mesh component at the end positions, so that the starter content wall pieces (wall with window) become seamless building structures, which can then be set up as new floors via offset values. This principle can of course be continued by generating further building clusters and entire cities with additional offset values and variation parameters. There is certainly more to come.

Marketplace PCGs: Designer assets with benefits

You don’t always have the time to build a flexible and well-structured PCG graph yourself. One shortcut is to get concepts or inspiration from the PCG section of the Blueprint Web Depository blueprintue.com/search, or simply copy/paste your own project. Another way is to go on a shopping tour with commercial PCG providers. Exemplary structured and documented PCG assets are available, for example, from the Unreal Marketplace provider Hyper. Hyper’s Basic Forest (is.gd/marketplace_basic_forrest) is elegantly structured, with the key PCG elements packaged in clear PCG subgraphs. This means that the structure and function can be quickly understood and easily edited. The density of the individual landscape elements can be adjusted quickly and it is immediately clear how the result is achieved.

Hyper’s Basic Forest PCG in a custom environment decorated with Quixel assets. This time the building was created using Blender with the Procedural Building Generator 2.

The asset pack is supplied with the corresponding elements, trees, bushes, rocks and even small parts such as mushrooms and debris. These are distributed across the landscape according to the parametric specifications of the PCG Graph, leaving out water and rocky ground. The demo map with an overgrown island presents the full splendour of the PCG elements and a short tour is a real joy. The preset assets can of course be swapped with your own assets to customise them to your own scenes.

Conclusion

This type of user-friendly PCG asset also shows where the future lies. This applies in particular to Unreal users who need quick results and do not necessarily want to build a PCG system from scratch. At the moment, however, there are still relatively few PCG assets available in the Unreal Marketplace, which is certainly due to the fact that the system is still too new. A lot will certainly change in the future, and you can expect various landscape, building and city builder asset solutions based on PCG to appear over time. The future is procedural!

]]>
DIGITAL PRODUCTION 144470