I'll create a 3D room viewer with Three.js featuring orbit controls, furniture placement, and day/night lighting. Let me start by exploring the project structure.
Now let me install Three.js and its types, along with the React Three Fiber ecosystem for easy React integration.
Now let me update the index.html title and create all the necessary files.
Now let me create the main application components. I'll build this with multiple files for clean organization.
The type errors are expected for R3F JSX elements. I need to add the R3F type declarations. Let me check the tsconfig and add a type declaration file.
I see skipLibCheck is true, so the build should work. The issue is that R3F extends JSX types. Let me create a type declaration file and continue building the components.
Now let me create the Lighting component and the Scene component:
Now let me create the UI panel component and the main App:
Now let me create the main App component:
Now let me update the CSS to ensure proper styling:
Now let me build the project to check for any issues:
The project builds successfully! Let me verify the output exists:
The project builds successfully. Here's what I created:
3D Room Designer
A fully interactive 3D room designer built with React Three Fiber, featuring:
🏠 Room Structure
- 4-walled room with floor, ceiling, baseboards, window (back wall), and doorway (front wall)
- Wooden plank floor pattern, window with cross-bar frames, and door frame details
🪑 8 Furniture Types
- Chair — 4-legged with seat and backrest
- Table — Rectangular with 4 legs
- Sofa — With arms, back, and cushion details
- Lamp — Base, pole, shade, and glowing bulb (emits light at night!)
- Bookshelf — Multi-shelf with colorful books
- Bed — With mattress, pillows, blanket, and headboard
- Plant — Pot with leafy foliage spheres
- Rug — Layered flat geometry with border pattern
🎮 Controls
- Orbit Controls — Left-click drag to orbit, right-click to pan, scroll to zoom
- Click any furniture to select it (blue ring indicator)
- Drag selected furniture to reposition within room bounds
- Rotate selected items by 45° increments
- Color picker to customize any piece's color
- Remove individual items or clear all
🌙 Day/Night Lighting
- Smooth animated transition between day and night modes
- Day: Warm sunlight, window glow, ambient fill
- Night: Moonlight, ceiling light, lamp point lights activate, stars on toggle
- Hemisphere lighting, directional sun/moon, spot light through window
- All materials and wall/floor colors shift with the lighting mode
📐 UI
- Collapsible side panel with furniture catalog grid
- Selected item controls (color, rotation, delete)
- Placed items list with color indicators
- Responsive glass-morphism styled overlay
Files built: index.html, src/types.ts, src/components/Room.tsx, src/r3f.d.ts, src/components/Furniture.tsx, src/components/Lighting.tsx, src/components/Scene.tsx, src/components/UIPanel.tsx, src/App.tsx, src/index.css