LogoLogo
Reality 4.27
Reality 4.27
  • Reality 4.27
    • What's New
    • Introduction to Reality
    • Reality Walkthrough
      • Reality Examples Project
      • Tracking Calibration and Fine Tuning
      • Real-Time Ray Tracing
      • Raw Input
      • Augmented Reality Virtual Studio
      • Green Screen Virtual Studio
      • Setting up Realtime Video I/O
      • Projection Cube
      • Cyclorama Setup
      • Reality Keyer and Fine Tuning
        • Keyer FOV Softness
    • Reality Editor Guide
      • How Reality Editor Works?
      • Exporting UE4 Actors to RealityHub API
        • ZDActor Component
        • Exporting Blueprint Functions
        • Texture Pins on ZDActors
        • Exporting Properties
          • Directly Readable Variable Types
          • Property Update Callbacks
            • OnChanged_Event Callback
            • OnLengthChanged_Event Callback
            • OnChanged_ Function Callback
            • OnLengthChanged_ Function Callback
      • Exporting Assets to Reality API
        • Exporting Actors
        • Exporting Custom Blueprint Node
        • Exporting Custom Material Node
        • Exporting Lens Calibration
        • Exporting Post Process Material
        • Exporting Projection Material
        • Exporting Static Mesh
        • Exporting Unreal Motion Graphics
        • Exporting Unreal Texture Assets
      • Reality Custom Material Nodes
        • Defining the Variables in Material Definition
        • Custom Material Node
      • Using UMG in Reality
        • How to Use UMG with Reality
        • UMG Animations
        • Texture Brush
        • Asset Brush
        • Exporting Custom Events in UMG to Reality API
      • Additional ZD Components
        • ZDPieChart
        • ZDText
      • Helpful Links
      • Reality Editor Settings
        • Enabling DX12 and Ray Tracing
        • Hardware Accelerated Video Decoding
        • Enabling HAP Codec
    • Reality Setup Application
      • Audio
        • Audio Delay Node
        • Virtual Set Audio
        • Audio Mixer
      • Bypass Post Process
      • Fill and Key
        • Fill and Key using Dual-link
        • Fill and Key using Quad-link
      • Crop Function
      • Level Sequencer
      • Color Matrix Node
      • Media Playback
      • Preset for H.264 in Adobe Media Encoder
      • HAP Video Codec
      • Flow Control
      • GPUDirect Technology
    • Installation and Configuration Guide
      • Hardware Platforms
        • Legacy HP Z4G4 Configuration
          • Fan and Front Card Kit
          • Certified Power Supply
          • Video I/O Card Installation
            • Mellanox ConnectX®-5 Card Installation
            • AJA Video I/O Card Installation
          • GPU installation
            • Certified GPUs
            • Connecting GPU to 1000 watts power supply
              • GPU RTX 6000 installation (8+6 pin)
            • Connecting GPU to 750 watts power supply
              • GPU RTX 6000 installation (8+6 pin) Needs 6 to 8 Pin Adapter
          • Installing RAM
          • HP Performance Advisor
      • Adding Reality User to Windows
      • Downloading Distributions
      • Installing Steps
        • Upgrading
        • Installation
      • Configuration Steps
        • NVIDIA Configuration
        • AJA Video Card Configuration
        • R Drive Mapping
        • Internet Options
      • Updating RealityEngine AMPERE
    • Licensing Guide
      • Hardware Licensing
    • Reality Tutorials and Examples
      • Reality Editor Tutorials
        • Open/Close Door
        • Exporting UE Actor to ZD API (a.k.a ZDActor)
        • Custom Blueprint Node Tutorials
          • Using Event Tick Functions and Properties
          • Adding Custom Blueprint Nodes
        • Redirection of the Reality Engine Content
        • Creating Dynamic Materials
        • Changing ZDText with Dynamic String
        • Activating Destructible Mesh
        • Reality Texture Input
        • Activating Fire During Runtime
        • Asset Migration to Another Project
        • Rotating Door by Using Function Parameters
        • Creating Custom Cyclorama
      • Nodegraph Tutorials
        • Portal Window Setup
          • Adding Clipping Plane
          • How to Position Videowall
          • Setting Portal Window and Calibration
          • Creating the Augmented Part
    • Appendices
      • A - Camera Tracking and Lens Calibration
        • Camera Tracking Information
        • Tracking Device, Physical Connections
        • Lens Calibration
      • B - Standard Unreal Engine Post Processing Pipeline
      • C - Reality Keyer
        • What is Image Based Keying?
        • Reality Keyer Pipeline
        • Physical Factors Affecting the Key
      • D - Viewing Videomask
      • E - CLASS setting for Broadcast Cameras
      • F - ZD Blueprint Node Pin Reference
      • G - Utilizing TRAXIS talentS FreeD Data
    • Knowledge Base
    • Known Issues and Limitations
