ImageTexture3D
GPU volume texture built from separate slice images.
ImageTexture3D creates a volume from Image slices. It is not Texture2DArray: depth is the volume third coordinate. Create sets format and dimensions, Update uploads a complete compatible set, and GetData reads separate images. Editing readback Images alone does not update the GPU.
Without mipmaps supply depth images of width×height. Mipped data is level-major; each next level halves width, height and depth with integer truncation, minimum 1. A 4×4×4 volume therefore needs 4 + 2 + 1 images. Do not GenerateMipmaps on individual slices instead of preparing the volume chain.
The checked helper below creates a simple RGBA8 volume without mipmaps: each Color fills one Z slice. The caller owns the returned resource. This demonstrates data structure rather than graphics quality.
using System;
using Reckfell;
public static class VolumeSlices
{
// Each color fills one Z slice. This creates a volume without mipmaps.
public static ImageTexture3D CreateSolid(int width, int height, params Color[] colors)
{
if (width <= 0 || height <= 0)
throw new ArgumentOutOfRangeException(nameof(width), "Positive dimensions required.");
ArgumentNullException.ThrowIfNull(colors);
if (colors.Length == 0)
throw new ArgumentException("At least one Z slice required.", nameof(colors));
var slices = new Reckfell.Collections.Array<Image>();
try
{
foreach (var color in colors)
{
var image = Image.CreateEmpty(width, height, false, Image.Format.Rgba8);
image.Fill(color);
slices.Add(image);
}
var texture = new ImageTexture3D();
var result = texture.Create(Image.Format.Rgba8, width, height, colors.Length, false, slices);
if (result == Error.Ok) return texture;
texture.Dispose();
throw new InvalidOperationException($"Texture creation failed: {result}");
}
finally
{
foreach (var image in slices) image.Dispose();
slices.Clear();
}
}
}An ordinary volume and a cubic mip chain were checked through independent binary reload. However, saving 1×1×4 with mipmaps reloads as 1×1×7 without mipmaps: internal _Images infers levels only from width/height changes. This defect was reproduced and not fixed in the engine; verify dimensions and HasMipmaps after loading.
Resource operations were checked in Windows Forward+/Vulkan. Fog, particle and shader use, all formats/shapes and memory limits were not established in this run.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
ImageTexture3DConstructor
public ImageTexture3D();Creates an uninitialized volume resource. Default metadata is 1×1×1, L8, without mipmaps; this does not prove pixels were uploaded. Call Create first. Obtaining a RID can create a placeholder and does not replace initialization.
Properties1
_ImagesProperty
public Reckfell.Collections.Array<Image> _Images { get; set; }Internal stored serialization property. The getter reads slices; the setter infers dimensions and mipmaps from image sizes. Use Create/GetData/Update in ordinary code. Confirmed limitation: a saved 1×1×4 mipped volume reloads as 1×1×7 without mipmaps because every slice has identical width/height and the setter misses depth-only reduction. Do not rely on automatic resource persistence for that shape: retain explicit dimensions/flag and reconstruct through Create using correct data, checking the result.
Methods2
CreateError
public Error Create(Image.Format format, int width, int height, int depth, bool useMipmaps, Reckfell.Collections.Array<Image> data);Creates or replaces a volume texture. Without mipmaps supply exactly depth nonempty Images of the same format and width×height dimensions. With mipmaps supply all levels as separate slices: 4×4×4 needs four 4×4, two 2×2 and one 1×1 image. Each Image must lack its own mipmap chain. Check Error and the log; do not use this as a universal validator for arbitrary arrays. A valid replacement preserves the RID; failed-request atomicity is not guaranteed.
| Name | Type | Default |
|---|---|---|
format | Image.Format | — |
width | int | — |
height | int | — |
depth | int | — |
useMipmaps | bool | — |
data | Reckfell.Collections.Array<Image> | — |
formatCommon Image.Format for every slice; the example was checked with Rgba8.
widthPositive base-level width in texels.
heightPositive base-level height in texels.
depthPositive base-level Z-slice count, not total mip-image count.
useMipmapsWhether data contains the complete volume mip chain; levels are not generated automatically.
dataOrdered nonempty Images without their own mipmaps: all level-0 Z slices, then level 1 and onward to 1×1×1 when mipmaps are enabled.
ErrorCreate result Error; also inspect diagnostics and resulting texture properties.
Updatevoid
public void Update(Reckfell.Collections.Array<Image> data);Uploads a complete new slice set into an initialized volume, retaining format, dimensions and mipmap configuration. Supply the same ordering and image count required by Create for the current volume. This is not arbitrary single-Z-slice updating or automatic resizing. The method is void; inspect diagnostics rather than a returned Error.
| Name | Type | Default |
|---|---|---|
data | Reckfell.Collections.Array<Image> | — |
dataOrdered nonempty Images without their own mipmaps: all level-0 Z slices, then level 1 and onward to 1×1×1 when mipmaps are enabled.