# Normal Map (HLSL)

## Recommended Posts

VitaliBR    147
I have a map made in 3DStudio MAX and exported in .x

Some objects of the map are using normal map (bump map)
I have to use the normal map (image) with DirectX 9.c? I can apply for some of the meshes of the .x using HLSL?

##### Share on other sites
Buckeye    10747
Quote:
 I have to use the normal map (image) with DirectX 9.c?

Assuming you mean bump/normal mapping for lighting purposes, bump mapping just changes the way light affects the appearance of an object. You can still render the object without those lighting effects.
Quote:
 I can apply for some of the meshes of the .x using HLSL?

You can render meshes using HLSL. For both bump mapping and object rendering using HLSL, I would suggest Frank Luna's book Introduction to 3D Programming With DirectX 9.0c.. A Shader Approach.

##### Share on other sites
VitaliBR    147
I'm sorry, think expressed myself badly (my english is poor)

I was wondering whether we can apply the normal map in only one object of my mesh (.x)

for example:
In a mesh with a box and a ball, I wanted to apply the normal map just on the ball

Thanks

belfegor    2834

##### Share on other sites
skytiger    294
I do this by using vertex colors

and then lerp(color1, color2, vertexcolor.r)

##### Share on other sites
belfegor    2834
Quote:
 In a mesh with a box and a ball, I wanted to apply the normal map just on the ball

If this mesh is exported "correctly" to have 2 subsets (ball & box)
then you need to do something like:
effect->SetTechnique("tBumpMap");effect->SetMatrix(...);...effect->Begin(0, 0);effect->BeginPass(0)mesh->DrawSubset(0);//assumed that sphere is in first subseteffect->EndPass();effect->End();...effect->SetTechnique("tOtherMaterial");effect->SetMatrix(...);...effect->Begin(0, 0);effect->BeginPass(0)mesh->DrawSubset(1);//assumed that box is in second subseteffect->EndPass();effect->End();

##### Share on other sites
VitaliBR    147
Quote:
Original post by belfegor
Quote:
 In a mesh with a box and a ball, I wanted to apply the normal map just on the ball

If this mesh is exported "correctly" to have 2 subsets (ball & box)
then you need to do something like:
effect->SetTechnique("tBumpMap");effect->SetMatrix(...);...effect->Begin(0, 0);effect->BeginPass(0)mesh->DrawSubset(0);//assumed that sphere is in first subseteffect->EndPass();effect->End();...effect->SetTechnique("tOtherMaterial");effect->SetMatrix(...);...effect->Begin(0, 0);effect->BeginPass(0)mesh->DrawSubset(1);//assumed that box is in second subseteffect->EndPass();effect->End();

Thanks :D
I don't know that you can use through subset