Game Development Community

Bump Map on a DIF

by Mark Dynna · in Torque Game Engine Advanced · 03/17/2007 (10:36 am) · 21 replies

I'm trying to get a bump map applied to a texture on the exterior of a DIF. Is this supposed to be working properly? I've create a material entry for the texture and applied the bump map but I can't see any difference at all. I've even tried applied other effects like specular highlighting and still can't see the bump map affecting anything.

Here's the DIF I'm applying the bump map to:
visions.game-server.cc/Upload/Screen-Shots/hut-small.pngand here's the bump map for that brick texture:
visions.game-server.cc/Upload/JohnS/Old-Wall2-256x256_bump.pngand here's my Material definition:
new Material(Old_Wall2_256x256)
{
   baseTex[0] = "Old-Wall2-256x256";
   bumpTex[0] = "Old-Wall2-256x256_bump";
};
Page «Previous 1 2
#1
03/17/2007 (1:15 pm)
We have bump textures working on our DIFs, try adding these specular settings:

Sample materials.cs:

new Material(m_stone10)
{
baseTex[0] = "stone10";
bumpTex[0] = "stone10_n";
pixelSpecular[0] = true;
specular[0] = "0.5 0.5 0.5 1.0";
specularPower[0] = 6.0;
};


Weve noticed you get some weird errors sometimes when your filenames have a - in it. Try removing the dashes. Underscores work fine...

Apart from that it should be working for you.

addikt
#2
03/17/2007 (3:04 pm)
You put specular highlighting on your buildings? Well it looks kind of (really) strange on our brick buildings. Maybe someone can enlighten me but I don't see any effect from the bump map.
visions.game-server.cc/Upload/Screen-Shots/hut-bump.png
#3
03/19/2007 (2:23 am)
I believe he is right, rename your textures and export again, i believe it is the naming convention you choose. the "-" in you text name might cause problems other than that you should be n you way , listen to addiktive's advice:) if you really have problems though feel free to email me the .MAP file texture and such and ill set it up and mail it back:)
#4
03/20/2007 (12:14 pm)
Ok, it looks like the dashes were the culprit. We re-created the DIF and removed the dashes from the textures and it seems to be working now. It looks really good too!

@addikt - I can see why you put Specular on it now, it gives a better sense of depth to the texture.

Thanks all for the feedback.
#5
03/20/2007 (12:46 pm)
I demand a working render! ;)
#6
03/20/2007 (3:00 pm)
@Nick

:)
#7
03/20/2007 (9:23 pm)
"Pics or ban?" :)

We only got it working on a test "cube." I'll post screens when we have it working on something that looks good.
#8
03/23/2007 (12:00 pm)
Quote:I demand a working render! ;)

ditto!
#9
03/23/2007 (12:32 pm)
Eye candy. Bring it!
#10
03/23/2007 (2:45 pm)
Ok, ok. Our interiors guy hasn't gotten back to me yet so I'll post screenshots of the cube. We did a successful test with 2 different textures.
Brick texture before:
visions.game-server.cc/Upload/Screen-Shots/BrickPlainSmall.pngBrick texture with bumpmap:
visions.game-server.cc/Upload/Screen-Shots/BrickWithBumpSmall.pngCobblestone floor, before:
visions.game-server.cc/Upload/Screen-Shots/FloorPlainSmall.pngCobblestone floor, with bumpmap:
visions.game-server.cc/Upload/Screen-Shots/FloorWithBumpSmall.png
#11
03/23/2007 (3:01 pm)
Thought about incorporating the on the boards posted parallax shader? :-)
Looks nice btw.
#12
03/27/2007 (9:11 pm)
No, what would it gain us?
#13
03/28/2007 (3:19 pm)
Out of my sight, something that at least to me feels like "depth"
The last picture just looks flat and very similar to the textures I can and often create just with TextureMaker and the advanced lighting rendering ...
So not very impressive when taking the wasted performance for a shader into account.
#14
03/28/2007 (4:30 pm)
Using a parallax shader would make the depth look more realistic on the bumps. It should be noted the shader on TDN and the forums here does work, but it does not work with lighting, as it was written prior to MS4. There isn't any documentation on how to incorporate TGEA lighting into your shaders, however.
#15
03/29/2007 (11:27 am)
Does anyone know why the bump-mapped texture looks so much darker than the original? I wouldn't think it would darken it that much. I didn't think it was that big of a deal until I saw how it looked when you tile the texture on a larger surface. Are there any settings I can tweak so that the texture stays lighter when the bump map is applied?
#16
04/06/2007 (10:41 pm)
It looks darker because, by default, the lightmaps are multiplied against the base texture.

