Runtime Virtual Texturing Quick Start

This guide walks you thorugh setting up a Landscape and its material to use Runtime Virtual Texturing.

Choose your operating system:

Windows

macOS

Linux

This guide refers to materials found in the Content Examples project available from the Epic Games Launcher under the Learn tab. While the materials are not required to do the steps below, setting up the landscape to function properly with painted landscape materials is.

See the Landscape Quick Start Guide before continuing, or open the Content Examples project Landscapes map under the Learn tab for use with this guide.

In this Runtime Virtual Texturing (RVT) quick start, we'll walk through the process of setting up and using RVT for your Landscape and non-Landscape components in your own projects.

Before starting this guide, it's important to understand that Runtime Virtual Textures work best with Landscape terrains for a few reasons:

  • Complex Landscape materials cache the shading results for a performance win.

  • Improved quality and variation is achievable with spline and decal-type effects.

  • Blending of non-Landscape Actors with your Landscape is handled by the same RVT Asset.

After going through this guide, you'll have a better understanding of:

  • Setting up a Runtime Virtual Texture Asset and how it connects to different components.

  • Enabling Runtime Virtual Texturing for a Landscape Material.

  • Setting up a Runtime Virtual Texture Volume in your Level.

  • Setting up additional Actors to render to the Runtime Virtual Texture.

1 - Project Setup

Before you can use Runtime Virtual Textures, you must first enable it for your project. Follow these steps:

  1. From the main menu, select the Edit menu and select Project Settings . Under the Engine > Rendering > Virtual Textures category, set Enable virtual texture support to true.

    1_1_ProjectSettings.png

  2. Restart the Project.

2 - Creating a Runtime Virtual Texture Asset

The Runtime Virtual Texture Asset contains the configuration details for the RVT Asset assigned to a Runtime Virtual Texture Volume. The RVT Asset also works by linking Materials and other Actors in your scene that need to share data.

  1. In the Content Browser , use the right-click context menu or the Add New button to create a Runtime Virtual Texture Asset from the Materials & Textures category.

    2_1_CB_AddNew_RVTAsset.png

  2. Give the Runtime Virtual Texture Asset a name. For this guide, ours is named VT_Test .

  3. Double-click the Asset to open the Runtime Virtual Texture Asset to configure its available properties.

    2_1_RVT_Asset_Window.png

    From this window, you can define the runtime virtual texture's size, tile size, and type of Material Attributes it supports, and setting the number of low mips to render for use with streamed virtual textures. These settings can be adjusted in real time while working in the editor to see their changes take effect.

    For details and usage of these settings, see Virtual Texture Settings page.

3 - Creating a Runtime Virtual Texture Material

From this step forward, assets from the Content Examples project are used. These are not required to proceed, but are recommended.

In this step, we'll be using a simple Landscape material for runtime virtual texturing support. In addition, we'll set up logic using some RVT-specific Material Expressions that allow for the material to fall back to its original use when virtual texturing isn't available on a supported platform.

Setting up your material to work with RVT requires that two contexts be considered:

  • Part of the material will write to the RVT Asset.

  • Part of the material will sample from the RVT asset and apply further logic.

This example landscape material, taken from the Content Examples project, has a simple layer blend setup for Snow, Grass, and Rock.

Click image for full size.

If you're not using the material from Content Examples, you can recreate it as shown above. However, keep in mind that you'll still need to properly set up the Material for use with a Landscape. Follow the Landscape Quick Start Guide if you need a starting point.

The sections that follow will break down parts of this Material to demonstrate how we're writing to and sampling from the RVT Asset.

Required Material Setup

Setting up a Landscape material for use with an RVT Asset is the same as setting up a traditional one, with one exception; Use Material Attributes should be enabled. This option enables use to use Make Material Attributes expressions to rebuild and output the material for different use cases supported.

  1. Open your already-created or available Landscape material. Right-click in the graph and search for a Make Material Attributes expression. Add one to your graph.

  2. Move the wire connections from the Main Attributes node to the Make Material Attributes node. You should have something that looks like this:

    Click image for full size.

  3. Now, with the Main Attributes node selected, use the Details panel to enable Use Material Attributes .

    3_1_3_EnableUseMatAttributes.png

  4. Pull off the output of the Make Material Attributes node and create a Runtime Virtual Textures Feature Switch node. This should plug it into the No input. Connect that to the Material Attributes output.

    3_1_4_RVTFeatureSwitchNode.png

Your material should now look like this:

Click image for full size.

Writing to the Runtime Virtual Texture Asset

Next, the material needs to write to the RVT Asset through the Runtime Virtual Texture Output expression. This node references the RVT Asset created earlier in this guide and enables corresponding Material Attributes (such as Base Color, Roughness, and Normal) to be used as input attributes of this node.

  1. Right-click and add a Runtime Virtual Texture Output node to the graph.

    Click image for full size.

  2. Connect the node wires for each material attribute input that is listed on the node. For ones not used in your base material, use a constant value in its place.

    3_2_2_ConnectRVTOutputInputs.png

    To limit confusion of wires in complex material graphs, double-click on any wire to create a reroute node. For example, adding a node on the wire for inputs like the Base Color or Normal. It can be useful to have a single wire handle both inputs for the RVT Output and Make Material Attributes nodes.

Your material should now look like this:

Click image for full size.

The first part of this material is where all the layer blending and logic is happening. It is all the camera independent shading that can be cached to the RVT Asset. Other objects (such as splines and decals) are expected to be composited to the output of this node by the RVT System.

Sampling from the Runtime Virtual Texture Asset

Next, the material needs to sample from the RVT Asset using the Runtime Virtual Texture Sample expression.

