There, I had attached the FX file at the source section for my bump + spec mapping. I will briefly explain how to use it.
What you need:
1. a diffuse texture - this is basically the main texture that determines how the model look like. It more commonly to known as just texture map (I follow the term diffuse texture as stated in MAX).
2. a normal map texture - this texture is maily used for bump mapping. Every pixel in this texture are the normal vector of the model. Each RGB channel of each pixel in this texture correspond to each XYZ component of the normal vector. To create normal map manually is somewhat involved. Generally, I would create a grayscale heightmap and use the NVidia plugin for Photoshop to convert it into normal map.
3. a specular map texture - this is a gray scale texture that determines the surface specularity of the model. Full white indicates full specularity, and pure black means no specularity. For example, if you had a brickwall with a marble patch in the middle. The portion that made of bricks might have less specularity specified in the specular map, compare to the marble patch.
Instruction:
1. Load your model via LOAD OBJECT.
2. To specified the three different textures stated above on your model, there are two ways:
METHOD A:
=========
- call TEXTURE OBJECT objNo, txtLvl, txtMap
with txtLvl as 0, txtMap point to your loaded diffuse map,
txtLvl as 1, txtMap point to your loaded normal map,
txtLvl as 2, txtMap point to your loaded specular map.
For example:
LOAD OBJECT "sphere.x", 10
LOAD IMAGE "diff.tga", 100
LOAD IMAGE "norm.tga", 101
LOAD IMAGE "spec.tga", 102
TEXTURE OBJECT 10, 0, 100
TEXTURE OBJECT 10, 1, 101
TEXTURE OBJECT 10, 2, 102
METHOD B:
=========
- Hard code the filename of the three texture maps in the FX file.
- At line 5, 6, and 7, modify the filename into your diffuse, normal, and spec map filename respectively.
Personally, I prefer METHOD A, since it makes my FX file more reusable, although there is more code need to be written in your DBpro source file.
3. call LOAD EFFECT "bumpspec.fx", fxNum, flag
bumpspec.fx will be my bump + spec FX file.
fxNum will be any integer greater than zero serve as a reference index to the loaded effect.
flag must set to 0 if you choose METHOD A in previous step, otherwise set to 1 if you choose METHOD B.
4. SET OBJECT EFFECT objNum, fxNum
where objNum is the reference index to your object, and fxNum is as stated in step 3.
Voila! Now you got the cool bump + spec map effect as the screenshot shows. Nifty eh?
Hoped this is detail enough.
Good luck!
Bad Nose Entertainment - Where games are forged from the flames of talent and passion.
http://www.badnose.com/