Game components: materials - how they work and what they are
Loading...
Loading...
Loading...
What's a hair profile, and how do I use it?
Published: ??? by Last documented update: May 13 2024 by
This page collects basic information about hair profiles.
Check WKit Blender Plugin: Import/Export -> #hair-profiles-.hp for a guide on importing/exporting
Learn more about Hair and skin material properties -> #hair-material
Via hair profiles, it's possible to quickly and easily create a large variety of hair colour variations without the need of having colour textures. That happens via two arrays:
Determines the strand to strand colour by using the Strand_Gradient
texture. The gradient serves to empathize/de-empathize contrast among the black/white scale.
Together with the gradientMap
, this is used to generate varieties of unique hair materials.
Is applied to the Strand_Gradient
texture to determine the hair colour from start to top. Via gradientStops, the colour positions from root to tip of the strands are determined.
Details about in-game textures
Last documented update: Apr 06 2024 by manavortex
This wiki page contains documentation about xbm files and their properties.
Would you rather…
Edit, import, or export textures?
Learn about textured materials?
Use a textured material on your mesh?
As of 2024, the toolchain assumes.png
as your default format. You can
.xbm
files are simply CR2W (REDengine) representations of .dds
files. Regardless, you still need to .
This means that all features of the DDS format are included, and they are nearly completely compatible out-of-the-box.
Any CR2W file includes a section telling the engine how to read it, the header. Most of the file encodes texture data, but the header for textures includes:
size
mipmapping (lower-resolution versions of the same texture for LOD and streaming)
texture format
dimensions (e.g. if your texture data is 1024x1024, but the header says it's 512x512, then the engine will resize it)
The setup section of the XBM file is in essence an extension of the header.
It contains settings that, more than just describing basic information about the texture, such as:
bit depth
texture type
format
gamma correction
streamability
mip chains
Material Instances and external materials
Published: ??? by manavortex Last documented update: May 01 2024 by manavortex
This guide will teach you how .mi files work
As of May 2024, you can also use ArchiveXL: dynamic materials, which is a more flexible implementation of the same basegame mechanic. However, you may want to understand this, because CDPR are using it a lot.
A .mi file encapsulates a material in a reusable template file, which you can use a .mi file as base material
in a material definition.
It is possible to use multiple .mi files in a row. For an example of this, check the player's skin materials.
For more information of this, you can look at Shaders -> #the-daisy-chain
Put yourself in the shoes of a hypothetical modder.
You are creating a mod that offers multiple versions of the same item (e.g. toy props or hair)
You have created a base material
You duplicate and re-duplicate the material for each of your variants, changing the properties that defines the colour
You wish that there was less copy-pasting involved
Take any of them from the game, move them to your custom directory, and group all the properties that you keep copy-pasting into the .mi.
Then, in your material, you can now use your .mi file as baseMaterial
, and only change the properties that are actually different!
For a collection of example .mi files, check manavortex's MEGA.
Instead of copy-pasting six properties, you now copy-paste only two.
Let's take it another step further – we can make a bunch of different colours to re-use across your files. An example for this are hair files, or the plastic materials I've used in my toy prop pack.
For this, I first created a plastic_base.mi
with all the common properties, and then created one additional .mi file for each shade of plastic, setting plastic_base.mi as baseMaterial, leaving me with the following folder structure:
If I decide that my plastic is too shiny, I can edit _plastic_base.mi
instead of touching every template individually. Pretty neat, isn't it?
And if one of my items happens to have a custom normal map and/or texture, then I just add them in the values
array of my material and call it a day.
But we can take this approach even further! If you don't have any properties, your mesh doesn't even need materials! You can simply use the externalMaterials
list instead. You do this by unticking the isLocal property in the materialEntries definition:
You can of course mix and match local and external materials! Just make sure that the materialEntries indices are pointing at the correct material.
However:
If you are using preloadLocalMaterials
, you need to use preloadExternalMaterials
instead of externalMaterials.