A web-based 3D model viewer and converter that supports loading, viewing, editing, and converting between multiple 3D file formats. Features an intuitive interface with advanced transformation tools, undo/redo functionality, and multi-model support.
- Multi-Model Loading: Support for GLB, STL, USDZ, FBX, and IFC file formats with simultaneous loading
- Interactive 3D Viewer: Full 3D navigation with orbit controls, camera positioning, and navigation gizmo
- Format Conversion: Convert models to GLB, GLTF, OBJ, STL, USDZ, and PLY formats
- Transform Tools: Translate, rotate, and scale models with visual gizmos
- Undo/Redo System: Full command history with Ctrl+Z/Ctrl+Y keyboard shortcuts (up to 25 operations)
- Multi-Model Management: Load and organize multiple models in a scene tree view
- Model Selection: Click to select individual models, with multi-selection support
- Scene Composition: Visual tree view showing all loaded models with expand/collapse functionality
- Drag & Drop: Direct file dropping onto the viewer
- Real-time Feedback: Loading progress and status updates
- Error Handling: Comprehensive error messages and graceful degradation
- Responsive Interface: Clean, modern UI that adapts to different screen sizes
The application follows a modular architecture with clear separation of concerns and implements the Command pattern for undo/redo functionality:
- Main application entry point and orchestrator
- Initializes all modules with proper dependency injection
- Provides public API for programmatic access
- Handles application-level error management and status reporting
- Manages Three.js scene, camera, renderer, and lighting
- Handles model addition/removal with transform controls
- Provides transform tools (translate, rotate, scale) with visual gizmos
- Manages multi-model selection and transformation
- Integrates with HistoryManager for operation tracking
- Centralized manager for all 3D file format loading (GLB, STL, USDZ, FBX, IFC)
- Coordinates individual loader modules with unified interface
- Supports multi-file loading with progress tracking and error handling
- Integrates with command system for undoable load operations
- Manages loader lifecycle and resource cleanup
- Manages model format conversion and export
- Supports exporting to GLB, GLTF, OBJ, STL, USDZ and PLY formats
- Handles multi-model export with automatic file naming
- Provides format-specific export options and optimizations
- Manages all DOM interactions and event handling
- Provides model tree view with selection and expansion states
- Handles transform tool UI and conversion interface
- Coordinates between user actions and other modules
- Manages keyboard shortcuts and user feedback
- Implements command pattern for undo/redo functionality
- Maintains operation history with configurable size limit (25 operations)
- Provides keyboard shortcuts (Ctrl+Z/Ctrl+Y) for undo/redo
- Supports command merging for similar consecutive operations
- Manages modal dialogs for export progress and error handling
- Provides visual feedback during long-running operations
- Handles export progress tracking with real-time updates
- Displays user-friendly error messages with actionable hints
- Provides 3D navigation controls and orientation indicator
- Interactive gizmo for quick camera positioning and rotation
- Visual feedback for current camera orientation
- Enhances user experience with intuitive 3D navigation
- Base class for all undoable operations
- Defines standard interface for execute/undo operations
- Provides command metadata and validation
- Handles undoable model loading operations
- Manages model metadata and scene integration
- Handles undoable model removal operations
- Preserves model state for restoration
- Handles undoable transform operations (translate, rotate, scale)
- Supports multi-model transformation with state preservation
- Abstract base class for all model loaders
- Provides common loading interface and error handling
- Standardizes loader lifecycle and resource management
- Specialized loader for GLB/GLTF binary files
- Handles materials, textures, and animations
- Optimized for glTF 2.0 specification compliance
- Handles STL stereolithography files
- Automatic scaling and rotation for optimal viewing
- Binary and ASCII STL format support
- Universal Scene Description file loader
- AR-ready content support with material preservation
- Apple USDZ format compatibility
- Autodesk FBX file format support
- Complex scene hierarchy and animation handling
- Material and texture preservation
- Industry Foundation Classes (IFC) building information modeling
- Construction and architecture file format support
- Geometric and semantic building data processing
- Utility functions for file operations and downloads
- File type validation and size formatting
- Cross-browser compatibility helpers
├── index.html # Main HTML file with UI layout
├── index.js # Application entry point
├── main.css # Application styles
├── License.md # Project license information
├── CNAME # Domain configuration for GitHub Pages
├── js/
│ ├── App.js # Main application orchestrator
│ ├── SceneManager.js # Three.js scene and transform management
│ ├── ModelConverter.js # Model export and conversion
│ ├── UIManager.js # UI management and event handling
│ ├── HistoryManager.js # Undo/redo command management
│ ├── ModalManager.js # Export progress and error modal management
│ ├── NavigationGizmo.js # 3D navigation controls and orientation gizmo
│ ├── commands/ # Command pattern implementation
│ │ ├── Command.js # Base command class
│ │ ├── LoadModelCommand.js # Undoable model loading
│ │ ├── RemoveModelCommand.js # Undoable model removal
│ │ └── TransformCommand.js # Undoable transformations
│ ├── loaders/ # Modular file format loading system
│ │ ├── LoaderManager.js # Centralized loader coordination
│ │ ├── BaseLoader.js # Abstract base loader class
│ │ ├── GLBLoader.js # GLB/GLTF binary file loader
│ │ ├── STLLoader.js # STL stereolithography loader
│ │ ├── USDZLoader.js # USDZ universal scene loader
│ │ ├── FBXLoader.js # FBX Autodesk file loader
│ │ └── IFCLoader.js # IFC building information loader
│ └── utils/
│ └── FileUtils.js # File operations and utilities
├── three.js-master/ # Three.js library and examples
└── README.md # Project documentation
- Open
index.htmlin a web browser - Click "Load models" to select 3D files (supports GLB, STL, USDZ, FBX, and IFC formats with multiple selection)
- Use mouse controls to navigate the 3D view:
- Left click + drag: Rotate camera around the model
- Right click + drag: Pan the camera
- Mouse wheel: Zoom in/out
- Click on models to select them (hold Ctrl for multi-selection)
- Use the scene composition tree to manage loaded models
- Translate: Click the "Translate" button to move selected models
- Rotate: Click the "Rotate" button to rotate selected models
- Scale: Click the "Scale" button to resize selected models
- Visual Gizmos: Interactive handles appear for precise transformations
- Escape Key: Exit any active transform mode
- Ctrl+Z: Undo the last operation (up to 25 operations)
- Ctrl+Y or Ctrl+Shift+Z: Redo previously undone operations
- Supported Operations: Model loading, removal, and all transformations
- Scene Tree: View all loaded models in an expandable tree structure
- Model Selection: Click models in the tree or 3D view to select them
- Multi-Selection: Hold Ctrl while clicking to select multiple models
- Clear Models: Remove all models from the scene
- Load one or more models
- Select an export format from the dropdown (GLB, GLTF, OBJ, STL, USDZ, or PLY)
- Click "Create" to download the converted file
- Multi-model scenes are exported as combined models with timestamped filenames
The application exposes a global app object for programmatic access:
// Load a model programmatically
const fileInput = document.createElement('input');
fileInput.type = 'file';
fileInput.accept = '.glb,.stl,.usdz,.fbx,.ifc';
fileInput.onchange = async (e) => {
try {
const result = await app.loadModel(e.target.files[0]);
console.log('Model loaded:', result);
} catch (error) {
console.error('Failed to load model:', error);
}
};
// Export all models to a specific format
try {
await app.exportModel('glb');
console.log('Models exported successfully');
} catch (error) {
console.error('Export failed:', error);
}
// Clear all models from the scene
app.clearModels();
// Get application status and information
const status = app.getStatus();
console.log('App status:', status);
// Returns: { initialized: boolean, hasModel: boolean, currentFileType: string, modelsCount: number }
// Access individual modules
const sceneManager = app.getSceneManager();
const loaderManager = app.getLoaderManager();
const modelConverter = app.getModelConverter();
const historyManager = app.getHistoryManager();
const uiManager = app.getUIManager();
// Undo/Redo operations programmatically
historyManager.undo();
historyManager.redo();
console.log('Can undo:', historyManager.canUndo());
console.log('Can redo:', historyManager.canRedo());- GLB: Binary glTF files with full material and animation support
- STL: Stereolithography files (with automatic scaling and rotation for optimal viewing)
- USDZ: Universal Scene Description files for AR/3D content
- FBX: Autodesk FBX files with complex scene hierarchies and animations
- IFC: Industry Foundation Classes files for building information modeling (BIM)
- GLB: Binary glTF (recommended for most use cases)
- GLTF: Text-based glTF with separate asset files
- OBJ: Wavefront OBJ format (geometry only, no materials)
- STL: Stereolithography format for 3D printing
- USDZ: Universal Scene Description for AR applications
- PLY: Polygon File Format for research and academic use
Note: Some export formats may have limitations depending on the complexity of the input model and available materials/textures.
| Import/Export | GLB | GLTF | STL | USDZ | PLY | OBJ |
|---|---|---|---|---|---|---|
| GLB | Yes | Yes | Yes | Yes | Yes | Yes |
| STL | Yes | Yes | Yes | Yes | Yes | Yes |
| USDZ | Yes | Yes | Yes | Yes | Yes | Yes |
| FBX | Partial | Partial | Yes | Yes | Yes | Yes |
| IFC | Yes | Yes | Yes | Yes | Yes | Yes |
- Three.js v0.158.0 - 3D graphics library loaded via CDN
- Three.js Examples/JSM - Additional Three.js modules and loaders
- Three Mesh BVH v0.5.23 - Spatial acceleration for ray casting
- Web-IFC v0.0.36 - IFC file format parsing
- Web-IFC-Three v0.0.125 - Three.js integration for IFC files
- Modern web browser with ES6 module support and WebGL capabilities
- Import maps support for module resolution
- No build process required - runs directly in the browser
- Chrome 61+ (recommended)
- Firefox 60+
- Safari 10.1+
- Edge 16+
Requires WebGL support and ES6 module capability
The modular architecture with command pattern makes it easy to:
- New file formats: Create new loader classes extending
BaseLoader.jsin theloaders/directory - Export formats: Add new exporters to
ModelConverter.js - Transform tools: Implement new transformation types in
SceneManager.js - Undoable operations: Create new command classes in the
commands/directory - UI enhancements: Extend
ModalManager.jsfor new dialog types orNavigationGizmo.jsfor navigation features
- Clear separation of concerns between modules
- Command pattern for robust undo/redo functionality
- Dependency injection for easy testing and modification
- Event-driven communication between UI and core logic
- Modular design allows individual component replacement
- Comprehensive error handling with user-friendly messages
- JSDoc comments for API documentation
- Consistent code style following ES6+ standards
- Memory management with proper disposal of Three.js resources
The application is hosted on GitHub Pages at: Sweet Converting (if configured)
The project follows modern JavaScript practices and is designed for easy contribution:
- Fork the repository
- Create a feature branch
- Follow the existing code style and architecture patterns
- Test your changes thoroughly
- Submit a pull request
Each module is well-documented and independent, making it straightforward to understand and modify specific functionality.