Game Development Community

Specular head. Body, not so much...

by Jondo · in Technical Issues · 03/17/2008 (1:02 pm) · 5 replies

Hi folks,

I am new to shaders so I have been practicing! Loading my art into the demo TGEA and comparing my results around the 'widely varied' lighting in that mission.

Can anyone help me figure out why my body isn't getting specular light?

www.brokeassgames.com/images/shadertest03.jpg
No problem getting Normal maps on all my body parts and clothing. But then I noticed my char's head seems to take specular settings and use them properly.

Using a bright blue/purple to show up clearly.
www.brokeassgames.com/images/shadertest00.jpg

Specular is working on the head of the static mesh version too.
www.brokeassgames.com/images/shadertest01.jpg
I have been making tangent based normal maps in ZB2 Zmapper, trying a few of the many settings, reading as I go. Even managed to improve the seams on the normals... But no matter what I do I can't get the specular effect to fire up on the 'body'. The body is 1 UV group but many mesh groups (for hiding), but the entire body calls 1 UV and the normals work fine.

Every thing else in my scene: the SpaceOrcGun, my player head, eyes, mouth have their own material calling a normal and the specular works on them.

I don't really need shiny bodies, just trying to get consistent results.

I've tried a wide array of material script settings, none of which make the specular show on the body.

new Material(Body)
{
   baseTex[0] = "~/data/shapes/SpaceOrc/body";
   bumpTex[0] = "~/data/shapes/SpaceOrc/body_normal";
   cubemap = hikari;
   pixelSpecular[0] = true;
   specular[0] = "1 1 1 1";
   specularPower[0] = 10.0;
};

I've also gone back and tried embedding spec maps (from crazy bump and xnormal) into alpha channels of both the diffuse and normal maps.

Always get the same results...
www.brokeassgames.com/images/shadertest02.jpg
Note: the specularly working parts of the mesh (head, eyes, mouth) all call a .jpg diffuse (with no fancy alpha embedded), while the body calls a .png diffuse (didn't seem to call any texture when I had a .jpg diffuse for the body.)

Any help is appreciated,

Jondo

#1
03/17/2008 (4:30 pm)
As far as specularity goes, .JPG is like having a .PNG with a full-white alpha map (or do I have that backwards?).

At any rate, using PNGs with an alpha map is usually the best way to handle it if you need to control the specularity (via the alpha). Or, you can try making the body a JPG and see if that comes out as you'd expect.

Whether it's JPG or PNG doesn't matter to the script and engine, unless you've specified it in the datablock --which you haven't.

Does that make sense? Or did I confuse the issue?
#2
03/17/2008 (5:36 pm)
Makes sense. And was the source of my problem.

I got some help in the GG IRC chat too. They said in order to use Specular maps in stock TGEA the map data must be embedded in the alpha channel of the diffuse texture. And Pointed out if you have none, its acts as full on. Bingo thats why I saw specular light on my head, there was no proper spec map in the diffuse's alpha channel. I tried a jpg body diffuse and got an identical result. So that was good news for me. Now I am consistently using them, improperly.

www.brokeassgames.com/images/shadertest04.jpg
Then I cleaned up the color to something more skin-like.. you can barely see it now, but thats what I was going for.

www.brokeassgames.com/images/shadertest05.jpg
I know this is technically 'not working right' but I think its progress.

Next I will try to embed the specular map data into the alpha channel of the diffuse to control where the specular will fall.

Thanks Eric, Logan and Chemeleon,

Jondo
#3
03/17/2008 (5:56 pm)
You're quite welcome.

And just to make sure: JPGs cannot have alpha channels. It's also usually recommended to use the SuperPNG plugin 8.x version which can be found here through the search bar (instructions are inside the ZIP).
#4
03/17/2008 (6:16 pm)
I understand. Using a jpg diffuse is like a big white alpha therefore full specular over the whole shape.

So I tried embedding a specular map into my diffuse texture... with some parts solid white and the rest black. It worked. Thanks again for sharing the knowledge.

www.brokeassgames.com/images/shadertest06.jpg
#5
03/17/2008 (6:25 pm)
Haha, nice. I guess that clears up some stuff. ;)