When you add a normal map, the dot product result (ranges from 0.0 to 1.0 - it's 0.0 when the angle between the light vector and the normal is greater than 90 degrees, and 1.0 when it's at 0 degrees) is also multiplied against the base texture, darkening it even more.

A way to solve that is adding this line to your materials

exposure[0] = 2;

That'll bump your materials result color up by 2x.
(Just a warning: you can only use 2 or 4 as exposure values: anything else will be interpreted as 1 - it's a limitation on the way it was implemented, you'll need to adjust your textures, or your lighting settings to balance it out.)
#17
04/10/2007 (3:50 pm)
Ok I tried that and the results looked like Specular Highlighting had been applied. When I think about it, this is not totally surprising as what is probably done with that "exposure" flag has a lot in common with Specularity. I tried some experiments with changing the colour channels of the Bump Map and had some better results with removing some of that darkness.

I suppose what I would like/need is a more detail explanation of how the engine uses the Bump Map texture and how it is applied to the base. How are the RGBA channels of the Bump Map used? Brian, are you reading? Care to shed some light (no pun intended)?
#18
04/10/2007 (5:48 pm)
Taken from Wikipedia's article on normal mapping:

Quote:
To calculate the Lambertian (diffuse) lighting of a surface, the unit vector from the shading point to the light source is dotted with the unit vector normal to that surface, and the result is the intensity of the light on that surface. Many other lighting models also involve some sort of dot product with the normal vector. Imagine a polygonal model of a sphere - you can only approximate the shape of the surface. By using an RGB bitmap textured across the model, more detailed normal vector information can be encoded. Each color channel in the bitmap (red, green and blue) corresponds to a spatial dimension (X, Y and Z). These spatial dimensions are relative to a constant coordinate system for object-space normal maps, or to a smoothly varying coordinate system (based on the derivatives of position with respect to texture coordinates) in the case of tangent-space normal maps. This adds much more detail to the surface of a model, especially in conjunction with advanced lighting techniques.

In the most common implementation of normalmaps, used by Valve's Source engine and implemented in hardware in nVidia cards, the red channel should be the relief of the material when lit from the right, the green channel should be the relief of the material when lit from below, and the blue channel should be the relief of the material when lit from the front(practically, full except on the "slopes"); or, to put it another way, the XYZ coordinates of the face normals are placed in the RGB values of the normal map. If a material is classified as being reflective, the albedo is usually encoded in the alpha channel if one exists.

That's how TGEA uses it. All normal maps are tangent-space (aka: texture-space).

The exposure parameter has nothing to do with specularity. Like I said, it simply multiples the resulting color by 2.0 or 4.0 at the end of the shader, resulting in something similar to which the original lighting pack did.

Unless you turn specular on (the specular results are added to the diffuse results), using a normal map can only darken your textures, since the maximum light value is 1.0, unless you change the exposure.
#19
04/12/2007 (7:46 am)
Great, this is what I was looking for. So, RGB in the bump map equates to XYZ of "virtual" coordinates for the texture. I should be able to work with it now.
#20
06/10/2007 (2:00 pm)
I have been playing with the Parallax normal map creation, and came up with this.

What do you think?

img221.imageshack.us/img221/395/parallax001rb8.jpg
Page «Previous 1 2