Voxel Plugin
2.0p-340
2.0p-340
  • Home
  • Getting Started
    • Installing Voxel Plugin
    • Installing Example Content
    • Migrating from 1.2
  • Knowledgebase
    • Using Graphs
      • Graph Preview
      • Buffers and Uniforms
    • Channels
    • Surfaces & Materials
      • Working with Surfaces
        • Distance Fields & Distance Checks
        • Applying Materials to a Surface
      • Material Definitions
        • Creating Materials from Scratch
        • Extending the Complex Material Sample
        • Technical Details
        • Detail Textures
    • Brushes
      • Voxelized Meshes
    • Foliage
    • Navmesh & Collision
    • Sculpt Volumes
    • Blueprints
      • Setting graph parameters
      • Querying voxel graphs
    • Graph Design
      • Why Landmass & MetaGraphs
      • Execution Flow & Query Data
      • Node Types
      • MetaGraph Macros
      • Adding Custom Nodes
    • Profiling & Debugging
      • Generation Performance
      • Memory Usage & Render Performance
      • Debugging plugin code
    • Platform Support
      • Targeting Mac & iOS
      • Targeting Android
  • Resources
    • Voxel Graph API
      • Exec Nodes
        • Edit Sculpt Surface
        • Execute
        • Merge Execs
        • Debug
          • Debug Delay
        • Set Sculpt Source Surface
        • Register To Channel
        • Generate Marching Cube Collision & Navmesh
        • Generate Marching Cube Surface
        • Create Marching Cube Preview Mesh
        • Write Volume Texture
        • Generate Point Collision
        • Render Mesh
      • Misc
        • Get Previous Output
        • Query with Gradient Step
        • Query with Position
        • Filter Buffer
        • Make Value
        • Is Valid
        • Get Collision Enabled
        • Get LOD
        • Get Point Chunk Bounds
        • Is Editor World
        • Is Game World
        • Is Hidden in Editor
        • Is Preview Scene
        • Get Position 2D
        • Get Position 3D
      • Sculpt
        • Get Sculpt Surface
      • Point
        • Make Chunked Points
        • Merge Points
        • Set Point Attribute
        • Get Point Attribute
        • Set Actor Property
        • Get Actor Property
        • Set Parent Point Attribute
        • Get Parent Point Attribute
        • Set Point Mesh
        • Get Point Mesh
        • Get Parent Point Mesh
        • Set Point Position
        • Get Point Position
        • Get Parent Point Position
        • Set Point Rotation
        • Get Point Rotation
        • Get Parent Point Rotation
        • Set Point Scale
        • Get Point Scale
        • Get Parent Point Scale
        • Set Point Normal
        • Get Point Normal
        • Get Parent Point Normal
        • Set Actor Class
        • Get Actor Class
        • Get Parent Actor Class
        • Set Point Custom Data
        • Get Point Custom Data
        • Get Parent Point Custom Data
        • Get Point Seed
        • Apply Translation
        • Apply Rotation
        • Apply Scale
        • Apply Point Storage
        • Generate Surface Points
        • Make Points
        • Get Points
        • Filter Points
        • Density Filter
        • Make Radial Point Spawner
        • Prune by Bounds
        • Prune by Distance
        • Raymarch Distance Field
        • Scatter Points
      • Material
        • Make Material
        • Make Float Detail Texture Parameter
        • Make Color Detail Texture Parameter
        • Make Material Detail Texture Parameter
        • Make Normal Detail Texture Parameter
        • Make Scalar Parameter
        • Make Vector Parameter
      • Math
        • Trig
          • Sin (Radians)
          • Sin (Degrees)
          • Cos (Radians)
          • Cos (Degrees)
          • Tan (Radians)
          • Tan (Degrees)
          • Asin (Radians)
          • Asin (Degrees)
          • Acos (Radians)
          • Acos (Degrees)
          • Atan (Radians)
          • Atan (Degrees)
          • Atan2 (Radians)
          • Atan2 (Degrees)
          • Get PI
          • Radians to Degrees
          • Degrees to Radians
        • Float
          • Bilinear Interpolation
          • Frac
          • Power
        • Boolean
          • NOT Boolean
          • NOR Boolean
          • XOR Boolean
          • AND Boolean
          • OR Boolean
          • NAND Boolean
        • Integer
          • Left Shift
          • Right Shift
          • Bitwise AND
          • Bitwise OR
          • Bitwise XOR
          • Bitwise NOT
        • Rotation
          • Make Quaternion
          • Break Quaternion
          • Make Rotation from Z
          • Combine Rotation
        • Operators
          • Equal
          • Nearly Equal
          • Not Equal
          • Less
          • Greater
          • Less Equal
          • Greater Equal
          • Ceil
          • Round
          • Floor
          • Add
          • Subtract
          • Multiply
          • Divide
          • % (Integer)
          • Min
          • Max
          • Abs
          • One Minus
          • Sign
        • Misc
          • Clamp
          • Mapped Range Value Clamped
          • Mapped Range Value Unclamped
          • Height Splitter
          • Interpolate
          • Lerp
          • Safe Lerp
          • Smooth Step
        • Seed
          • Mix Seeds
          • Make Seeds
        • Vector Operators
          • Cross Product
          • Dot Product
          • Normalize
          • Length
          • Length XY
          • Distance
          • Distance 2D
        • Conversions
          • To Double Vector (Double Linear Color)
          • To Double Vector 2D (Double Linear Color)
          • To Linear Color (Double Linear Color)
          • To Vector (Double Linear Color)
          • To Vector 2D (Double Linear Color)
          • To Double Linear Color (Double)
          • To Double Vector (Double)
          • To Double Vector 2D (Double)
          • To Float (Double)
          • To Double Linear Color (Double Vector 2D)
          • To Double Vector (Double Vector 2D)
          • To Linear Color (Double Vector 2D)
          • To Vector (Double Vector 2D)
          • To Vector 2D (Double Vector 2D)
          • To Double Linear Color (Double Vector)
          • To Double Vector 2D (Double Vector)
          • To Linear Color (Double Vector)
          • To Vector (Double Vector)
          • To Vector 2D (Double Vector)
          • To Double (Float)
          • To Linear Color (Float)
          • To Vector (Float)
          • To Vector 2D (Float)
          • To Double (Integer)
          • To Float (Integer)
          • To Int Point (Integer)
          • To Int Vector (Integer)
          • To Int Vector 4 (Integer)
          • To Seed (Integer)
          • To Double Linear Color (Int Point)
          • To Double Vector (Int Point)
          • To Double Vector 2D (Int Point)
          • To Int Vector (Int Point)
          • To Int Vector 4 (Int Point)
          • To Linear Color (Int Point)
          • To Vector (Int Point)
          • To Vector 2D (Int Point)
          • To Double Linear Color (Int Vector 4)
          • To Double Vector (Int Vector 4)
          • To Double Vector 2D (Int Vector 4)
          • To Int Point (Int Vector 4)
          • To Int Vector (Int Vector 4)
          • To Linear Color (Int Vector 4)
          • To Vector (Int Vector 4)
          • To Vector 2D (Int Vector 4)
          • To Double Linear Color (Int Vector)
          • To Double Vector (Int Vector)
          • To Double Vector 2D (Int Vector)
          • To Int Point (Int Vector)
          • To Int Vector 4 (Int Vector)
          • To Linear Color (Int Vector)
          • To Vector (Int Vector)
          • To Vector 2D (Int Vector)
          • To Double Linear Color (Linear Color)
          • To Double Vector (Linear Color)
          • To Double Vector 2D (Linear Color)
          • To Vector (Linear Color)
          • To Vector 2D (Linear Color)
          • To Integer (Seed)
          • To Double Linear Color (Vector 2D)
          • To Double Vector (Vector 2D)
          • To Double Vector 2D (Vector 2D)
          • To Linear Color (Vector 2D)
          • To Vector (Vector 2D)
          • To Double Linear Color (Vector)
          • To Double Vector (Vector)
          • To Double Vector 2D (Vector)
          • To Linear Color (Vector)
          • To Vector 2D (Vector)
        • Curve
          • Make Curve from Asset
          • Sample Curve
        • Color
          • Break Double Linear Color
          • Break Linear Color
          • Make Double Linear Color
          • Make Linear Color
        • Vector
          • Break Double Vector
          • Break Vector
          • Make Double Vector
          • Make Vector
        • Vector2D
          • Break Double Vector 2D
          • Break Vector 2D
          • Make Double Vector 2D
          • Make Vector 2D
        • Interval
          • Break Float Range
          • Break Integer Range
          • Make Float Range
          • Make Integer Range
        • Int Point
          • Break Int Point
          • Make Int Point
        • Int Vector
          • Break Int Vector
          • Make Int Vector
        • Int Vector 4
          • Break Int Vector 4
          • Make Int Vector 4
        • Transform
          • Break Transform
          • Inverse Transform Location
          • Make Transform
          • Transform Location
        • Distance
          • Smooth Max
          • Smooth Min
        • Box
          • Break Box
          • Extend Box
          • Make Box
          • Make Box from Radius
          • Make Infinite Box
          • Transform Box
      • Color
        • Distance to Color
      • Surface
        • Merge Surface
        • Get Merge Data
        • Get Surface Distance
        • Get Surface Material
        • Get Surface Attribute
        • Set Surface Material
        • Set Surface Attribute
        • Bind Attribute Detail Texture
        • Make Height Surface
        • Make Volumetric Surface
        • Make Sphere Surface
        • Make Box Surface
        • Invert Surface
        • Mask Surface
        • Inflate Surface
        • Displace Surface
        • Create Voxelized Mesh Surface
        • Blend Materials
        • Get Bounds Box
        • Get Surface Bounds
        • Make Bounds from Local Box
      • Channel Nodes
        • Query Channel
      • Noise
        • Advanced Noise 2D
        • Advanced Noise 3D
        • Perlin Noise 2D
        • Perlin Noise 3D
        • Cellular Noise 2D
        • Cellular Noise 3D
        • True Distance Cellular Noise 2D
      • Name
        • Append Names
      • Array
        • Length
        • Get
      • Gradient
        • Get Gradient
      • Chunk Spawner
        • Make Invoker Chunk Spawner
        • Make Screen Size Chunk Spawner
      • Random
        • Rand Float
        • Random Vector
        • Random Rotator
        • Random Select
        • Hash Position
        • Rand Unit Vector
        • Break Random Vector Settings
        • Make Random Vector Settings
      • Flow Control
        • Select
      • Actor
        • Get Transform
      • Network
        • Is Client
        • Is Dedicated Server
        • Is Listen Server
        • Is Server
        • Is Standalone
      • Heightmap
        • Get Heightmap Bounds
        • Make Cubemap Planet Surface
        • Sample Heightmap
      • Voxelized Mesh
        • Make Voxelized Mesh from Static Mesh
    • Glossary
    • Licensing
    • Release Notes
      • 2.0p-340 Release Notes
      • 2.0p-320 Release Notes
      • 2.0p-317 Release Notes
      • 2.0p-304 Release Notes
    • Roadmap
