1---2name: "3d-games-3"3description: 3D game development principles. Rendering, shaders, physics, cameras.4allowed-tools: Read, Write, Edit, Glob, Grep5metadata:6 source: https://skillmd.com/skills/bishal-pdmsft/3d-games-37---89# 3D Game Development1011> Principles for 3D game systems.1213---1415## 1. Rendering Pipeline1617### Stages1819```201. Vertex Processing → Transform geometry212. Rasterization → Convert to pixels223. Fragment Processing → Color pixels234. Output → To screen24```2526### Optimization Principles2728| Technique | Purpose |29|-----------|---------|30| **Frustum culling** | Don't render off-screen |31| **Occlusion culling** | Don't render hidden |32| **LOD** | Less detail at distance |33| **Batching** | Combine draw calls |3435---3637## 2. Shader Principles3839### Shader Types4041| Type | Purpose |42|------|---------|43| **Vertex** | Position, normals |44| **Fragment/Pixel** | Color, lighting |45| **Compute** | General computation |4647### When to Write Custom Shaders4849- Special effects (water, fire, portals)50- Stylized rendering (toon, sketch)51- Performance optimization52- Unique visual identity5354---5556## 3. 3D Physics5758### Collision Shapes5960| Shape | Use Case |61|-------|----------|62| **Box** | Buildings, crates |63| **Sphere** | Balls, quick checks |64| **Capsule** | Characters |65| **Mesh** | Terrain (expensive) |6667### Principles6869- Simple colliders, complex visuals70- Layer-based filtering71- Raycasting for line-of-sight7273---7475## 4. Camera Systems7677### Camera Types7879| Type | Use |80|------|-----|81| **Third-person** | Action, adventure |82| **First-person** | Immersive, FPS |83| **Isometric** | Strategy, RPG |84| **Orbital** | Inspection, editors |8586### Camera Feel8788- Smooth following (lerp)89- Collision avoidance90- Look-ahead for movement91- FOV changes for speed9293---9495## 5. Lighting9697### Light Types9899| Type | Use |100|------|-----|101| **Directional** | Sun, moon |102| **Point** | Lamps, torches |103| **Spot** | Flashlight, stage |104| **Ambient** | Base illumination |105106### Performance Consideration107108- Real-time shadows are expensive109- Bake when possible110- Shadow cascades for large worlds111112---113114## 6. Level of Detail (LOD)115116### LOD Strategy117118| Distance | Model |119|----------|-------|120| Near | Full detail |121| Medium | 50% triangles |122| Far | 25% or billboard |123124---125126## 7. Anti-Patterns127128| ❌ Don't | ✅ Do |129|----------|-------|130| Mesh colliders everywhere | Simple shapes |131| Real-time shadows on mobile | Baked or blob shadows |132| One LOD for all distances | Distance-based LOD |133| Unoptimized shaders | Profile and simplify |134135---136137## Setup138139### Initialization140141```bash142python scripts/game_launcher.py # Initialize game environment143```144145> **Remember:** 3D is about illusion. Create the impression of detail, not the detail itself.