Jump to content
  • Advertisement

Archived

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

SoaringTortoise

SaveTextureToFile doesn't work with Bump maps

This topic is 5526 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

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


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 PALETTEENTRY
Dim rectTmp As RECT
rectTmp.Right = 128
rectTmp.bottom = 128

d3dx.SaveSurfaceToFile APP_CACHE & "\rooms\test.bmp", D3DXIFF_BMP, surfaceTarget, pal1, rectTmp


I based the above on this article ["http://www.mvps.org/vbdx/articles/screenshot/"].

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


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!