How Slicing Works
The slicing process converts 3D models into a series of 2D layers that can be printed by an MSLA printer.Basic Process
- Model Loading - 3D models (.stl, .obj) are loaded and converted into triangle meshes
- Layer Calculation - The slicer determines how many layers are needed based on the slice height and model bounds
- Plane Intersection - Each layer is generated by intersecting a horizontal plane with the model’s triangles
- Rasterization - The vector intersections are converted into pixels at the printer’s resolution
- Encoding - Layers are compressed using run-length encoding to minimize file size
The uncompressed data for a high-resolution print can easily exceed 30GB. Mslicer compresses layers as they are generated to keep memory usage low.
Acceleration Structures
Mslicer uses two key acceleration structures to achieve fast slicing performance:1D Segments (Primary Acceleration)
The primary acceleration structure splits the mesh into segments along the Z-axis. Instead of testing every triangle in the mesh for each layer, only triangles that overlap the current layer height are tested. Implementation details (slicer/src/geometry/segments_1d.rs:18):
- Divides the mesh into 100 vertical segments by default
- Each segment contains references to triangles that overlap that height range
- Transformed vertex positions are cached for faster access
- Significantly reduces the number of intersection tests per layer
Without Segments
Must test all triangles for every layerTime complexity: O(layers × triangles)
With Segments
Only tests relevant triangles per layerTime complexity: O(layers × triangles/100)
BVH (Bounding Volume Hierarchy)
The BVH acceleration structure is used for ray-mesh intersections, including:- Support generation and routing
- Overhang detection
- Manual support placement
- Viewport picking
slicer/src/geometry/bvh/mod.rs:24):
- Hierarchical tree structure of bounding boxes
- Leaf nodes contain up to 8 triangles each
- Built automatically when models are loaded
- Enables fast ray casting for support generation
Rasterization Algorithm
The rasterization converts vector line segments into pixels at the printer’s resolution.Scanline Filling
For each row of pixels (slice_raster.rs:56):
- Find all line segments that cross the current row
- Calculate the X position where each segment intersects
- Sort intersections by X position
- Use depth tracking to handle overlapping models
- Generate runs of white pixels between intersection pairs
The depth tracking system prevents cavities when models overlap or self-intersect, ensuring solid prints.
Multi-threaded Processing
Slicing is fully parallelized using Rayon for maximum performance. Parallel layer generation (slice_raster.rs:30):
CPU Utilization
All CPU cores are utilized during slicing for maximum throughput
Memory Efficient
Layers are compressed immediately after generation
Supported Output Formats
Mslicer supports multiple output formats:| Format | Extension | Description | Remote Print |
|---|---|---|---|
| GOO | .goo | Elegoo format for Saturn/Mars printers | ✓ |
| CTB | .ctb | Chitubox format (widely compatible) | ✓ |
| NanoDLP | .zip | NanoDLP format | ✗ |
| SVG | .svg | Vector output for debugging | ✗ |
Performance Characteristics
Mslicer is designed to be extremely fast:- Typical slicing time: 2-10 seconds for most models
- Large models (1M+ triangles): 10-30 seconds
- Memory usage: ~100-500MB during slicing
- Output file size: 50-500MB depending on resolution and layer count
As noted in the getting started guide: “mslicer is the fastest MSLA slicer currently available” according to the developer’s benchmarks.
Starting a Slice Operation
To slice your models:- Configure your printer settings in the Slice Config panel
- Load your models and position them on the build plate
- Press Slice in the top bar or use Ctrl+R
- Wait for the operation to complete (usually just a few seconds)
- Review the preview and save or send to your printer
Related Topics
Slice Preview
Navigate and inspect sliced layers
Model Management
Position and transform models before slicing