Skip to end of metadata
Go to start of metadata


Continuing on from Part 4 of this tutorial, this article will guide you through Material creation and setup in Sandbox!

Material Creation

So far we've created our material setup solely inside the Max scene. For use in-engine, we need to create an external material (.mtl) file for CRYENGINE to use.

Sandbox will inform you that it cannot find the material via a console warning:

<15:01:11>   0) [ 1]    [System]    XML reader: Can't open file (objects/weapons/newgun/newgun.mtl)          Object="newgun1"

The 3ds Max exporter has functionality to sync materials to and from Sandbox.

Let's start by opening up the CRYENGINE Sandbox Editor and opening a level that we can test the weapon in.

With both the Max scene open and the Sandbox Editor open, click on the Create Material button as pictured above.

This will open the Sandbox Material Editor and a new file dialog will appear. Navigate to where your weapon is saved: Objects\weapons\newgun\

Enter in the name of the material which has to match the name you gave it in 3ds Max, in this case, newgun.mtl:

You can't see the Max/CGF files because it's filtered to only show "Material Files"

If you receive a warning message saying that the Material is already created, delete the weapon from the level so that it doesn't try to load it, save and reload the level.

Once created, the new file will be created and the Sandbox Material Editor will sync all of the available information from the 3ds Max Material Editor and fill out information automatically:

If the material doesn't match what you've got in Max, you probably haven't re-exported the model as mentioned at the end of the previous article.

Material Setup

Render Mesh Material

Add the weapon into the level by going to the RollupBar and clicking on the first Objects tab then going to Entity -> Items -> newgun

You can drag it from the list into the world or double-click on it and then move the mouse into the world.

First thing you'll notice is the blue-ish "Replace Me" texture. This and a few other things we can setup:

  1. Set the Surface Type to Metal (the most appropriate choice for this weapon. If you set this to "Flesh" then shoot the weapon with another weapon, blood will spurt out of it).
  2. Give it some Specular color just so it doesn't look completely wrong.
  3. Assign a Diffuse texture. For now we can use the textures/defaults/ texture just to get rid of the default Replace Me one.

Proxy Material

The Proxy sub-material visual settings don't really matter as it's not rendered by default anyway.

What is the important though is the Surface Type as the Surface Type of the Proxy material defines how it reacts when colliding with objects, such as the ground or players. As before, set this to Metal.

You can also visualize the Proxy inside the Editor by clicking on the Render (4th) tab in the RollupBar and enabling Show Proxy.