yresolution the texture has a
zresolution as well (turning the pixels into voxels).
Like modern 2D images, the 3D texture files can have any number of image channels with arbitrary vector sizes per pixel.
Unlike 2D images, the 3D texture image has a bounding box. The voxel
(0, 0, 0) is mapped to the
zmin() of the bounding box. The voxel at
(xres-1, yres-1, zres-1) is mapped to the maximum values of the bounding box. Evaluations of the 3D texture have their lookup position transformed to this bounding box.
The Houdini 3D texture format is a tiled format. When reading voxels from the image, only portions of the file need to be loaded into RAM at one time. This makes it possible to read very large images. On the other hand, it means that writing the images can be problematic. Often, the data you want to write to the file is not tiled, which makes it difficult to process.
The 3D texture format can store "tags" in the texture file. These tags are arbitrary and can be used to store auxiliary information. Users can query these tags from VEX using the
To read multiple channels, the best approach is to have an IMG3D_Manager for each channel to be read.
IMG3D_Manager::getCorner() // Get the corner of the bounding box IMG3D_Manager::getSize() // Get the size of the bounding box IMG3D_Manager::getRes() // Get the resolution of the image IMG3D_Manager::getNChannels() // Return number of image channels IMG3D_Manager::getChannelName() // Query the name of the channel IMG3D_Manager::getChannelSize() // Return the number of floats in a channel IMG3D_Manager::getChannelNumber() // Look up channel index based on name
resultbuffer should be able to store 3 floats.
In addition, it's possible to load an entire channel at one time by calling IMG3D_Manager::loadUntiledChannel().
However, in many cases, it isn't feasible to fill a texture in random order. So, like the IMG3D_Manager::loadUntiledChannel(), it's possible to create a 3D texture with a flat image by calling IMG3D_Manager::fillUntiledTexture().
To create an 3D texture, you must first call IMG3D_Manager::createTexture(). This specifies the bounding box, resolution and a compression.
Once the 3D texture has been created, you can call either:
The sample file standalone/i3dsphereC shows a very simple example of creating a 3D texture.