Home Artists Posts Import Register
Join the new SimpleX Chat Group!

Content

Hey guys! I would apologize for the clickbait title, but since I preemptively mentioned it, that absolves me of any fault :D

So, I wanted to talk a little about Mai’s ‘hidden’ ‘feature.’

Is not really a feature because it’s nothing new that improves the performance of the model and is not really hidden if you check the files.

I wanted to talk about this right after I released Mai, but I honestly forgot about writing it until today, so, let’s talk about it!

File Structure.

In regular circumstances, you will find two types of files in the Materials folder that work with each other:

  • VTF, which is Valve Texture format for the models.
     
  • VMT, which is the Valve Materias that tells Source Engine how to render a model.

Models use a shader called VertexLitGeneric, which is defined in the VMT material. However, if you look at Mai’s Materials folder, you will find three types of files that work with each other:

  • VTF.
     
  • VMT.
     
  • MAT.

What the hell is MAT? Well, that’s why I’m here to talk about it!

Backstory.

Some time ago, I asked LordAardvark if there was a way to include parameters in one material from other materials in order to save time in writing VMTs. He then pointed me towards a Shader and proceeds to confirm me that yes it is possible as he uses that for DOAF. Now, I’m going to tell you the truth in the same way I did to him: All I wanted was trying to chat for a bit. I didn’t expect this to be possible because I thought there wasn’t such a parameter like “$include”.  

Introducing: ‘Patch’ Shader and Material Files.

Out of the wiki: Patch is a special shader that allows materials to inherit from each other.  

It looks like this:

Patch

{

include “material_path.format”

insert

{

$parameter “Value”

}

}

The parameters inside the Insert keys are the ones we want to add to our VMT. If the parameter already exists, then it is overridden with the parameter of our VMT. This is so we can be sure we are using the same material parameter values across different materials. Thanks to this, we can now use the following setup:

  • Create a general Material file that will have our setup values.
     
  • Create a VMT file that will inherit the Material values and will also include material specific parameters: the textures.

The only limitation I seem to find, is with hair textures. I don’t know why, but I was unable to inherit the values from a double mesh hair from a specific Material.

This is how a setup looks like: on the left side, you will see how a VMT looks like, and on the right side, you will see how a MAT file looks like.

I wanted to give it the MAT name for two reasons:

  • To make it clear it’s a unique file that needs to be preserved.
     
  • The wiki said Patch needed the extension of the material for it to work. I tried a custom extension, like MAT, and since it worked, I left it for fucking pretentiousness.

How the hell does this benefit me?

You may ask that. Well, it depends really, but there’s one huge reason why this can be beneficial not for me, but for content creators:

  • If you wanted to make an element less shinny, like the face, you would have to edit the character’s VMT material, however, if you messed with values, like Color or Phong, that would make the lighting of the character’s less coherent with the lighting of the body, so you would have to change those values of the neck, torso, arms and legs materials as well.
     
  • Thanks to this setup, instead of editing 5 different VMTs, all you need to do is edit the MAT file and that will make the changes across all the materials that use that MAT file.
     

This may be or may be not useful for all content creators, but I’m pretty sure people messes with the phong values from time to time, so now they can have an easier time messing with them.

I hope you guys find this ‘feature’ useful! Remember to wash your hands!

Comments

No comments found for this post.