Can't make textures shiny
by Lee Latham · in Torque Game Engine Advanced · 10/06/2007 (7:30 pm) · 12 replies
I know that the main problem is that I'm a total noob to TGEA materials, but for the life of me I just can't get my textures shiny. I apply specular and it just doesn't seem to do anything. Here's what I've got (sorry, I decided to leave it pretty big so you could see easily):

The mosaic wall on the right and the glass doors of the shower could both stand to be fairly shiny. I try various values for specular and specularpower and it doesn't seem to make any difference. I don't know if it could be the type of lights I'm using (sgLightObject), the models, textures, or what. I've got a nice bump map for the mosaic image, and it looks great, but even if I move the light around it never gets "shiny".
I'm sure I'm a retard, or I've got something misconfigured somehow, but I'd appreciate any feedback anyone cares to give!
lee

The mosaic wall on the right and the glass doors of the shower could both stand to be fairly shiny. I try various values for specular and specularpower and it doesn't seem to make any difference. I don't know if it could be the type of lights I'm using (sgLightObject), the models, textures, or what. I've got a nice bump map for the mosaic image, and it looks great, but even if I move the light around it never gets "shiny".
I'm sure I'm a retard, or I've got something misconfigured somehow, but I'd appreciate any feedback anyone cares to give!
lee
#2
You've brought up a good point, but I'm still stuck. You were right, I didn't have an alpha layer on the mosaic, so I whipped it into the Gimp and added one...and it doesn't seem to have made a difference. But I've long been puzzled about how to manipulate the alpha channel in there...like to set all the pixels to say 255 alpha? I was wondering if it was Set Alpha Threshold, but that doesn't seem to make a difference, here.
But then again also, it presents an interesting problem for the shower doors. The reason I'm wanting to make them shiny is because you can't really tell what the shape of the thing is. It follows the bottom of the shower stall and is all angular and stuff. But when you look at it it's just a greenish blob. However, in this case the alpha channel is defined by the transparency level of the color. But it doesn't seem to shine at all.
?
10/06/2007 (9:28 pm)
Thanks! Yeah I bought a model from Turbosquid just to get that mosaic on the wall there. Way beyond my artistic ability.You've brought up a good point, but I'm still stuck. You were right, I didn't have an alpha layer on the mosaic, so I whipped it into the Gimp and added one...and it doesn't seem to have made a difference. But I've long been puzzled about how to manipulate the alpha channel in there...like to set all the pixels to say 255 alpha? I was wondering if it was Set Alpha Threshold, but that doesn't seem to make a difference, here.
But then again also, it presents an interesting problem for the shower doors. The reason I'm wanting to make them shiny is because you can't really tell what the shape of the thing is. It follows the bottom of the shower stall and is all angular and stuff. But when you look at it it's just a greenish blob. However, in this case the alpha channel is defined by the transparency level of the color. But it doesn't seem to shine at all.
?
#3
10/07/2007 (12:00 am)
What's your materials.cs look like?
#4
I've jacked around with the numbers quite a bit to no avail. I have the emissive = true; on the glass one because otherwise with no Sun ambient set to 0 0 0 0 the glass was too clear to see at all, hardly. However, with the Sun set to more normal settings (or 1 1 1 1 for that matter) I still don't get shininess.
10/07/2007 (1:58 am)
Generally something like this:new Material(bluegreenglass34)
{
baseTex[0] = "bluegreenglass34";
translucent = true;
translucentBlendOp = LerpAlpha;
emissive = true;
specular = "1.0 1.0 1.0 .1";
specularPower = 100.0;
};
new Material(material_Wall_var)
{
baseTex[0] = "Wall_var";
bumpTex[0] = "Wall_var_bump";
specular = "1.0 1.0 1.0 .1";
specularPower = 32.0;
};I've jacked around with the numbers quite a bit to no avail. I have the emissive = true; on the glass one because otherwise with no Sun ambient set to 0 0 0 0 the glass was too clear to see at all, hardly. However, with the Sun set to more normal settings (or 1 1 1 1 for that matter) I still don't get shininess.
#5
10/07/2007 (2:15 am)
You forgot to enable the per pixel specularity there.
#6
I think specularPower needs to be a power of two. The higher the number, the more concentrated the light spot.
For testing purposes, you should turn up the specularity completely: specular = "1.0 1.0 1.0 1.0" .
You might declare pixelSpecular = true;, since this would be a more precise specularity than vertex.
For the glass, you might move the specularity to a second pass to avoid any conflicts with the transparency and alpha map. I don't know if you'd need to add a texture or bumpmap to the second one:
10/07/2007 (2:23 am)
Unfortunately, I'm still pretty new to TGEA shaders myself, but here's a few thoughts:I think specularPower needs to be a power of two. The higher the number, the more concentrated the light spot.
For testing purposes, you should turn up the specularity completely: specular = "1.0 1.0 1.0 1.0" .
You might declare pixelSpecular = true;, since this would be a more precise specularity than vertex.
For the glass, you might move the specularity to a second pass to avoid any conflicts with the transparency and alpha map. I don't know if you'd need to add a texture or bumpmap to the second one:
new Material(bluegreenglass34)
{
baseTex[0] = "bluegreenglass34";
translucent[0] = true;
translucentBlendOp[0] = LerpAlpha;
emissive[0] = true;
//second pass
pixelspecular[1] = true;
specular[1]= "1.0 1.0 1.0 1.0";
specularPower [1] = 128.0;
};
#7
@Marc: I presume your talking about the pixelspecular setting? I don't see any difference whether this is on or off.
edit I lie. Without it it looks just like in my first image. I hadn't seen a difference before, but I certainly do now!
The fishwall is still a bit of trouble, though. One thing I noticed was that the smaller the specularPower number, the brighter things get. But it's not a nice reflectivy sort of shininess, but kindof a pre-list sort of brightening. I noticed on the glass doors, too, that the shininess doesn't move on the image as I move along the room. The effect I'm looking for on the wall is a kind of shiny, glistening effect that moves as you move. Am I trying the wrong thing? BTW the wall is a DTS...I probably should have mentioned that before. Here's the screenie:

