Question about materials

MelancorMelancor Join Date: 2003-12-15 Member: 24415Members
I am confused about the different kinds of surface shaders.

The textures I am importing (from filterforge.com) generally consist of the following components:
diffuse, bump, normal, specular. Also, there are emissiveMaps, refractionMaps and alpha (transperancy).

Which maps are used by which shader? I have looked at a bunch of different .material files, but it didnt make me smarter.
If there's a documentation, please link me to it.

Comments

  • BeigeAlertBeigeAlert Texas Join Date: 2013-08-08 Member: 186657Members, Super Administrators, Forum Admins, NS2 Developer, NS2 Playtester, Squad Five Blue, Squad Five Silver, NS2 Map Tester, Reinforced - Diamond, Reinforced - Shadow, Subnautica Playtester, Pistachionauts
    edited November 2016
    The documentation is all in here. (You can't see, but I'm pointing to my head) It's also scattered across the forums in various places.

    Typically, a material in Spark that is designed to be applied to a level will use:
    - Albedo (aka diffuse)
    - Normal
    - Specular
    - Gloss (optional)

    For a material that has a gloss map, you should use shaders/Model.surface_shader, which takes 3 texture files:
    - albedo (no suffix, should be same name, different extension from the material file it is used in)
    - normal (suffix _normal)
    - specular (suffix _spec)
    The gloss map is included in the specular map as the alpha channel.

    For materials that don't have gloss maps, you should consider using shaders/Level.surface_shader instead. This shader only has two texture inputs:
    - albedo (same as above)
    - normal
    The specular map is greyscale, and packed into the alpha channel of the albedo map. The final specular texture "input" (in the shader) is multiplied by the color from the albedo texture, so in other words the specular highlight will take on the tint of the underlying albedo map, creating a metallic look... which works out great for all the metal textures this game has.

    Level and Model are the most basic shaders in this game, but there are also other variants that add other capabilities such as:
    - opacity map ("_alpha" in the name, allows for simple transparency in textures... not like glass, but like plants. On or off.)
    - emissive map ("_emissive" in the name, allows for glowing stuff on textures, like tiny lights or glowing lava)

    All of these shaders can be found in the Natural Selection 2/core/shaders folder.

    As for refraction maps, it IS supported in the game, however materials that refract, ONLY refract. So if you want to make a refracting glass texture, you typically have to use two materials: one for the reflection, so it appears solid, and one for the refraction. Put that on two planes and put a little bit of distance between then.
    For an example of a refraction shader, see "Natural Selection 2/ns2/models/props/biodome/biodome_glass_refract.material".

    If you have any more questions, please don't hesitate to ask! :)
  • MelancorMelancor Join Date: 2003-12-15 Member: 24415Members
    Thanks a lot for now
Sign In or Register to comment.