Overview
The 3D system is built around theS3D_CACHE class (source/3d-viewer/3d_cache/3d_cache.h:54), which manages model loading, caching, and rendering. Each footprint can reference multiple 3D models.
3D Architecture
S3D_CACHE Class
Model Association
Footprints reference 3D models:Each footprint can have multiple 3D models. For example, a connector might have separate models for the housing and pins.
Supported Formats
- STEP (.step, .stp)
- VRML (.wrl)
Recommended format for mechanical design:
- Industry standard CAD format
- Precise dimensional data
- Supports complex assemblies
- Best for mechanical integration
- Can be exported for enclosure design
Adding 3D Models to Footprints
3D Model Organization
Standard Library Structure
KiCad’s 3D model library is organized by package type:Custom Model Paths
Add project-specific models:Path Resolution
The filename resolver handles path variables:3D Viewer Features
Rendering Options
Realistic Mode
Photorealistic rendering with materials and lighting
Raytrace Mode
Advanced rendering with shadows and reflections
Orthographic
Flat projection without perspective
Perspective
3D perspective view
Layer Visibility
Control which board layers are shown:- Copper layers: F.Cu, B.Cu, Inner layers
- Silkscreen: F.SilkS, B.SilkS
- Solder mask: F.Mask, B.Mask (with color/transparency)
- Substrate: PCB material color and thickness
- 3D models: Component visibility
Export Options
Export 3D board for mechanical design:- STEP Export
- VRML Export
- Screenshot
File → Export → STEPOptions:
- Include board body
- Include components
- Include virtual components
- Coordinate origin (center or bottom-left)
- Units (mm or inch)
- Enclosure design in CAD software
- Mechanical fit verification
- Manufacturing documentation
Plugin System
The 3D cache uses plugins to load different formats:- STEP/STP (OpenCascade)
- VRML/WRL (native)
- IDF (legacy)
Performance Optimization
Model Caching
The cache stores loaded models in memory:Models are cached until the file is modified. Large boards with many components benefit significantly from caching.
Simplify Complex Models
For better performance:- Use simplified models for common parts
- Remove internal details not visible in assembly
- Reduce polygon count for large models
- Use bounding boxes for mechanical parts
Embedded 3D Models
Embed models directly in footprints:Creating Custom 3D Models
Model Requirements
Choose CAD Software
Use any CAD tool that exports STEP:
- FreeCAD (free, open source)
- Fusion 360 (free for hobbyists)
- SolidWorks, Inventor (professional)
- Blender (with STEP addon)
Model to Scale
Create model in millimeters at 1:1 scale.Match footprint dimensions exactly:
- Pad locations
- Pin pitch
- Body size
- Height above board
Set Origin
Place model origin at:
- Footprint origin (typically pin 1 or center)
- Board surface (Z=0)
Export as STEP
Save as STEP AP214 or AP203 format.Avoid excessive detail:
- Remove threads from screws
- Simplify rounded edges
- Combine small features
Board Materials and Colors
Customize board appearance: Preferences → Preferences → 3D Viewer → Board Colors- Solder mask: Green, blue, red, black, white
- Silkscreen: White, black
- Copper: Copper, gold (ENIG), silver (HASL)
- Substrate: FR4 tan/green
Best Practices
Use Standard Library First
Use Standard Library First
Check KiCad’s 3D model library before creating custom models. Many common packages are already available.
Organize Custom Models
Organize Custom Models
Store project-specific models in a dedicated directory:
Version Control Models
Version Control Models
Track 3D models in version control alongside PCB files. Use Git LFS for large STEP files.
Document Model Sources
Document Model Sources
Keep notes on where custom models came from:
- Manufacturer website
- Created in-house
- Modified from library Include datasheet links in footprint description.
Test Before Manufacturing
Test Before Manufacturing
Use 3D view to verify:
- Component heights for enclosure fit
- Connector alignment for mating parts
- No mechanical collisions
- Proper polarity orientation
Source Code References
Next Steps
PCB Layout
Design boards with 3D visualization
Footprint Libraries
Add models to footprints
Manufacturing Output
Export 3D for mechanical integration