Volumetric Rendering
High-performance volumetric data visualization with advanced rendering techniques and interactive controls.
Features
Ray Casting
Accurate volume rendering using ray casting
Transfer Functions
Customizable color and opacity mapping
Isosurfaces
Interactive isosurface extraction and rendering
Slice Views
Orthogonal slice visualization
Configuration
interface VolumeConfig {
data: Float32Array; // Volume data
dimensions: [number, number, number]; // Volume dimensions
spacing: [number, number, number]; // Voxel spacing
transferFunction?: { // Transfer function settings
color: string; // Base color
opacity: number; // Base opacity
gradient?: string; // Color gradient
isovalue?: number; // Isosurface value
};
rendering?: { // Rendering settings
quality: 'low' | 'medium' | 'high';
samples: number; // Ray samples
ambient: number; // Ambient light
diffuse: number; // Diffuse light
};
}
Methods
setVolume
Sets volume data and configuration
setVolume(config: VolumeConfig): void
updateTransferFunction
Updates transfer function settings
updateTransferFunction(options: Partial<TransferFunction>): void
setSlice
Sets slice view parameters
setSlice(axis: 'x' | 'y' | 'z', position: number): void
extractIsosurface
Extracts isosurface at specified value
extractIsosurface(value: number): Promise<Mesh>
Example
// Create volume renderer
const volume = new VolumeRenderer(viewer);
// Set up volume data
volume.setVolume({
data: volumeData,
dimensions: [256, 256, 256],
spacing: [1, 1, 1],
transferFunction: {
color: '#00ff00',
opacity: 0.8,
gradient: 'rainbow'
},
rendering: {
quality: 'high',
samples: 256,
ambient: 0.2,
diffuse: 0.8
}
});
// Update transfer function
volume.updateTransferFunction({
isovalue: 0.5,
opacity: 0.9
});
// Extract isosurface
const mesh = await volume.extractIsosurface(0.5);
Related Features
Learn more about other features: