Shader Patch v1_4_Materials_Update - PrismaticFlower/shaderpatch GitHub Wiki
The v1.4 update to Shader Patch now includes changes to material config files. Specifically that the RenderType
field has been replaced with a Type
field. This is not a simple rename however as the accepted values of the Type
field isn't the same as what RenderType
accepted.
Before going any further it is important to note that old .mtrl
files will continue to be accepted by material_munge
and there is no need to update to the new format if you do not want to. However a tool for doing so automatically is provided material_updater.
In previous versions the RenderType
field controlled exactly what shaders were selected for a material. Due to changes with how materials are handled in Shader Patch itself this became inconvenient from a technical perspective. Instead the concept of Material Type's was introduced and behaviour previously controlled by the rendertype was shifted instead to the material properties.
All Material Type names are simply their old rendertype names minus any .NAME
section. So the rendertype normal_ext.specular.dynamic
becomes the material type normal_ext
with the properties UseSpecularLighting: yes
and IsDynamic: yes
.
New Properties
Below is a complete listing (minus terrain material stuff, which are internal to SP anyway) of the new material properties added to replace the old rendertypes.
normal_ext changes
- Added
UseSpecularLighting
property. - Added
IsDynamic
property.
pbr changes
- Added
NoMetallicRoughnessMap
property. - Added
UseEmissiveMap
property.
skybox changes
- Added
UseEmissiveMap
property.
static_water changes
- Added
UseSpecularLighting
property.
material_updater
Note that the text formatting of material files ran through this tool will not be preserved and any comments inside the files will be lost!
If you'd like to completely update your project to using Material Types there is a new tool included to automate this, named material_updater
. It uses the same logic that material_munge
and Shader Patch use to read old materials and after applying the fixes it (unlike them) can save the materials back out.
Although I have tested the tool and it appears to work completely I advise you backup your .mtrl
files for your project before proceeding. Just so that if something does break you have files you can restore to get stuff working again. If you do encounter issues with the tool feel free to open an issue about it.
After having backuped your material files you simply have to run the tool. It'll open up a folder picker for you, simply point it towards the folder where you keep your material files and it'll get to work. The folder you select will be searched for .mtrl
files recursively (so it's folders will be searched and their folders, etc).
Once the tool closes all the material files in the selected folder should be updated. At this point you should be able to munge your project and test ingame that everything is still working as expected.
Legacy Rendertypes Table
Rendertype | Description | Replacement Properties |
---|---|---|
basic_unlit |
Simple unlit rendertype. | |
normal_ext |
Normal mapped diffuse lighting. | |
normal_ext.specular |
Normal mapped diffuse and specular lighting. | UseSpecularLighting: yes |
normal_ext.dynamic |
Same as normal_ext but for Dynamic Geoemtry. |
IsDynamic: yes |
normal_ext.specular.dynamic |
Same as normal_ext.specular but for Dynamic Geoemtry . |
UseSpecularLighting: yes and IsDynamic: yes |
particle_ext |
Particles | |
pbr |
Fairly typical PBR shader, takes AlbedoMap , NormalMap , MetallicRoughnessMap and AOMap as input. |
|
pbr.basic |
Same as above only skipping the MetallicRoughnessMap . |
NoMetallicRoughnessMap: yes |
pbr.emissive |
Same as pbr only also using and taking an EmissiveMap . |
UseEmissiveMap: yes |
skybox |
Simple skybox. | |
skybox.emissive |
Skybox with an emissive skybox overlaid on top. See EmissivePower and SkyboxEmissive. | UseEmissiveMap: yes |
static_water |
Water with dynamic refractions and static reflections. | |
static_water.specular |
Water with dynamic refractions, static reflections and specular highlights from lights. | UseSpecularLighting: yes |