1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Shaders(Materials) Explained

Discussion in 'Guides and Tutorials' started by Henry08, Feb 1, 2018.

  1. 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
    [​IMG]
    • 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
    [​IMG]
    [​IMG]

    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: Feb 2, 2018
  2. 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: Feb 4, 2018
  3. Simple shader with three maps: diffuse, normal and sphere, maybe the best for metal


    Same as ir_sr3shaderball but with some subtle white glow


    This is shader without maps, simple red glowing
     
    Last edited: Feb 3, 2018
  4. Admixon

    Admixon Administrator Staff Member

    Could you explain me how to add shaderball? I still have problems with it.
     
  5. flow754

    flow754 Modding patch tester

    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.
     
  6. 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
    [​IMG]


    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
     
  7. Admixon

    Admixon Administrator Staff Member

    I don't know why it didn't work before but now it works! Thanks ;)
     
  8. 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.

    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?
     
  9. flow754

    flow754 Modding patch tester

    You can increase the glow intensity by setting Pulse_Base and Pulse_Max to greater values if that's what you need.
     
  10. What are the maximum values? 100 I guess? And does Pulse_Rate set in seconds?