Powered by GitBook
On this page
  • 1. Straight-Forward Changes
  • 1.1 Supporting additional material properties
  • 1.2 Increase texture size on distant terrain
  • 2. Explanations for Complex Changes

Was this helpful?

  1. Knowledgebase
  2. Surfaces & Materials
  3. Material Definitions

Extending the Complex Material Sample

It can be difficult to work with the Complex Material sample, but it is designed to be used and customized as template.

PreviousCreating Materials from ScratchNextTechnical Details

Last updated 1 year ago

Was this helpful?

This article assumes moderate knowledge about Unreal Engine's material editor and . We also recommend exploring the BasicMaterial sample first.

Some changes - for example, adding support for another material property like roughness - are relatively straight-forward. Others, such as customizing triplanar projection blends, can get very complicated. As such, this article is split into the following two sections:

  • 1.) Step-by-step guides on some straight-forward extensions to the material, i.e. adding support for additional texture channels (roughness, AO, etc.)

  • 2.) Deep explanation of the material design, providing the perspective needed to make more complex changes.

The Complex Material sample does not currently fully support planetary rendering, as the top and sides textures will behave as if the world is flat.

1. Straight-Forward Changes

1.1 Supporting additional material properties

For the purposes of this guide, support for roughness textures will be added to the material. To get started, open VMD_ComplexMaterial, MF_CompleteLayer and MF_FinalOutput.

