Skip to content

Materials

Sebioff edited this page Apr 23, 2024 · 17 revisions

We've shipped some materials with the asset editor that you should use for your custom objects. These materials are special treated by the game. The materials are:

  • Diffuse
  • Specular
  • CustomColorsDiffuse
  • CustomColorsGlossy
  • CustomColorsSpecular
  • CustomColorsDiffuseTransparent
  • CustomColorsSpecularTransparent
  • CustomColorsDiffuseIllum
  • CustomColorsSpecularIllum

As the name gives away there are three base materials: the Specular materials are used for metallic looking materials; Glossy is for plastic-looking materials; and the Diffuse ones for anything else. Then there are custom color variants that support having player-defined colors and the additional variants of those that support transparency and illuminated ones that glow at night.

Diffuse vs Specular

These materials all have the same texture, the 256 palette, and are used by most objects in Parkitect. Because of that the GPU can use one texture for almost all objects. We also can guarantee that if you use these materials your assets will keep rendering properly in future game updates. If you roll your own materials they may (and probably will) stop working in the future and you have to update your asset pack. That's why we strongly encourage you to use our materials.

Using the materials

As you can see the 256 palette is a very simple texture with 256 colors and the largest part of Parkitect is build on these colors. To use them on your models you need to import the 256 palette texture in your 3d modeling program. The texture is shipped with the asset editor and is located at Assets/Resources/Textures/256palette.tga. The next step is to map the texture on your model, also called UV mapping.

Tutorials on how to map uv's with your favorite 3d program can be easily found on the internet.

Next, map every face of the model to a color on the texture. The outlines of the face don't have to follow the outlines of a color. As long as every vertex is inside the square it will work correctly.

Make sure the material name of your model matches with one of our models. Otherwise it will not be replaced properly in-game, leading to broken models in the future. Use Diffuse or Specular for non recolorable objects and CustomColorsDiffuse or CustomColorsSpecular for recolorable objects.

Export the model as fbx, obj or another format that Unity can read and copy it to Assets/Resources in your asset project. Select the model and make sure the that "Material naming" has the value of "From model's material" in the inspector.

material naming

For some model formats you need to check the scale factor of the model in the inspector. For example, fbx needs a factor of 100 to match 1 unit with 1 tile in Parkitect.

Custom coloring

In the bottom right of the 256 palette you see 4 special colors. Those are the colors that can be recolored in-game. The pixels are in the following order:

Indigo, Blue,
Green, Red

Color 4 Color 3
Color 2 Color 1

256palette

Your object can support a maximum of 4 custom colors. Map the faces of the objects that needs to be recolored to these 4 special colors. Don't skip a color with mapping. For example never use color 1, 3 and 4 but instead use color 1, 2 and 3.

When you've mapped the colors you also need to enable recoloring on your object and set some default colors.

Textured custom coloring

If you want to have textured objects with custom colors you'll need a base texture and a mask texture.
The base texture is pretty much a normal texture, but you probably want to keep the parts that are supposed to receive custom colors white or grayscale.

basetexture

The mask texture is used to define which parts of the base texture receive which custom color. Just like with other custom colored objects, your object can use up to 4 different custom colors, which each color channel of the mask texture defining which custom color slot is being used (so red = custom color 1, green = custom color 2, blue = custom color 3 and alpha = custom color 4. Note that this means that you if you don't want to use color slot 4 the alpha channel should be black - most image editing tools set it to white by default and you'll have to clear it).

masktexture

After importing the mask texture into Unity, make sure that the "sRGB" checkbox is off in the texture import settings. masktexture_settings

To use the textures on an object you'll have to create a new Material in Unity (for example, right-click somewhere in the Project tab and select Create -> Material). You'll have to use one of the following shaders on this material:

  • Parkitect/CustomColorsMaskedDiffuse
  • Parkitect/CustomColorsMaskedDiffuseCutout (for objects that need "transparency", especially useful for plants or decals)
  • Parkitect/CustomColorsMaskedSpecular

maskmaterial

Finally, simply use the material you created on your object.

Clone this wiki locally