This tutorial will teach how to use the new Material customization methods included in 0.54.0 update.
In Unreal Engine, a Material is an asset that can be applied to a mesh to control the visual look of the scene. At a high level, it is probably easiest to think of a Material as the “paint” that is applied to an object. You can define its color, how shiny it is, whether you can see through the object, and much more.
In Unreal Engine, when you create a Material, you can define custom Parameters for it. So if you defined some parameters for a Material in a mesh, you can tweak it with simple comands in nanos world!
nanos world provides a bunch of methods to allow you to interact with the parameters you created for your materials using our scripting:
We provide a blank material with basic parameters already defined for you to customize it in a very basic way. To use that, call
SetDefaultMaterial() in the entity!
To illustrate, let’s spawn a Cube and change it’s Material using Lua:
Now let’s set it’s material to red! To be able to do that, we must set the Color parameter named Tint as we’ve seen above is the name of parameters which is connected to Base Color of the Material.
Now let’s give it a metallic style! You can learn more about Physically Based Materials to know about how each input affects the final representation of a surface!
A fun thing to do is to make a material fully reflective, like a mirror:
It is even possible to load images (.jpg, .png, etc) from disk and apply to the mesh! For that you will need to create an Asset Pack (Assets Quick Start) and place your images inside of it.
Let use this (imgur) image! Download it and place in a folder called
MyAwesomePhotos/ in your server/Assets folder.
Now make sure you require your new Asset Pack in your Package.toml to grant those files will be downloaded when you join the server:
And now you can set it like that:
And voila! Easy Peasy! Feel free to create your own materials and textures and tweak them in-game!