Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to create a 3D Texture?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Roziks_World   Members   -  Reputation: 122

Like
0Likes
Like

Posted 04 March 2009 - 12:52 AM

Hello everyone, i am trying to figure out how to create and use 3D textures. I am using a Texture atlas for my terrain textures which are spread over the whole terrain. For the detail-textures i would like to use a 3d texture where each level has one texture without mip-maps since the detail textures wont be shown in the distance anyways. I guess once i loaded the 3D texture and set it for the texture state i can just sample it with tex2D() and set the uv.w coordinate to the texture i want. What i don't know how to do though is how i would create such a Texture? If anyone had some hints for me it would really be great! Thx a lot in advance!

Sponsor:

#2 Evil Steve   Members   -  Reputation: 1982

Like
0Likes
Like

Posted 04 March 2009 - 01:04 AM

IDirect3DDevice9::CreateVolumeTexture.

As for getting data into it, you'd usually load multiple 2D textures and Lock and fill each layer of the volume texture. There's no D3DXCreateVolumeTextureFrom*() functions or anything.

EDIT: I'm talking bollocks. There's D3DXCreateVolumeTextureFromFile

[Edited by - Evil Steve on March 4, 2009 7:04:36 AM]

#3 Roziks_World   Members   -  Reputation: 122

Like
0Likes
Like

Posted 04 March 2009 - 01:11 AM

Oh thx a lot:-)

I actually thought there was a tool or something like the atlas-tool that created a .dds file that includes all the textures.

So i just load every 2D Texture and add it to the 3D texture. Fair enough.

Thx again



#4 Evil Steve   Members   -  Reputation: 1982

Like
0Likes
Like

Posted 04 March 2009 - 01:15 AM

Quote:
Original post by Roziks_World
Oh thx a lot:-)

I actually thought there was a tool or something like the atlas-tool that created a .dds file that includes all the textures.

So i just load every 2D Texture and add it to the 3D texture. Fair enough.

Thx again
Actually, the DirectX texture tool can create a volume texture in a .dds file, but I've no idea how you'd get the volume texture out of the dds file without manually parsing the file.

EDIT: As per my above edit, I'm talking out of my arse. There's D3DXCreateVolumeTextureFromFile which will do the job adequately.

#5 Roziks_World   Members   -  Reputation: 122

Like
0Likes
Like

Posted 04 March 2009 - 01:23 AM

Awesome!

Thx Steve:-)

#6 Roziks_World   Members   -  Reputation: 122

Like
0Likes
Like

Posted 04 March 2009 - 06:25 AM

Ok i tried this now and i am having a little problem:-)

What i did is this: I created two textures and used to D3D Texture Tool to create a Volume Texture out of the two like described here: http://msdn.microsoft.com/en-us/library/bb219744(VS.85).aspx

then i load the texture with D3DXCreateVolumeTextureFromFile

and set the texture in the effect.

and in HLSL i try to sample the texture like this to ge the first slice:

float3 c0 = tex3D(Tex0S, float3(tiledTexC.x, tiledTexC.y, 1.0)).rgb;

But what i get is all slices blended together.

Anyone know how i acces each slice of the volume texture independently?
Thx again:-)


EDIT:

Found the problem. If anyone cares to know. I had to set the Addressmodes in the sampler to u = rwarapping v = wrapping and w=border and disable mipmaps.

[Edited by - Roziks_World on March 5, 2009 2:25:04 AM]




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS