Sign in to follow this  
WuTz

Normal mapping in DX10

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by WuTz
Really? 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 this post


Link to post
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 this post


Link to post
Share on other sites
Quote:
Original post by jbb
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 :)


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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this