Sign in to follow this  

Saving down textures to files

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

Hi all programmer buddies out there. I am in the middle of painting textures in my editor, so that I can paint out grass here I want and shit like that. Well, that is just working wonderful, and I am just finished with the last bit of perfection :P. Well, now then I got the texture painting up and running, I want to save it down to a texture file, so that I can save the editormap, and open it up later. So, I got three questions for you: Question 1: After creating the texture with D3DXCreateTexture() in the program I paint some in it to create some gras on my map. Now I want to save it down to say a .dds texture file that dosnt exist there in the first place. Someone got either a tutorial or have a greate way of telling how to do this I would be very thankful. Question 2: Well, my textures that I paint out includes a color map, a normal map and a specular map. (Beginning to wonder if the normal map is necessery). Well, apart from that, this means a lot of textures going in to the shader. Say I am using 6 types of different textures, it means 6 color, 6 specular, 6 normal, and on top of that 6 alpha textures that says where the textures are going to be painted out, and how much. Well, that is for all you math geinius out there 24 textures that is going out there, and that is A LOT. So here I got another two questions for you :D. Question 2.1: Is it possible to create structs and send them into shaders, like if I want to send all the part-textuers in variable, like this:
//header
struct Textures
{
    LPDIRECT3DTEXTURES m_Color;
    LPDIRECT3DTEXTURES m_Normal;
    LPDIRECT3DTEXTURES m_Specular;
    LPDIRECT3DTEXTURES m_Alpha;
};

//cpp
//The Textures variable filled with 4 different textures

    Textures m_TextureSample;
    TheEffect->(Sending in the m_TextureSample);


Question 2.2: First, I must apologies for asking this question, cause I have asked this question in another thread, but I did not get a satisfying answer there, so I'm asking it again. Well, another ide i got is to clamp all of this textures in one big texture, and in the shaders then modify the texcoord so that the shader get the right value from the right place. The big texture would look something like this: ----------------- | Color | Normal | ----------------- |Specular|Alpha | ----------------- I have tried to get this one working, but either the tiling skrews up, or the shader throws around the diffrent vaules like it wants, putting the normalmap as a color map, and my colormap, describes how my alpha is working :D So, if you have done it before, or know how to do this, I guess would be that this would be the least painful for the fillrate, and then to my FPS to. Well, there you have something to think about :P PS: BTW, greate community you got going here. Have just been around here for a month or two, and this is now my favorit place on the internet :D [Edited by - CAPE on March 26, 2007 8:46:47 AM]

Share this post


Link to post
Share on other sites
Yeah, just you think how many greate functions there is in DirectX :D.

Well, thanks, that did the trick, who had figured ;P

Share this post


Link to post
Share on other sites
Sign in to follow this