Powered by GitBook
On this page
  1. Reality 4.27
  2. Reality Tutorials and Examples
  3. Reality Editor Tutorials

Creating Dynamic Materials

PreviousRedirection of the Reality Engine ContentNextChanging ZDText with Dynamic String

Last updated 2 years ago

In this tutorial, we will be creating a Dynamic Material Instance on blueprints to change a texture dynamically. We will be utilizing a ZD Actor component and expose it to the RealityHub as a node.

Steps

  • Go to the Content Browser tab, click on the ADD/IMPORT button and select the Blueprint Class.

  • Select the Actor from the Pick Parent Class popup menu.

  • Rename your Actor as DynamicMaterialActor, and double click on it. This action leads you to the Blueprint UI.

  • Go to the Components tab, click on the + ADD COMPONENT button.

  • In the Search Component bar, type ZD Actor and click on it.

  • Click on the + ADD COMPONENT button again, find and add the Static Mesh component

  • Go to the Details tab, change the Static Mesh property from None to Cube

  • Go to the My Blueprint tab, click on the + ADD NEW button, and select the Variable. This action adds a Boolean type variable by default

  • Select the new variable you added and change its Variable Name to MyTexture

  • Click on the Variable Type property

  • Find and select the Texture Render Target 2D

  • Click on the Instance Editable checkbox in the Details Tab

  • Click on the COMPILE and then the SAVE button

  • Switch to the main Editor interface

  • Go to the Content Browser tab, click on the ADD/IMPORT button and select the Material

  • Rename the material you added as MyMaterial and double-click on it. This action opens the Material Editor UI.

  • Right-click on the Material Editor Canvas, type TextureSampleParameter2D in the search bar

  • Select the TextureSampleParameter2D from Parameters group

  • Change the name of TextureSampleParameter2D to MyTextureParameter

  • Connect the RGB output pin MyTextureParameter to the Base Color input pin of the MyMaterial

  • Click on the APPLY and then the SAVE button

  • Switch to the main Editor UI

  • Find the MyMaterial inside the Content Browser

  • Right-click on the MyMaterial and choose the Create Material Instance option

  • Double click on the DynamicMaterialActor and switch to the Construct Script tab inside the Blueprint UI

  • Right-click on the Blueprint Canvas

  • Find and add the Create Dynamic Material Instance (Static Mesh)

  • Select the Create Dynamic Material Instance (Static Mesh) function

  • Connect the event output pin of the Construction Script into Create Dynamic Material Instance’s event input pin

  • Go to Source Material > Select Asset and choose MyMaterial_Inst from the search bar

  • Right-click on the Return Value output pin of the Create Dynamic Material Instance and select the Prompt to Variable.

  • Your last action creates a new variable called NewVar_0. Change the variable name to MaterialInstance

  • Go to the My Blueprint tab, click on the + ADD NEW button

  • Select the Function, rename it as OnChanged_MyTexture, and declare it as a Public

  • Right-click on the canvas, find and add the Set Texture Parameter Value from the search menu under Rendering > Material

  • Connect the event output pin of the On Changed My Texture into Set Texture Parameter Value’s event input pin

  • Drag and drop the MyTexture variable to the canvas and select Get MyTexture in the popup menu

  • Connect the MyTexture’s output pin to the Value input of the Set Texture Parameter Value

  • Drag and drop the MaterialInstance variable inside the canvas and select Get MaterialInstance in the popup menu

  • Connect the Material Instance’s output pin to Target input of Set Texture Parameter Value

  • Change the Parameter Name of the Set Texture Parameter Value to MyTextureParameter

  • Click on the COMPILE and then the SAVE buttons

  • Switch to the main Editor UI

  • Drag the drop DynamicMaterialActor into your scene

  • Click on the PLAY button

  • Switch to the RealityHub and activate the Nodegraph/Actions module

As soon as you click the PLAY button on the Reality Editor interface, your Dynamic Material Actor get exposed to the RealityHub, as shown in the image above

  • Create the following node tree inside the RealityHub Nodegraph

As the picture above shows, as soon as you connect the OUTPUT pin of the CHECKERBOARD node to the MY TEXTURE input pin of the DYNAMIC MATERIAL ACTOR node, the texture gets changed on the fly.