I spent the better part of 2 full days trying to figure out how to make custom terrain textures work like the default ones in the editor. It is definitely no easy task through trial-and-error. Therefore, I decided to write up my findings in hopes that they may be useful for others.
First of all, if you look at the default textures in the terrain sets, you will notice that there is two texture files. These are labeled as "Normal Map" and "Texture" and they are both in the ".dds" format. I'll start with the format.
The .dds format stands for Direct Draw Surface and is the format that Direct X uses for textures, apparently. Most applications cannot read or save in this format, but there are plug-ins to work with this file type for GIMP (free software) and Photoshop. Some programs, such as Irfanview, can open the file type but not save files in that type and will not be useful for creating textures.
Ok, so now you hopefully have found yourself a program for editing the .dds file type. So, what is the difference between the Normal Map and the Texture? If you look at the default terrain texture files in the editor, you will notice that they are very dark and do not look like they do when placed on the ground. And the Normal Maps are usually greyscale and sort of look like someone used an "emboss" effect on the texture. Well, its a very complex system of alpha channels. First I will explain what the alpha channels do for these textures, then after I will explain how to do it it GIMP.
~~
Texture: The texture appears almost black in the editor's file browser because of its alpha channel. After much experimenting, the alpha channel of the texture file determines how well it blends with other textures on the ground.
- If the alpha channel is non-existent or 0% (pure white) then the texture will not blend at all with other textures when placed on the ground. This could be useful, I suppose, but for the most part it looks extremely ugly.
- When the alpha channel of the texture is 100% (pure black) it blends smoothest with other ground textures in the editor.
Values in between, any shade of grey, have a varying amount of blend between textures. Therefore, I recommend that all of your ground textures always have a pure black, 100% alpha channel. This will make them blend the smoothest.
~~
Normal Map: The 'normal map' files that Blizzard uses are NOT true normal maps. If you take your texture and use a normal map generator, the result will NOT work in the editor as terrain. The "Normal Map" field seems to function much more like a Specular Map. The editor is very confusing in this. Anyway, the file in the Normal Map field seems to function with greyscale images and color images and also MUST have an alpha channel to function correctly.
- In the image (rgb part), the darker areas of the image will have less lighting.
- The lighter areas of the image will have more lighting. It functions sort of like highlights and tells the game which areas to draw light on.
- For the alpha channel, 0% (pure white) will have extreme lighting in only the up-down direction.
- 100% (pure black) alpha will have extreme lighting in only the left-right direction.
Don't quote me on the directions as I may have switched them. Its confusing and I doubt most people will have a use for messing with this feature.
I recommend a 50% alpha (128r, 128g, 128b) for the full image on the Normal Map. Yes, you can make much more complex lighting with other values, but it is difficult to do and unnecessary because the brightness of the rgb image already controls how much light there is. You are welcome to contribute more information if you find better results another way. I tested using a copy of the image as the alpha and an inverted copy of the image, but both looked horrible.
~~
How to make a .DDS file in GIMP:
- First, find a plug-in for GIMP to be able to save in the .dds format. Note that the size of your image must be a power of 2 for it to work in the Galaxy editor (128, 256, 512, 1024, ect). You do not need a seamless or tiling texture because the Galaxy editor will blend it for you.
- When your image is ready, right click on it in GIMP and go to Layer --> Mask --> Add Layer Mask and click Ok. This will add a new layer to use as your alpha channel. Edit this new layer as you see fit (I recommend pure black (256,256,256) for Textures and medium grey (128,128,128) for Normal Maps.
- When it is done, right click the image and select Layer --> Mask --> Apply Mask Layer.
- Your alpha channel is done and your image is complete. Click save and save it as a .dds file. When prompted for settings, change the compression to lower the file size and select "add mipmap". (all of Blizzard's file have the mipmap).
- Now just import the file and use it in the data editor as I described!
If you have any questions, feel free to ask. Corrections or contributions are welcome. However, I am NOT taking requests to make your terrain or textures at this time, sorry.
Update:
It appears that the file in the "normal map" section works differently than I had thought. The rgb part of the picture seems to apply light of that color, and the alpha channel determines how much of the default game light hits that spot where 100% (black) is fully lit and 0% (white) has no light and creates dark patches and shadows.
Therefore, if you are using a texture that already has dark patches and shadows, the inverted greyscale version of that texture would make an appropriate alpha channel for the normal map file. Also note that it is best to keep the contrast low and near 50% alpha (128/128/128) and avoid 0% or 100% alpha for best effect.
The alpha channel is simply the amount of transparency a pixel has from my understanding.
Rollback Post to RevisionRollBack
Stuff I've worked on: Carbot's StarCrafts Mod (2014-present) StarCraft 2 Hotkey Trainer (2010) | Mineralz Evolution (2011+) | Dungeon Legacy (2013+) | Phoenix TLMC 4 Entry (2014) Assisted: City of Tempest (2012) | BarCraft (2013) | Poker Defense (2014) and a few more.
In this thread it is said create mipmaps, in the modelling section it is said DO NOT create mipmaps (because the galaxy editor creates his own), what is right?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I spent the better part of 2 full days trying to figure out how to make custom terrain textures work like the default ones in the editor. It is definitely no easy task through trial-and-error. Therefore, I decided to write up my findings in hopes that they may be useful for others.
First of all, if you look at the default textures in the terrain sets, you will notice that there is two texture files. These are labeled as "Normal Map" and "Texture" and they are both in the ".dds" format. I'll start with the format.
The .dds format stands for Direct Draw Surface and is the format that Direct X uses for textures, apparently. Most applications cannot read or save in this format, but there are plug-ins to work with this file type for GIMP (free software) and Photoshop. Some programs, such as Irfanview, can open the file type but not save files in that type and will not be useful for creating textures.
Ok, so now you hopefully have found yourself a program for editing the .dds file type. So, what is the difference between the Normal Map and the Texture? If you look at the default terrain texture files in the editor, you will notice that they are very dark and do not look like they do when placed on the ground. And the Normal Maps are usually greyscale and sort of look like someone used an "emboss" effect on the texture. Well, its a very complex system of alpha channels. First I will explain what the alpha channels do for these textures, then after I will explain how to do it it GIMP.
~~
Texture: The texture appears almost black in the editor's file browser because of its alpha channel. After much experimenting, the alpha channel of the texture file determines how well it blends with other textures on the ground.
- If the alpha channel is non-existent or 0% (pure white) then the texture will not blend at all with other textures when placed on the ground. This could be useful, I suppose, but for the most part it looks extremely ugly.
- When the alpha channel of the texture is 100% (pure black) it blends smoothest with other ground textures in the editor.
Values in between, any shade of grey, have a varying amount of blend between textures. Therefore, I recommend that all of your ground textures always have a pure black, 100% alpha channel. This will make them blend the smoothest.
~~
Normal Map: The 'normal map' files that Blizzard uses are NOT true normal maps. If you take your texture and use a normal map generator, the result will NOT work in the editor as terrain. The "Normal Map" field seems to function much more like a Specular Map. The editor is very confusing in this. Anyway, the file in the Normal Map field seems to function with greyscale images and color images and also MUST have an alpha channel to function correctly.
- In the image (rgb part), the darker areas of the image will have less lighting.
- The lighter areas of the image will have more lighting. It functions sort of like highlights and tells the game which areas to draw light on.
- For the alpha channel, 0% (pure white) will have extreme lighting in only the up-down direction.
- 100% (pure black) alpha will have extreme lighting in only the left-right direction.
Don't quote me on the directions as I may have switched them. Its confusing and I doubt most people will have a use for messing with this feature.
I recommend a 50% alpha (128r, 128g, 128b) for the full image on the Normal Map. Yes, you can make much more complex lighting with other values, but it is difficult to do and unnecessary because the brightness of the rgb image already controls how much light there is. You are welcome to contribute more information if you find better results another way. I tested using a copy of the image as the alpha and an inverted copy of the image, but both looked horrible.
~~
How to make a .DDS file in GIMP:
- First, find a plug-in for GIMP to be able to save in the .dds format. Note that the size of your image must be a power of 2 for it to work in the Galaxy editor (128, 256, 512, 1024, ect). You do not need a seamless or tiling texture because the Galaxy editor will blend it for you.
- When your image is ready, right click on it in GIMP and go to Layer --> Mask --> Add Layer Mask and click Ok. This will add a new layer to use as your alpha channel. Edit this new layer as you see fit (I recommend pure black (256,256,256) for Textures and medium grey (128,128,128) for Normal Maps.
- When it is done, right click the image and select Layer --> Mask --> Apply Mask Layer.
- Your alpha channel is done and your image is complete. Click save and save it as a .dds file. When prompted for settings, change the compression to lower the file size and select "add mipmap". (all of Blizzard's file have the mipmap).
- Now just import the file and use it in the data editor as I described!
If you have any questions, feel free to ask. Corrections or contributions are welcome. However, I am NOT taking requests to make your terrain or textures at this time, sorry.
Update: It appears that the file in the "normal map" section works differently than I had thought. The rgb part of the picture seems to apply light of that color, and the alpha channel determines how much of the default game light hits that spot where 100% (black) is fully lit and 0% (white) has no light and creates dark patches and shadows.
Therefore, if you are using a texture that already has dark patches and shadows, the inverted greyscale version of that texture would make an appropriate alpha channel for the normal map file. Also note that it is best to keep the contrast low and near 50% alpha (128/128/128) and avoid 0% or 100% alpha for best effect.
@Teny2: Go
Thanks for the tutorial. Very handy.
The alpha channel is simply the amount of transparency a pixel has from my understanding.
Stuff I've worked on:
Carbot's StarCrafts Mod (2014-present) StarCraft 2 Hotkey Trainer (2010) | Mineralz Evolution (2011+) | Dungeon Legacy (2013+) | Phoenix TLMC 4 Entry (2014) Assisted: City of Tempest (2012) | BarCraft (2013) | Poker Defense (2014) and a few more.
In this thread it is said create mipmaps, in the modelling section it is said DO NOT create mipmaps (because the galaxy editor creates his own), what is right?