During this part of the graph, the RVT Asset is sampled and applies camera dependent or additional shading operations here. The RVT Asset attributes are samples and routed to the final Material output, so the less work is done during this part of the graph, the cheaper the rendering for this material will be.

  1. Right-click and add a Runtime Virtual Texture Sample node.

    Click image for full size.

  2. Right-click and create another Make Material Attributes node. Connect the outputs of the Runtime Virtual Texturing Sample node to the corresponding inputs of the Make Material Attributes node.

    3_3_2_AddConnectMakeMatAttribute.png

  3. Connect the output of the Make Material Attributes node to the Yes input of the Virtual Texture Feature Switch node.

    Click image for full size.

  4. Select the Runtime Virtual Texture Sample node. In the Details panel, use the Virtual Textures Asset selection box to assign your RVT Asset you created earlier in this guide.

    3_3_4_AssignRVTAssetTOrvtSampleNode.png

  5. Connect the output of the Virtual Texture Feature Switch node to the input of the main Material Attributes node.

    3_3_5_VTFeatureSwitchTOmainAttributes.png

  6. Save and Close this Material.

Your material should now look like this:

Click image for full size.

4 - Placing a Runtime Virtual Texture Volume

Now that you've set up your material to support runtime virtual texturing, in this step, we will place a Runtime Virtual Texture Volume in our level. We will scale and rotate it to encompass our landscape using some built-in tools before assigning our RVT Asset to the volume.

  1. In the Modes panel, search for a Runtime Virtual Texture Volume under the Volumes category and drag it into the scene.

    Click image for full size.

  2. With the RVT Volume selected, you can use the Details panel to quickly scale and rotate the volume to encompass the bounds of a selected Actor.

    1. Under the Transform from Bounds category, use the Source Actor selection box to select an Actor that is placed in the level or use the eyedropper to select one.

      4_2_TransformFromBoundsSettings.png

    2. Click the Copy Bounds and Copy Rotation button to scale the RVT Volume to the bounds and rotation of the selected Actor.

      Any objects sampling from or writing to the RVT Asset should be inside the RVT Volume's bounds.

  3. Under the Virtual Texture category, assign your RVT Asset to the Virtual Texture asset selection box.

    4_3_AssignRVTAsset.png

If everything is set up correctly with the material M_LandscapeMaterial and it's correctly assigned and painted onto your Landscape terrain, the RVT Volume with the RVT Asset assigned should render correctly. If not, the material will render black.

4_0_RVTVolumeOutput.png

5 - Rendering Actors to a Runtime Virtual Texture

Now that your base Landscape material is set up and rendering to the RVT Asset, we can start to add other Actors in the world that we want to render to the RVT. In this step, we'll enable the Landscape spline— that represents the road—to Render directly onto the Landscape through the RVT.

This part of the guide is using the Landscape spline already set up in Content Examples. However, the steps shown here can be applied to other Actors and their Materials. The spline is a practical example of a good use case for rendering to a runtime virtual texture.

  1. Navigate to the Modes panel and select the Landscape tab, and then select the Manage button.

    5_1_SelectLandscapeMode.png

  2. Under the Landscape Editor category, use the dropdown to select Edit Splines .

    5_2_SelectEditSplines.png

  3. In the Level Viewport, select any part of the spline. In the level Details , click the Segments button to select all segments that make up this spline.

    5_3_SelectSplineSegments.png

  4. Under the Landscape Spline Meshes category, expand the Spline Meshes array. The Static Mesh SM_Street should be assigned. Double-click on it to open the Static Mesh Editor.

    5_4_a_SplineStaticMesh.png

    Then under its Material Slots , double-click on Element 0 M_Street material to open it in the Material Editor.

    5_4_b_SplineStaticMeshMaterial.png

    For this Static Mesh and Material assigned, Element 0 was chosen because it's the base Material used for slot 0 and 1, with Element 1 being a child Material Instance of Element 0. Keep in mind that any Material that is to be rendered to the RVT Asset needs to be set up using the steps that follow.

  5. In the Material Editor with the Main Material node selected, under the Details panel, set the Material Domain to Virtual Texture .

    5_5_SplineMaterialSetup.png

  6. Save and Close both the Material and Static Mesh Editors.

  7. Back in the Level Viewport with your Landscape spline still selected, look in the Level Details panel under the Virtual Textures category. Click the add (+) button to add a new array element to the list. Assign your RVT Asset to this array element.

    5_6_SplineSetupAssignRVTAsset.png

In the Level Viewport, you should now see that the spline's material is rendered into the RVT Asset on the Landscape instead of floating along the spline path that is slightly above the terrain surface.

Without Runtime Virtual Texturing

With Runtime Virtual Texturing

Here's a closer look at the spline material being applied to the surface of the landscape using RVT.

Without Runtime Virtual Texturing

With Runtime Virtual Texturing

6 - On Your Own!

Now that you've worked through this guide and set up a Landscape material to use a Runtime Virtual Texture, you can start to explore applying your own Actor's materials to be rendered to the RVT. Use some of the suggestions below to get started:

  • Add a another Static Mesh to the RVT that can be applied like a decal. Look at how you can use a Static Mesh Plane with a masked material to add decal-like details to your terrain.

  • Use Foliage instances to paint meshes that can render to the RVT to create unique variations to your terrain.

  • Use multiple Runtime Virtual Texture Assets to manage different types of Actors, and how they render to your Runtime Virtual Texture Volume.

  • Use the Translucency Sort Priority to set the layer order for how Actors are rendered to the RVT. For example, 0 would be the bottom layer and higher values would stack on top of each other.

언리얼 엔진 문서의 미래를 함께 만들어주세요! 더 나은 서비스를 제공할 수 있도록 문서 사용에 대한 피드백을 주세요.
설문조사에 참여해 주세요
건너뛰기