How to create custom textures!

WiseChoicesWiseChoices Seattle, WA Join Date: 2014-12-19 Member: 200112Members
Custom Textures:

1. Create a .psd image (photoshop) that has a pixel count that is divisible by 4.
2. Put the .psd file in your mod folder. Example: MYMOD/source/materialsrc/MYMATERIALS/CUSTOM.jpg
3. Create a .material file. Example: MYMOD/source/materialsrc/MYMATERIALS/CUSTOM.material
4. Assign the program Notepad for opening .material files.
5. Open your .material file, then paste and edit the following:

shader = "shaders/Level.surface_shader"
albedoMap = "materials/MYMATERIALS/CUSTOM.dds"

6. This will give you a very basic function for how to handle the material. There are many cool functions in the NS2 material folders if you want things like scrolling, pulsing, warping.
7. Open Builder, click Build, and close the program.
8. Check to see if the output has your .material, and a new .dds file. Example: MYMOD/output/materials/MYMATERIALS/CUSTOM.dds
9. Select and copy your output's MYMATERIALS folder, and paste it in ns2/materials.
10. Open Spark Editor, click on textures, highlight the entire searchbar and search for your texture. It should appear and you should be able to use it.
Done.
If I missed something, I will edit this. Feel free to ask how to give your textures unique attributes.

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 August 2016
    Custom Textures:

    1. Create a .psd image (photoshop) that has a pixel count that is divisible by 4.
    2. Put the .psd file in your mod folder. Example: MYMOD/source/materialsrc/MYMATERIALS/CUSTOM.jpg
    3. Create a .material file. Example: MYMOD/source/materialsrc/MYMATERIALS/CUSTOM.material
    4. Assign the program Notepad for opening .material files.
    5. Open your .material file, then paste and edit the following:

    shader = "shaders/Level.surface_shader"
    albedoMap = "materials/MYMATERIALS/CUSTOM.dds"

    6. This will give you a very basic function for how to handle the material. There are many cool functions in the NS2 material folders if you want things like scrolling, pulsing, warping.
    7. Open Builder, click Build, and close the program.
    8. Check to see if the output has your .material, and a new .dds file. Example: MYMOD/output/materials/MYMATERIALS/CUSTOM.dds
    9. Select and copy your output's MYMATERIALS folder, and paste it in ns2/materials.
    10. Open Spark Editor, click on textures, highlight the entire searchbar and search for your texture. It should appear and you should be able to use it.
    Done.
    If I missed something, I will edit this. Feel free to ask how to give your textures unique attributes.

    With the exception of UI textures, the dimensions are usually powers of two greater than 16 (ie 32, 64, 128, 256, 512, 1024, 2048... rarely more than this)

    Also, to expand further:
    if you aren't supplying a normal map, you should still include the line:
    normalMap = "materials/dev/dev_normal.dds"
    
    , otherwise there will be errors in people's consoles.

    Also, different shaders expect different textures. The two most common for level geometry and props are Level.surface_shader, and Model.surface_shader.
    Level expects the albedo map to be: RGB albedo + greyscale specular in the alpha channel.
    Both include tangent space normal map support, but Model goes a step further and, instead of using the alpha channel of the albedo map for a greyscale specular value, it let's you supply a third "specularMap" map. This map is: RGB specular + greyscale glossy map in the alpha channel.

    A note about naming conventions (that DO affect how builder builds the files)
    Albedo maps should be the name of the material (eg "materials/my_awesome_material.dds")
    Normal maps should end with "_normal", this tells builder to compress the texture a little bit differently, to accommodate normal maps a little bit better. (eg "materials/my_awesome_material_normal.dds")
    Specular maps MUST end with "_spec", otherwise the alpha channel will be filled with white instead of the gloss map you painstakingly created. (eg "materials/my_awesome_material_spec.dds")

    I'll probably think of something else to mention once I hit "save comment", but that's it from me for the moment.
  • ZavaroZavaro Tucson, Arizona Join Date: 2005-02-14 Member: 41174Members, Super Administrators, NS2 Playtester, Squad Five Blue, Squad Five Silver, NS2 Map Tester, Reinforced - Shadow, WC 2013 - Silver, Subnautica Playtester, NS2 Community Developer, Pistachionauts
    I wrote a python script that does all this for you, although very rudimentary. I wanted to make a GUI version that automatically fills things out based on naming conventions and folder setup, including correct shaders, but I haven't had the time.

    This link for that is here.
  • InsaneInsane Anomaly Join Date: 2002-05-13 Member: 605Members, Super Administrators, Forum Admins, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, NS2 Playtester, Squad Five Blue, NS2 Map Tester, Subnautica Developer, Pistachionauts, Future Perfect Developer
    edited August 2016
    BeigeAlert wrote: »
    Also, different shaders expect different textures. The two most common for level geometry and props are Level.surface_shader, and Model.surface_shader.

    To expand even further on this, I wrote a guide to the typical shaders which you can find here. Bear in mind though that's it's three years old so portions may be out of date! I noticed that I glossed over the way specular maps work in the Level and Model shaders after BeigeAlert brought it up, so I updated that to be more useful.
  • 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
    Thanks Insane!

    One thing I noticed is that materials that use the Level surface shader tend to be metals. Appropriately, the shader colors the greyscale specular map you feed it with the colors from the albedo map, so you get that nice metallic colored specular highlighting, instead of it just reflecting back the light color, like something non-metallic would. It also has a fixed glossiness value of 20 (in the range 0-255).

    TLDR: If you're making a texture that's pretty much all metal, use Level.surface_shader. If you're making a texture that you want to be more particular about the color of the specularity, or you want to modify the glossiness, use Model.surface_shader.
Sign In or Register to comment.