Shaders(Materials) Explained

If you are a beginner in modding, the shader system in Saints Row 4 might be confusing to you. Even for me. So I decided to test all of them.

I created a new costume which essentially is a 3d ball and apply sets of textures to it
9k0c9cdzpqq483ezg.jpg

  • Blend map (for experimenting)
  • White-Gray checkerboard map with alpha channel as diffuse
  • RGB pattern map
  • Simple Yellow glow map
  • Simple normal map with circles and greed patterns
  • BCM pattern map
  • Green-Purple checkerboard as specular
  • Sphere map 1
  • Sphere map 2
ur0rw9hh4gaot9nzg.jpg

44qez6iwqu36z8wzg.jpg

  • Diffuse maps

  • RGB pattern maps
These are sometimes used instead of diffuse maps to allow for color customization. Red [0xFF0000], green [0x00FF00] and blue [0x0000FF] pixels will be substituted by different customizable colors. RGB pattern maps can also include baked Ambient Occlusion.
  • BCM pattern maps
These are used in combination with diffuse maps to allow for color customization. Blue [0x0000FF], cyan [0x00FFFF] and magenta [0xFF00FF] pixels will be substituted by customizable colors and multiplied by the values of the respective pixels in the accompanying diffuse map.
  • Normal maps
Just regular normal maps. Sometimes work better when inverted.
  • Specular color maps

  • Glow maps

  • Sphere maps
Spherical environment maps used for custom reflections. Similar to matcaps in ZBrush.
…and here are the possible combinations:


Note : SR4's normal maps don't have blue channel(it's filled by black color) but that is not big deal, nonempty blue channel doesn't affect on material

Note: I didn't get any good result with specular color map, maybe because I had done something wrong or there is not any good light source in my test

That all with my little test for current SDK converter. I would be glad for any help.

Simple shader with 3 maps: diffuse, normal and specular color. As I understand at prefix means Alpha Transparency so it support transparency controlled by alpha channel in diffuse texture. Works as expected.


Even more simple shader with one diffuse texture. You can see that alpha transparency works too but material is also double-sided.


Same 3 maps: diffuse, normal and specular color as in ir_at_bbsimple1 but transparency doesn't works


Same one diffuse map as in ir_at_bbsimple3 but transparency doesn't works


4 maps: diffuse, normal, specular color and glow. As you expected glow map is glowing. Only with this lighting you can see green specular color map.
 
Last edited:
That is first shader with changeable colors, 4 maps: RGB pattern , normal , sphere and specular color. Sphere map 1 in ambient color slot gives fake reflection. It supports pulse glowing but you need to change some parameters in SDK. In color editor the arrangement is 1 - Blue channel, 2 - Green channel, 3 - Red channel.


Same as ir_sr3npcclothPulse but pulse glow doesn't work


It's very interesting shader, we need 5 maps: diffuse, normal, sphere map 1, sphere map 2 and some blend map. You can put alpha channel from diffuse map to Transparency slot in Maya Hypershade or use any black and white(I guess) texture. Two Sphere maps(fake reflections) will be blended with mask in transparency slot.


That is more controllable shader for changeable colors, there are 4 maps: diffuse, BCM patten, normal and sphere. Colors will be multiplied to diffuse map so you'll get better result with white color on diffuse map. Arrangement in color editor is :1 - Blue channel, 2 - Cian channel, 3 - Magenta channel


ir_sr3pchair
Hair shader. For some reasons SDK doesn't convert material with this shader. I have researched these materials in game archives and found some info. Dob map is kinda transparency and color map simultaneously. Same texture in Red and Blue channel for coloring and alpha mask in Green channel. Game materials also have ordinary Flow and Normal map.


Huge character skin shader, 6 maps: diffuse, normal, sphere 1, sphere 2, blend , specular color. Same as ir_sr3npcskinfull but normal maps works only when you press space bar
 
Last edited:
Good job, that's some great documentation! Let me see if I can fill in some blanks here:
  • The neat thing about the ir_sr3npcclothPulse shader is that it glows in a customizable color if configured correctly. Basically, you can change any of the materials parameters by editing the sr_shaders.xml file in the converter folder. For example, you could increase or decrease the intensity of the glow effect of ir_glowmask_dns by changing the content of the 'self_illumination' tag to a different value.
    self_illumination.PNG

    Similarily, if you want ir_sr3npcclothPulse to glow with a constant intensity, change 'Glows' to true and set 'Pulse_Base' and 'Pulse_Max' to a value greater than 0.
    npcclothPulse_01.PNG

    If 'Pulse_Base' and 'Pulse_Max' are not equal, the shader will constantly interpolate between them at the specified 'Pulse_Rate'.
    npcclothPulse_02.PNG
  • As you've noticed, specular color maps don't really work with clothing items, whereas they do with weapons. I once heard a talk from a Volition employee saying they got rid of specular highlights for customization items because they were having an impact on performance. So in most cases they just faked them with sphere maps. For that reason, I used to believe the game is hardcoded to neglect specular color maps for clothes, but seeing how you kind of got them to work with the ir_glowmask_dns shader gives me hope that they're only disabled on the most common clothing shaders.
  • Neither DOB nor flow maps are supported in the latest version of the converter, since adding new hairstyles isn't possible with the modding patch as of now anyway. Hence they don't have an assigned texture slot in Maya.
 
Could you explain me how to add shaderball? I still have problems with it.
What is your problem with shaderball? In maya i got result with this mapping:

Diffuse-Out color-Color
Sphere map-Out color -Ambient Color
Normal map-Out Alpha-bump-Normal Camera

Please try and post screenshots if something will goes wrong
jHp0Ahf.png



Good job, that's some great documentation! Let me see if I can fill in some blanks here:

Wow, this is pretty cool. I had some thoughts about pulse glow but I was assured that feature was hardcoded. I am going to try the pulse shader again now with knowledge how it works. Info about spec color maps is really sad. I guess they should do something for optimizing performance but cutting shaders sounds harsh. Maybe that was more simple than replacing them for every model
 
What is your problem with shaderball? In maya i got result with this mapping:

Diffuse-Out color-Color
Sphere map-Out color -Ambient Color
Normal map-Out Alpha-bump-Normal Camera

Please try and post screenshots if something will goes wrong
jHp0Ahf.png





Wow, this is pretty cool. I had some thoughts about pulse glow but I was assured that feature was hardcoded. I am going to try the pulse shader again now with knowledge how it works. Info about spec color maps is really sad. I guess they should do something for optimizing performance but cutting shaders sounds harsh. Maybe that was more simple than replacing them for every model
I don't know why it didn't work before but now it works! Thanks ;)
 
