Untextured materials with custom lighting

I finally take the time to explain the new C1 (and maybe C2) material type. Based on SimpMats, with custom lighting, custom shading and custom colors.

Click on Continue reading... to continue the reading!

Let's try to understand how these work and how to use them!

First, let me explain why these are useful. In C1, you can't use textureless materials with diffuse colors as we can do in C2, C1 cannot read that 16bit color value. These C2 materials are created by PT2, so we gotta find a way to have a similar material in the C1 format or something.
For C2 (not tested yet, soon), the textureless materials indeed do show the diffuse color ingame, but the lighting is static I think. Because of that we rather have to rely on textures envmap materials. If this C1 material can work for C2 too, the custom lighting settings will be loaded as well.

So in both C1 and C2, there are SimpMats. These SimpMats are predefined colored textureless materials. They aren't much used in C2 (can be used for shrapnel colors though), but are in C1 (for simple models). The idea is to take a textureless material generated by PT2 and convert it into the SimpMat format, so that it will be loaded as a SimpMat but will be customized.
Here's our PT2-generated textureless material slot:

3C00 0000 50FF 8000 FF3F 8000 003F 0000 0000 0000 0042 C600 0000 0000 253F 8000 0000 0000 0000 0000 003F 8000 0000 0000 0000 0000 00XX ZZ00 0000 0000 0000 0000 0000 0000 0000 5242 525F 5749 4E44 2E4D 4154

The first 3C must be changed in 04, there are 0000 before 253F that must be removed and all the 0 between XXZZ and the material name hex string as well.
In this example, after the first 3C, there is FF8000. These three bytes define the color in PT2 and C2. But C1 actually uses 2 bytes elsewhere: XXZZ at the end! (BTW, note that XXZZ doesn't appear like that in the document, I just substitued the value of these 2 bytes to see them easily)

The XX value is the ID of the chosen color in the C1 ingame palette, in hexadecimal. The ZZ value defines the number of following colors defining the gradient.
Here, I want to create a simple gradient from dark desatured green to a bright enough color. I therefor choose that color in the white square, its ID is 104, so the XX hex value for 104 is 68 (!! the hex value is just the ID converted to hex, not the hex reference of the color!), and as I want the gradient to be smooth enough and have brighter tones, I decided to let it go through the other 7 colors next to him (the colors in the orange box there), so the ZZ value here will just be 07, if you enter 00, the color will just be plain and there will be no gradient. If I wanted to let the gradient go through 28 colors or such, the ZZ value would be 1C, as actually that ZZ value is hexadecimal too ofcourse~

The way the gradient is calculated ingame is directly dependant of the lighting settings set in PT2! You'll have to test etc!
So here is the C1 mat slot:

0400 0000 50FF 8000 FF3F 8000 003F 0000 0000 0000 0042 C600 0000 253F 8000 0000 0000 0000 0000 003F 8000 0000 0000 0000 0000 0068 0752 4252 5F57 494E 442E 4D41 54

Easy no? Once you're done with the editing of your mat file, don't let PT2 load it again or it will turn the C1 materials back in the C2 format. Just make a backup of the C1-ready .mat, this way if you want to change the lighting settings afterward you can directly copy paste from the C2 format mat into the C1 one.
I'll have to test in C2, it could help to make wonders!

Page top