Custom Spices: Difference between revisions

From HoF2 Community Modding Wiki
Jump to navigation Jump to search
(Initial commit of spice tutorial)
(No difference)

Revision as of 00:05, 11 February 2019

This tutorial covers how to add your own custom Spices to Hand of Fate 2.

Note: This is a work-in-progress tutorial. At the time of writing, the HoF2/Character/Meeple shader is not available in the editor.

The steps below assume that you are comfortable using the Unity editor and already have an existing (3D model) and appropriate textures/maps generated for/from it. Examples in the form of a Briarfolk spice can be found **here**.

Step 1: Add files to your project

Hand of Fate 2 spices require at least five source files, a mesh and four texture maps tailored to that mesh.

3D mesh
The geometry of your spice in a format that Unity can handle, such as a .fbx file, with appropriate UV mapping for the texture maps below.
Albedo texture map
A texture that affects the colour and intensity of light reflected off the spice model.
Metallic texture map
A texture that defines how "metallic" the spice model is.
Normal texture map
A texture that adds extra detail to the spice model.
Occlusion texture map
A texture that affects the indirect lighting that the spice model receives.


Create or locate these files and add them to your project.

  1. The files must be placed somewhere under the Assets folder in your extracted HoF2 SDK folder, but how you choose to organise them is up to you.


Step 2: Add a material

Due to the way that texture maps are applied, each spice uses its own material, which can be created and assigned via the following steps.

  1. Start by creating a new material in the Unity Project Browser (right click, Create->Material).
  2. With the new material selected, select HoF/Character/Meeple from the Shader dropdown in the Inspector panel.
  3. For the Albedo, Metallic, Normal Map, and Occlusion texture fields, select the corresponding texture maps.
  4. Set Xaris Fade to 0.132 and Rim power to 6.4. The Inner Colour field can be set to 2D2A2AFF (dark red-grey), and the Outer Colour field FF0000FF (red).
  5. Select the 3D mesh in the Unity Project Browser and tick the Import Materials checkbox. Under Remapped Materials, select the new material you have created, and then click the Apply button.


Step 3: Create the spice model prefab

Next, a prefab that the game can identify as a spice model needs to be created.

  1. Create a new empty prefab in the Unity Project Browser (right click, Create->Prefab).
  2. Drag and drop the 3D mesh onto the newly created prefab (the icon for the prefab should change to a preview of the model)
  3. Using the Add Component button, add the Model, Model Collision, and Spice Model scripts to the prefab


Step 4: Create the spice

Finally, we have what we need in order to create the spice itself.

  1. Open up the HoF2 editor tools from the Start Window and select the Spices Tab.
  2. Create a new spice by typing its name in the top left text field and clicking the New button.
  3. Select the newly created spice in the editor tools, then drag and drop the spice model prefab from step 3 into the Model field.


Step 5: Other bits and pieces

  • You may need to add AssetBundle Labels to your material, mesh, and textures. The spice model prefab should have automatically had one assigned.