top of page

Interactive Dynamic Materials

  • Rhys Sellars
  • Aug 11, 2016
  • 2 min read

This week expanded further on the concept of Materials in Unreal Engine, and in specific, creating materials that can change dynamically during game play. An example of dynamic materials could include interactive key presses, trigger boxes and event triggers. Unlike previous weeks, we received no direct teaching on how to solve this issue and had to rely solely on online Documentation from the Unreal Engine website as well as Source Tree, which is a website dedicated to programmers and various solutions and questions about a multitude of programs. This is a fantastic resource to look through, even as a starting point.

In my experiment of trying to create dynamic materials, I created a cube that would be able to change between two colours. The way this worked was by creating a custom material, similar to last week, however instead of using Vector3 to handle colours, this week it was a Vector Parameter. This handles colours in a similar fashion, however allows the colour's parameters to be easily changed. The way the colour change is handled is by using a Linear Interpolation, or LERP, which basically allows a transition between the two colours. In order for this to work, and parameter slider node is created which is given a value, in this case 100, and then plugged in to a division node, also set to divide by 100 for a smooth transition between the colours.

From here, we make a Material Instance from the material we just created, which effectively acts as a reference point to allow the material to be altered within blueprints. I made a basic cube actor blueprint, and applied a collision box to it. When the player enters the box, the colour would change, and when they leave the colour would return. However, I wanted a smoother transition between the colours. In order to do this, a bool was created named 'InBox' which would be triggered true/false when the player enters the collision box. Every Event Tick or frame, the box is checking the parameter value of it's material instance. If the player is within the collision box, the scaler value for the second colour will increase once per frame, and when they leave, would decrease once per frame.

This was created through experimentation and collaboration with other students. It was one of the situations where the documentation that was available did not truly explain in a simple way on ideas on how to do this. This solution varied to our lecturer's, whom had key press changes, however we still had a funtioning material change.

For my Survival game, I am considering adding something like a river, and when the player's Insanity meter is high, changing the water to a blood red colour, to further demonstrate the character's insanity. An alternative is also interaction with an item and it's colour changing upon interaction.

All images supplied by the user.

Comentarios


 THE BIT BLOCK: 

 

Welcome all to The BIT!

Together we will walk down the uncertain path of being a Game Developer, and the journey of attaining the knowledge to succeed.

 RECENT POSTS: 
 SEARCH BY TAGS: 

© 2016 - 2017  by Rhys Sellars. Proudly created with Wix.com

  • LinkedIn Social Icon
  • Twitter B&W
  • YouTube Social  Icon
bottom of page