Re: XNA Framework what is best way to render scene with great number of textures?
Kyle0654
I figured you might have some problems with 3D textures - I know I did
the first time I tried using them. Here's a bit of code I ended up
using to get Texture3D creation to
work:
// Set up the
texture
3DTexture = new Texture3D(device, sizex, sizey,
sizez, 1, ResourceUsage.AutoGenerateMipMap,
SurfaceFormat.Color);
3DTexture.SetData(0, 0,
0, size, size, 0, size, byteData, 0, byteData.Length,
SetDataOptions.None);
Note that I
specified AutoGenerateMipMap. It's the only creation method I've been
able to get to work, but it will not automatically generate a mipmap -
you have to generate mipmaps yourself if you want to. However, for
your purposes, I'm sure you won't want mipmaps (you'll want to make
sure your shader knows this). If you wanted to use mipmaps, you'd need
to do something like multiplying the depth by how many levels of detail
you wanted, and then including that many of each texture on the first
level (so when you get to the lowest level you'll still be sampling the
single texture, but at a lower resolution).
Hope
that helps. I didn't change any parameters on the device or anything
(that I can remember), so you shouldn't need to.