- Qt 6.6
- Qt Graphs
- QML Types
- QtGraphs (Technical Preview)
- Custom3DVolume
- Qt Graphs | Commercial or GPLv3

# Custom3DVolume QML Type

Adds a volume rendered object to a graph. More...

Import Statement: | import QtGraphs 6.6
Instantiates: | QCustom3DVolume
Inherits: | Custom3DItem
Status: | Technical Preview

- List of all members, including inherited members

## Properties

- alphaMultiplier : real
- drawSliceFrames : bool
- drawSlices : bool
- preserveOpacity : bool
- sliceFrameColor : color
- sliceFrameGaps : vector3d
- sliceFrameThicknesses : vector3d
- sliceFrameWidths : vector3d
- sliceIndexX : int
- sliceIndexY : int
- sliceIndexZ : int
- textureDepth : int
- textureHeight : int
- textureWidth : int
- useHighDefShader : bool

## Detailed Description

A volume rendered object is a box with a 3D texture. Three slice planes are supported for the volume, one along each main axis of the volume.

Rendering volume objects is very performance intensive, especially when the volume is largely transparent, as the contents of the volume are ray-traced. The performance scales nearly linearly with the amount of pixels that the volume occupies on the screen, so showing the volume in a smaller view or limiting the zoom level of the graph are easy ways to improve performance. Similarly, the volume texture dimensions have a large impact on performance. If the frame rate is more important than pixel-perfect rendering of the volume contents, consider turning the high definition shader off by setting the useHighDefShader property to `false`.

Note: Filling in the volume data would not typically be efficient or practical from pure QML, so properties directly related to that are not fully supported from QML. Create a hybrid QML/C++ application if you want to use volume objects with a Qt Quick UI.

Note: Volumetric objects are only supported with orthographic projection.

Note: Volumetric objects utilize 3D textures, which are not supported in OpenGL ES2 environments.

See also AbstractGraph3D::orthoProjection and useHighDefShader.

## Property Documentation

alphaMultiplier : real

The alpha value of every texel of the volume texture is multiplied with this value at the render time. This can be used to introduce uniform transparency to the volume. If preserveOpacity is `true`, only texels with at least some transparency to begin with are affected, and fully opaque texels are not affected. The value must not be negative. Defaults to `1.0`.

See also preserveOpacity.

drawSliceFrames : bool

If this property value is `true`, the frames of slices indicated by slice index properties will be drawn around the volume. If it is `false`, no slice frames will be drawn. Drawing slice frames is independent of drawing slices, so you can show the full volume and still draw the slice frames around it. Defaults to `false`.

See also sliceIndexX, sliceIndexY, sliceIndexZ, and drawSlices.

drawSlices : bool

If this property value is `true`, the slices indicated by slice index properties will be drawn instead of the full volume. If it is `false`, the full volume will always be drawn. Defaults to `false`.

Note: The slices are always drawn along the item axes, so if the item is rotated, the slices are rotated as well.

See also sliceIndexX, sliceIndexY, and sliceIndexZ.

preserveOpacity : bool

If this property value is `true`, alphaMultiplier is only applied to texels that already have some transparency. If it is `false`, the multiplier is applied to the alpha value of all texels. Defaults to `true`.

See also alphaMultiplier.

sliceFrameColor : color

The color of the slice frame. Transparent slice frame color is not supported.

Defaults to black.

See also drawSliceFrames.

sliceFrameGaps : vector3d

The size of the air gap left between the volume itself and the frame in each dimension. The gap can be different on different dimensions. The values are fractions of the volume thickness in the same dimension. The values cannot be negative.

Defaults to `vector3d(0.01, 0.01, 0.01)`.

See also drawSliceFrames.

sliceFrameThicknesses : vector3d

The thickness of the slice frames for each dimension. The values are fractions of the volume thickness in the same dimension. The values cannot be negative.

Defaults to `vector3d(0.01, 0.01, 0.01)`.

See also drawSliceFrames.

sliceFrameWidths : vector3d

The widths of the slice frame. The width can be different on different dimensions, so you can for example omit drawing the frames on certain sides of the volume by setting the value for that dimension to zero. The values are fractions of the volume thickness in the same dimension. The values cannot be negative.

Defaults to `vector3d(0.01, 0.01, 0.01)`.

See also drawSliceFrames.

sliceIndexX : int

The x-dimension index into the texture data indicating which vertical slice to show. Setting any dimension to negative indicates no slice or slice frame for that dimension is drawn. If all dimensions are negative, no slices or slice frames are drawn and the volume is drawn normally. Defaults to `-1`.

See also QCustom3DVolume::textureData, drawSlices, and drawSliceFrames.

sliceIndexY : int

The y-dimension index into the texture data indicating which horizontal slice to show. Setting any dimension to negative indicates no slice or slice frame for that dimension is drawn. If all dimensions are negative, no slices or slice frames are drawn and the volume is drawn normally. Defaults to `-1`.

See also QCustom3DVolume::textureData, drawSlices, and drawSliceFrames.

sliceIndexZ : int

The z-dimension index into the texture data indicating which vertical slice to show. Setting any dimension to negative indicates no slice or slice frame for that dimension is drawn. If all dimensions are negative, no slices or slice frames are drawn and the volume is drawn normally. Defaults to `-1`.

See also QCustom3DVolume::textureData, drawSlices, and drawSliceFrames.

textureDepth : int

The depth of the 3D texture defining the volume content in pixels. Defaults to `0`.

Note: Changing this property from QML is not supported, as the texture data cannot be resized accordingly.

textureHeight : int

The height of the 3D texture defining the volume content in pixels. Defaults to `0`.

Note: Changing this property from QML is not supported, as the texture data cannot be resized accordingly.

textureWidth : int

The width of the 3D texture defining the volume content in pixels. Defaults to `0`.

Note: Changing this property from QML is not supported, as the texture data cannot be resized accordingly.

useHighDefShader : bool

If this property value is `true`, a high definition shader is used to render the volume. If it is `false`, a low definition shader is used.

The high definition shader guarantees that every visible texel of the volume texture is sampled when the volume is rendered. The low definition shader renders only a rough approximation of the volume contents, but at a much higher frame rate. The low definition shader does not guarantee every texel of the volume texture is sampled, so there may be flickering if the volume contains distinct thin features.

Note: This value does not affect the level of detail when rendering the slices of the volume.

Defaults to `true`.