Data3DTexture is the built-in volume texture type for voxel data, density fields, and procedural 3D color volumes.
import io.materia.core.math.Color
import io.materia.core.scene.Mesh
import io.materia.geometry.primitives.BoxGeometry
import io.materia.material.MeshBasicMaterial
import io.materia.texture.Data3DTexture
val volume = Data3DTexture.createNoise(
width = 32,
height = 32,
depth = 32,
seed = 42,
amplitude = 1f
)
val material = MeshBasicMaterial().apply {
color = Color.WHITE
map = volume
}
// A 2x2x2 box keeps local positions in the [-1, 1] range used by the built-in volume sampler.
val mesh = Mesh(BoxGeometry(2f, 2f, 2f), material)
scene.add(mesh)
Data3DTexture as a real GPU 3D texture and samples it in the fragment shader.Data3DTexture as a real Vulkan 3D image and samples it in the fragment shader.volume-texture example is examples/volume-texture-ios-app/MateriaVolumeTextureDemo.xcodeproj, which packages the generated JS/WebGL build inside a native iOS / Mac Catalyst shell because the native Apple RendererFactory path for this API is still stubbed../gradlew :examples:volume-texture:runJvm./gradlew :examples:volume-texture:jsBrowserRun./gradlew :examples:volume-texture-android:runAndroidopen examples/volume-texture-ios-app/MateriaVolumeTextureDemo.xcodeprojThe shared VolumeTextureExample still uses the older root RendererFactory API. On Apple platforms, that renderer path does not yet draw scene content natively, so the current Apple run path is the wrapper app at examples/volume-texture-ios-app/.
That Xcode project rebuilds the JS bundle during app builds and loads it through WKWebView on iOS and My Mac (Mac Catalyst), which keeps the shared Data3DTexture scene runnable on both Apple targets while the native renderer catches up.
The current Android wrapper renders the shared volume-texture scene through the Filament/OpenGL fallback path.

The built-in material path samples MeshBasicMaterial.map = Data3DTexture from centered local mesh coordinates:
sampleCoord = clamp(localPosition * 0.5 + 0.5, 0.0, 1.0)
That means geometry centered around the origin and spanning roughly [-1, 1] on each axis gives the most intuitive results.
MeshBasicMaterial.map.