First off, within the VMD_ComplexMaterial asset, duplicate the Diffuse - Top and Diffuse - Sides parameters by pressing Ctrl-D. Rename the two to Roughness, and change their default textures as needed. Save the VMD asset.

These are the only changes necessary on this side, so the VMD asset can now be closed.

From here, move to MF_CompleteLayer. This function contains a handful of different comment blocks. Zoom in on, and then copy the Color comment block on the left-hand side. Paste it in the empty space to the side.

Select the Voxel Parameter nodes, and in the details panel, select the top and side Roughness texture parameters from the VMD. Delete the Static Bool plugged into the UseModifier pin. Drag out from the Result pin and create a local variable declaration called RoughnessOut.

Lastly, for the sake of organization, rename the comment block to Roughness.

While the core logic is now in place, the data from it still needs to actually be fed into the Material Function's output.

To do this, shift the view to the Output Result node on the right-hand side, and select the SetMaterialAttributes node. Click the plus in the details panel, and change the last entry in the list to Roughness using the selector. Drag out from the newly created pin, and connect a Get RoughnessOut (our previously created named reroute) to it. Click the Apply and Save buttons to make sure the changes are applied.

The roughness information will now be fed through the entire material, and be blended per layer. All that is left is to make sure it's properly assigned before the final output. Close MF_CompleteLayer, and move to MF_FinalOutput instead.

Within MF_FinalOutput, add a roughness pin to the GetMaterialAttributes node, and connect it to the existing roughness pin on the SetMaterialAttributes node. The nodes that are now disconnected can be deleted. Once again, click the Apply and Save buttons to make sure the changes to this function are applied.

With these steps completed, the terrain should now be using the default roughness textures. Textures can be selected per-layer inside the .

1.1.1 Supporting channel-packed textures

In the case of channel-packing, the entire workflow is largely identical, except that the MF_CombinedProjection output should be split into its respective channels.

There is one exception to this when trying to channel-pack additional texture into the Height texture. In this case, the Result pin will only output the height channel (selected through the parameters list).

Instead, use to access the channel-packed result.

Do make sure to connect the individual texture channels to appropriate material properties, both at the output node in MF_CompleteLayer, as well as in the MF_FinalOutput configuration.

1.2 Increase texture size on distant terrain

This section is still to be written.

2. Explanations for Complex Changes

The Complex Material sample is built out of a handful of separate Material Functions.

  • Three MF_CompleteLayer functions, each of which contains the logic for one the three layers processed per-pixel.

  • An MF_ThreeLayerBlend function, which run a height-blend between the three layers.

  • An MF_FinalOutput function, which takes the MaterialAttributes from the blended layers and routes them into a second, cleanly configured, MaterialAttributes pin. This is to avoid unnecessary values being computed.

This section is still to be finished.

Material Definitions