- Home /
Texture3D get pixel question
I am wondering about the scripting api (x, y, z) coordinates and mip level of a texture. Can someone explain whether it refers to how many pixels there are in the x direction, y direction and z direction? Or does it actually refer to the closest point? I am trying to find a way to get the color of a voxel in a texture at various points. Thanks!
Answer by Namey5 · Mar 21, 2021 at 10:03 AM
I'm not sure what you mean by 'closest point', but yes the pixel methods for a Texture3D work the same as the other dimensional equivalents; pixels-per-axis. So in this case;
// x = horizontal axis
// y = vertical axis
// z = depth
tex3D.GetPixel (x, y, z, 0);
As for the mip level - a texture can have multiple mipmaps (smaller copies of the main texture) for performance reasons when sampling the full resolution texture isn't necessary. If you want just the raw pixel data from a texture then you should always use a mip level of 0.
Your answer
![](https://koobas.hobune.stream/wayback/20220613030931im_/https://answers.unity.com/themes/thub/images/avi.jpg)