#### Archived

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

# SaveTextureToFile doesn't work with Bump maps

## Recommended Posts

Hody, I''ve got a program that generates a bump-map from a height map on load. The problem is that this program is very slow. So, what I''m doing is telling the program to try and load from a file, but if it can''t then generate the bump map and save it to a file so that the next time the program runs... voila! Anyhow, when the program generates the bump map it all looks perfect in the game. When it loads it from the file, everything is considerably darker and doesn''t appear to have much bump even though viewing the bump-map in DXTex it looks like a valid bump. I''m saving it as A8R8G8B8 (the same format as the bump map I create from the height map). I can find no documentation anywhere for this function, so if anyone has used it with any success or knows where I may be going wrong, please let me know. The only bit that I''m not sure of is the PaletteEntry type that gets passed. I''ve tried using 0,0,0,0 as well as 255,255,255,255 but neither seems to make a difference.

##### Share on other sites
Actually, scrap that. It doesn''t work at all. I''ve tyaken the next logical step and tried to save a normal texture (grass), but it doesn''t work. Just comes out looking like whatever I put into the palette_entry.

Any help at all would be cool.

##### Share on other sites
Hi Soaring-

I think that the savetexturetofile function works like the savesurfacetofile function (which isn''t documented either). Whenever I''ve used the savesurfacetofile function, I just declare a palletteentry structure and pass that into the function unfilled.

For example:
Dim pal1 As PALETTEENTRYDim rectTmp As RECTrectTmp.Right = 128rectTmp.bottom = 128d3dx.SaveSurfaceToFile APP_CACHE & "\rooms\test.bmp", D3DXIFF_BMP, surfaceTarget, pal1, rectTmp

This doesn''t explain why the function should not work for you though -- setting all of a palletteentry''s structure to zero should be the same as just declaring it and passing it empty.

What if instead of using savetexturetofile, you were to get the surface associated with the level of the texture that you want to save and then try to save that surface with savesurfacetofile?

I hoep this helps-

BM

I hope this helps-

BM

##### Share on other sites
Hmmm... I''ll give that a try, sounds like at least a different track to follow. Thanks bmoberly.

• ### Forum Statistics

• Total Topics
628402
• Total Posts
2982470

• 9
• 10
• 9
• 19
• 24