When I was first introduced to this 3d stuff and started working with textures, all tutorials and intro videos I watched and read had black and white spec maps..But on here and a lot of other places now, I see colored spec maps. What are the pros and cons of having either? Does it even matter?
Replies
In the image below you will notice that the sky, and other surrounding objects are comming out yellow in the reflections. this is because the other colours are absorbed by the material.
what you really need to do is study the material you want to reproduce. if the reflections are tinted then you need to tint the specular colour accordingly.
There is a small benefit to grayscale spec maps though. You can store them in a channel of your diffuse map when importing into a game engine to conserve texture memory.
as far as i know, with DXT alphas aren't compressed, thus taking up just as much vram as a compressed, full color texture.
I may be misinformed then
Can anyone confirm that?
On the other hand, you can still have two maps, and instead of having a full color spec map, you use each channel of the second DXT1 map for different maps, like 1 for specular, 1 for gloss, 1 for some other mask.
Having said that, specular color is often really worth it, so it's worth giving it a try, and just keep an open mind on how to best arrange your maps to have the best result with the less texture memory.
The other, "proper" as you call it, way of using colored specular maps relates to the imaginary part of the complex index of refraction of some materials. This is really math-y and not something they usually teach you in school, but it's called the "extinction coefficient". If it's 0 you get white spec, but if it's non-zero, light of the current wavelength gets absorbed instead of reflected, and you end up with a tinted reflection, or colored specular term. Materials can have different extinction coefficients for every wavelength, so some materials don't even have single colored specular, but calculating that is too slow for games unless you're tri-ace, so simplifying it with a color is an acceptable tradeoff.
When choosing specular colors for these materials, a good thing to remember is that in the real world, metals don't have diffuse terms at all, they absorb all light that enters them. So a metal (in a realtime 3d environment) that has a diffuse color of say gold, should probably have a specular color very close to gold. This isn't really limited to metals. One other example is satin, which really benefits from a tinted spec. Anyway the point is that a lot of objects with colored specular, whether to combat gamma or simulate real materials, get their tint from the diffuse color.
Since the issue of storage was brought up, if you use a channel for spec color tinting, you can actually fit colored specular and gloss into one dxt1 texture (strength, gloss, tint).
tl;dr: laugh at me when someone points out that i don't understand physics.
This is what I was thinking of. Thanks for correcting me.
Nothing personal mate but this is totally and utterly wrong.
Metals dont absorb all light that enters them, they simply tend to be quite smooth and dont diffuse the light which hits them. If they absorbed all light they would be black.
I know im being picky here and you had the basic idea right so far as shader balancing goes but the 'in the real world' bit was totally misleading.
this is the biggest falsity ever perpetrated. the only way using the alpha channel for spec maps will help is to cut down on texture calls in a material, as you will only call a single texture sample for both diffuse and specular.
a DXT5 texture (RGB+A) takes up the same amount of memory as two DXT1 textures (RGB).
Already corrected myself a few posts ago
I gotta agree with r_fletch_r here, most metals do have low diffuse reflectance and higher specular reflectance, but saying that metals have no diffuse reflectance is incorrect. I mean look at a metal like Copper, it always has that brownish/orangery colour that comes from it's diffuse reflectance value.
If you had a material with no diffuse reflectance, then the material would either be black or completely reflective like a mirror depending on how much specular reflection there is.
This is really a quirky way to do things, and sounds like something a programmer would come up with to torture artists. =P
Unless you're really hurting for texture memory, a full 24 bit spec, with gloss in the alpha, is going to be by far the easiest and most sensible thing to do. I think the time saved by having your artists use a straight forward approach would make up for any sacrafices you'd have to make to use a 4th channel and double of the size of that texture.
I'm just trying to gain a better understanding of how texture calls and materials and stuff affect memory.
I would import only one DXT with alpha channel, uses only one texture sample. In UE 3 with terrain those are really precious, because terrain is limited to 16 texture samples due to hardware constraints.
Colour tinting could then be done in the shader/material.
Edit: Though I never use specular on terrain :P
No, one 1 32 bit image is likely more efficient, less texture calls. However, 1 32 bit image is the same vmem cost as as 2 24 bit images. When we think about it that way, we can do some cool stuff with two maps:
1. 24 bit full color spec
2. 24 bit combo map
R. Gloss
G. Glow
B. Reflection mask
Or any other creative combination you can come up with.
re:metals, [deleted lengthy explanation]. never mind, I don't feel comfortable trying to educate people about quantum optics.
Any links? Light is something I'm trying to understand well.
exactly, this is the most efficient way of doing things. if you can afford the texture samples this is the biggest bang for your buck.