Skip to main content
gamedev.net
🔒 Locked

D3DXComputeNormalMap problem

Started by bakery2k1 Jan 16, 2002 at 6:52 AM 0 replies 500+ views
Original Post
bakery2k1
bakery2k1
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);
	    
EvilDecl81
EvilDecl81
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.
EvilDecl81

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.