and here's the code used for this screenie:
Interestingly, when I moved the specular stuff to the second pass for the wall material, it turned all grey, and you couldn't see the image or the bumpmap. Anyone seen a nice explanation of how the rendering passes work in layman's terms?
10/07/2007 (2:18 pm)
Well, progress! Eric, your idea of moving the specular stuff to the second pass seems to have solved the issue for the glass. As you can see below you can now see some definition in the shower doors and see the three-dimensionality of it much better! I think I can tweak from that to get it looking nice. @Marc: I presume your talking about the pixelspecular setting? I don't see any difference whether this is on or off.
edit I lie. Without it it looks just like in my first image. I hadn't seen a difference before, but I certainly do now!
The fishwall is still a bit of trouble, though. One thing I noticed was that the smaller the specularPower number, the brighter things get. But it's not a nice reflectivy sort of shininess, but kindof a pre-list sort of brightening. I noticed on the glass doors, too, that the shininess doesn't move on the image as I move along the room. The effect I'm looking for on the wall is a kind of shiny, glistening effect that moves as you move. Am I trying the wrong thing? BTW the wall is a DTS...I probably should have mentioned that before. Here's the screenie:

and here's the code used for this screenie:
new Material(bluegreenglass34)
{
baseTex[0] = "bluegreenglass34";
translucent[0] = true;
translucentBlendOp[0] = AddAlpha;
emissive[0] = true;
pixelspecular[1] = true;
specular[1] = "0.5 0.5 0.5 0.1";
specularPower[1] = 8;
};
new Material(material_Wall_var)
{
baseTex[0] = "Wall_var";
bumpTex[0] = "Wall_var_bump";
pixelspecular[0] = true;
specular[0] = "1 1 1 1 ";
specularPower[0] = 1;
};Interestingly, when I moved the specular stuff to the second pass for the wall material, it turned all grey, and you couldn't see the image or the bumpmap. Anyone seen a nice explanation of how the rendering passes work in layman's terms?
#8
Specular bases on the RGB data of your texture (the brighter the more shiny). Would be nice if it used the alpha channel for specularity but does not right now unless you modify the shader.
so you could use a brighness texture on basetex[1] for the specularity
10/07/2007 (2:47 pm)
If you want specular on a different pass, don't forget to set a base tex for that pass.Specular bases on the RGB data of your texture (the brighter the more shiny). Would be nice if it used the alpha channel for specularity but does not right now unless you modify the shader.
so you could use a brighness texture on basetex[1] for the specularity
#9
But it just came up all grey again. I tried sticking the texture itself in there as well with the same result.
?
10/07/2007 (6:53 pm)
@Marc: I think I'm grasping what you are suggesting...but I'm not sure about the execution. I tried making an all white png called "brightness.png" and did this:new Material(material_Wall_var)
{
baseTex[0] = "Wall_var";
bumpTex[0] = "Wall_var_bump";
baseTex[1] = "brightness";
pixelspecular[1] = true;
specular[1] = "1 1 1 1 ";
specularPower[1] = 16;
};But it just came up all grey again. I tried sticking the texture itself in there as well with the same result.
?
#10
Apparently I have a rather red Sun at the moment...probly a typo on my part, but I've decided I like it!
10/07/2007 (7:02 pm)
BTW the glass is coming along nicely, thought I'd share. A throwaway bumpmap, and also turning OFF receive LM Light and turning ON Receive Sunlight yielded this:
Apparently I have a rather red Sun at the moment...probly a typo on my part, but I've decided I like it!
#11
10/09/2007 (2:15 pm)
I think you're close, but definitely put the Specularity settings back to the base render pass, and make sure that emissive flag is FALSE. The emissive flag should be used very sparingly, as when it is set to TRUE many rendering features are simply skipped. The flag was put in place (I think) as a performance boost for situations where those rendering effects are not needed (no lighting or shading calculations). Here is the key: emissive is to be set to true for materials that appear to emit light, not reflect light or refract it or "shine" but emit light. Think of the way the front of a flashlight looks, or a lit lightbulb, or the sun, or headlights on a car. Those are the things that should have emissive = true. Other than that, leave it off. Try this:new Material(material_Wall_var)
{
baseTex[0] = "Wall_var";
bumpTex[0] = "Wall_var_bump";
pixelspecular[0] = true;
specular[0] = "1 1 1 1";
specularPower[0] = 16;
};
#12
Actually, it seems like the specularity is only in response to Sunlight, as opposed to other kinds of lights? I just happened to run in close enough this time to notice it, perhaps.
Thanks for the hint about the emissive flag, as well. I'd pretty much just been using that on the translucent glass, because otherwise the color wasn't coming through at all. This seems to be due to the fact that I have Sun ambient set to 0 0 0 0. It just always seems to mess up my lighting effects, but I'm starting to see that you can't really get rid of it. For example, the red tinge on the glass doors on the screenshot above is from the sun's color, even though ambient is set all the way down.
Thanks!
10/09/2007 (3:35 pm)
Mark! That's perfect! How the heck I never tried that particular combination, I don't know. I've been messing with CustomMaterials all day trying to get there, and did feel like it was overkill.Actually, it seems like the specularity is only in response to Sunlight, as opposed to other kinds of lights? I just happened to run in close enough this time to notice it, perhaps.
Thanks for the hint about the emissive flag, as well. I'd pretty much just been using that on the translucent glass, because otherwise the color wasn't coming through at all. This seems to be due to the fact that I have Sun ambient set to 0 0 0 0. It just always seems to mess up my lighting effects, but I'm starting to see that you can't really get rid of it. For example, the red tinge on the glass doors on the screenshot above is from the sun's color, even though ambient is set all the way down.
Thanks!
Torque Owner Brian Richardson
Specular power is also controlled by the alpha value of the base texture. So make sure you are using RGBA textures and that your alpha channel is 255 for full specularity.