Color32 GetPixel3D( float x, float y, float z, int mip )

book_4_sparkGenerated
code_blocksInput

Description

The GetPixel3D method retrieves the color of a specific pixel from a 3D texture at the given coordinates and mip level. This method is useful for accessing individual pixel data in a 3D texture, which can be used for various purposes such as texture analysis or manipulation.

Usage

To use the GetPixel3D method, you need to provide the x, y, and z coordinates of the pixel you want to access, as well as the mip level of the texture. The method returns a Color32 object representing the color of the specified pixel.

Ensure that the coordinates and mip level are within the valid range of the texture dimensions and mip levels to avoid errors.

Example

// Assuming 'texture' is an instance of Sandbox.Texture
float x = 0.5f; // X coordinate in normalized space (0.0 to 1.0)
float y = 0.5f; // Y coordinate in normalized space (0.0 to 1.0)
float z = 0.5f; // Z coordinate in normalized space (0.0 to 1.0)
int mipLevel = 0; // Mip level to sample from

Color32 pixelColor = texture.GetPixel3D(x, y, z, mipLevel);

// Use pixelColor as needed, e.g., logging or processing