• Advertisement

Archived

This topic is now archived and is closed to further replies.

D3DXComputeNormalMap problem

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Has anyone used this function? The function fails (FAILED(hr))==true and I keep getting just a black texture. Have I missed something obvious?
IDirect3DTexture8 * heightMap;
IDirect3DTexture8 * normalMap;

hr=D3DXCreateTextureFromFile(d3dDevice, "data/height.bmp", &heightMap);

hr=d3dDevice->CreateTexture(100, 100, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &normalMap);
	
hr=D3DXComputeNormalMap(normalMap, heightMap, NULL, 0, D3DX_CHANNEL_RED, 10.0f);
	    

Share this post


Link to post
Share on other sites
Advertisement
It probally failed because your height map was a different ressolution then your normal map. Check the debug spew. With


Also, your normal map is non pow2. Most cards don''t like this. Try creating a texture of the same size. You can figure the size of the loaded texture by doing a GetSurfaceDesc on the First detail leve. Use the width and height parameters to verify this.

Share this post


Link to post
Share on other sites

  • Advertisement