๐ Table of Contents
Sketch to 3D bridges the gap between imagination and creation. It's an innovative web application that transforms your simple 2D sketches into interactive 3D models in real-time. Whether you're a designer prototyping ideas, an educator teaching geometry, or just someone who loves to create, this tool makes 3D modeling accessible to everyone.
- ๐ Zero Learning Curve โ If you can draw, you can create 3D models
- โก Instant Results โ See your sketches transform in real-time
- ๐ Browser-Based โ No downloads, no installations, just pure creativity
- ๐จ Creative Freedom โ From simple shapes to complex polygons
- ๐ง Developer-Friendly โ Clean APIs and extensible architecture
- ๐ Educational โ Perfect for learning 3D concepts and spatial reasoning
|
|
|
|
Get up and running in less than 3 minutes:
- Node.js 18+ (Latest LTS recommended)
- npm or yarn package manager
- Modern browser with WebGL 2.0 support
# Clone the repository
git clone https://github.com/AlexanderPotiagalov/Sketch3DConverter.git
# Navigate to project directory
cd Sketch3DConverter
# Install dependencies
npm install
# Start development server
npm run dev
๐ That's it! Open http://localhost:3000
and start sketching!
# Build for production
npm run build
# Start production server
npm start
# Or serve static files
npm run export && npx serve out/
Our codebase is organized for clarity and maintainability:
โโโ components
โ โโโ DrawCanvas.tsx # Konva-based drawing & shape recognition
โ โโโ ThreeView.tsx # Three.js scene setup & extrusion logic
โโโ pages
โ โโโ api
โ โ โโโ vectorize.ts # Converts strokes/shapes to 3D specs
โ โโโ index.tsx # Main UI: toolbar, canvas & 3D layers
โโโ utils
โ โโโ ShapeRecognizer.ts # Stroke โ RecognizedShape algorithm
โโโ public
โ โโโ assets # Logo, example images, favicons
โโโ styles
โ โโโ globals.css # Tailwind imports & custom overrides
โโโ README.md
โโโ LICENSE
โโโ .gitignore
โโโ .env.local
โโโ eslint.config.mjs
โโโ package.json
โโโ package-lock.json
โโโ tscongif.json
โโโ postcss.config.mjs
โโโ next.config.js # Dynamic imports & SSR config
// Get reference to the drawing canvas
const canvasRef = useRef<DrawCanvasRef>(null);
// Clear the canvas
canvasRef.current?.clearCanvas();
// Export current drawing as image
const imageData = canvasRef.current?.exportImage("png", 0.9);
// Get all strokes for processing
const strokes = canvasRef.current?.getStrokes();
// Set drawing mode
canvasRef.current?.setTool("pen" | "eraser" | "select");
import { ShapeRecognizer } from "./utils/ShapeRecognizer";
const recognizer = new ShapeRecognizer({
tolerance: 0.1,
minPoints: 5,
enableSmoothing: true,
});
const shapes = recognizer.analyzeStrokes(strokeData);
// Returns: Array<Circle | Rectangle | Line | Polygon | Ellipse>
// Advanced recognition with confidence scores
const detailedResults = recognizer.analyzeWithConfidence(strokeData);
// Returns: Array<{ type: string, confidence: number, geometry: Shape }>
import { ThreeScene } from "./components/ThreeView";
// Create 3D scene with custom settings
const scene = new ThreeScene({
antialias: true,
shadows: true,
postProcessing: true,
});
// Add shapes to 3D scene
shapes.forEach((shape) => {
const mesh = scene.addExtrudedShape(shape, {
depth: 10,
bevelEnabled: true,
material: "phong",
});
});
// Animate the scene
scene.animate(() => {
// Custom animation logic
mesh.rotation.y += 0.01;
});
We're always improving and exploring new possibilities:
- ๐ค Smarter AI โ Enhanced shape recognition and intelligent suggestions
- ๐จ Better Visuals โ Support for textures, lighting, and materials
- ๐ฑ Mobile Friendly โ Seamless experience on phones and tablets
- ๐ฅ Collaboration โ Real-time drawing with friends or teammates
- ๐ฅฝ Immersive Tech โ AR/VR support and 3D printing export options
We believe great software is built by great communities:
- ๐ Bug Reports โ Help us squash those pesky bugs
- ๐ก Feature Requests โ Share your brilliant ideas
- ๐ง Code Contributions โ Submit pull requests
- ๐ Documentation โ Improve our guides and tutorials
- ๐จ Design & UX โ Enhance UI/UX and create assets
- ๐ฃ๏ธ Community Support โ Help others in discussions
- ๐ Educational Content โ Create tutorials and examples
Sketch to 3D is open source and available under the MIT License.
Built with modern web technologies and a passion for creativity.
๐จโ๐ป Created with โค๏ธ by Alexander Potiagalov
Turning sketches into reality, one line at a time.
โญ Star this repo if you found it helpful!
Made with โจ for creators, by creators