I don't know why it didn't work before but now it works! Thanks ;)
No problem. Few times game instantly crushed when I have chosen this shader before but when I figure out how all shaders work that problem was disappeared. It's sorta quantum magic of uncertainty or Murphy's law I guess.

Good job, that's some great documentation! Let me see if I can fill in some blanks here:
  • The neat thing about the ir_sr3npcclothPulse shader is that it glows in a customizable color if configured correctly. Basically, you can change any of the materials parameters by editing the sr_shaders.xml file in the converter folder. For example, you could increase or decrease the intensity of the glow effect of ir_glowmask_dns by changing the content of the 'self_illumination' tag to a different value.
    View attachment 17968
    Similarily, if you want ir_sr3npcclothPulse to glow with a constant intensity, change 'Glows' to true and set 'Pulse_Base' and 'Pulse_Max' to a value greater than 0.
    View attachment 17969
    If 'Pulse_Base' and 'Pulse_Max' are not equal, the shader will constantly interpolate between them at the specified 'Pulse_Rate'.
    View attachment 17970
  • As you've noticed, specular color maps don't really work with clothing items, whereas they do with weapons. I once heard a talk from a Volition employee saying they got rid of specular highlights for customization items because they were having an impact on performance. So in most cases they just faked them with sphere maps. For that reason, I used to believe the game is hardcoded to neglect specular color maps for clothes, but seeing how you kind of got them to work with the ir_glowmask_dns shader gives me hope that they're only disabled on the most common clothing shaders.
  • Neither DOB nor flow maps are supported in the latest version of the converter, since adding new hairstyles isn't possible with the modding patch as of now anyway. Hence they don't have an assigned texture slot in Maya.

I have tried that and what I got
It's amazing. As I understand Green channel is glowing but does it some hardcoded value or maybe I something missed in sr_shader.xml?
 
As I understand Green channel is glowing but does it some hardcoded value or maybe I something missed in sr_shader.xml?
You can increase the glow intensity by setting Pulse_Base and Pulse_Max to greater values if that's what you need.
 
Back
Top