# Normal mapping in DX10

This topic is 3147 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello! I already did normalmapping in DX9, so I know how it works. The problem is, that I don't know, how to get the Tangents. (I've looked at the SDK samples, but I found nothing understandable for me) This is the VertexLayout I use:
const D3D10_INPUT_ELEMENT_DESC BasicVertexLayout[] =
{
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 24, D3D10_INPUT_PER_VERTEX_DATA, 0 },
{ "TANGENT", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 32, D3D10_INPUT_PER_VERTEX_DATA, 0 },
};


Is this right? When I preview the Tangents I get, it is just blue, red, green and so on, but for the whole mesh, nit for the vertices. I think this is not right. ;) Do I have to call a Generate****() function first or what? thx for help! :)

##### Share on other sites
Most mesh files you find won't have tangent/bitangent info in them, and you'll have to generate them yourself. Unfortunately, D3DX10 doesn't have a function to generate them like D3DX9 did. So you have to either...

1. Load up the mesh as an ID3DXMesh using a NULL D3D9 device, generate the tangent frame, and extract the vertex data

2. Use another library like Nvidia's MeshMender

or

3. Write your own routines for doing it

##### Share on other sites
Really? Oh, why did Microsoft do that!?

I think creating a new DX9 device, everytime I load a mesh is very slow.
How do I calculate them myself? Are there any Libs or examples?

##### Share on other sites
It's very simple if you have consistent uv mapping on mesh: http://www.terathon.com/code/tangent.html

##### Share on other sites
Quote:
 Original post by WuTzReally? Oh, why did Microsoft do that!?

With new API versions they've been including less and less in the way of utility classes and functions. It makes sense because these days the native API's are typically the domain of professional game developers, who will typically have their own solutions. It used to be that a lot of students and beginners used the native API, but now they mostly use the XNA Framework.

##### Share on other sites
I think this is a real pity. The ability to get something working quickly using that library was a great way to learn DX9 even if you don't end up using all of it and I personally think it's a big mistake to get rid of it.

I wonder if anyone has written any replacement libraries that work in the same way as the DX9 one? Not a framework, just a nice library of utilities to use or not use as you see fit? If not, I imagine there is a nice open source project there waiting to be started :)

##### Share on other sites
Quote:
 Original post by jbbI think this is a real pity. The ability to get something working quickly using that library was a great way to learn DX9 even if you don't end up using all of it and I personally think it's a big mistake to get rid of it.I wonder if anyone has written any replacement libraries that work in the same way as the DX9 one? Not a framework, just a nice library of utilities to use or not use as you see fit? If not, I imagine there is a nice open source project there waiting to be started :)

I've been working on a DX11 sample framework. It's mostly for my own convenience, but I've been trying to make all of the components separable (unlike DXUT). So far I have a lot of basics...a sprite renderer, a camera, a bitmap font texture generator, a mesh class (it loads the SDKmesh format), and a few other convenience classes. It's not finished yet, but it should be ready pretty soon. If it's something you're interested I wouldn't mind posting what I have so far so you could start using some of it or provide some suggestions. Or if there's anything in particular that you think would be useful, let me know.

1. 1
2. 2
Rutin
25
3. 3
4. 4
5. 5

• 10
• 13
• 19
• 14
• 9
• ### Forum Statistics

• Total Topics
632942
• Total Posts
3009343
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!