$npx -y skills add One-Man-Company/Skills-ContextManager --skill 3d-games3D game development principles. Rendering, shaders, physics, cameras.
| 1 | # 3D Game Development |
| 2 | |
| 3 | > Principles for 3D game systems. |
| 4 | |
| 5 | --- |
| 6 | |
| 7 | ## 1. Rendering Pipeline |
| 8 | |
| 9 | ### Stages |
| 10 | |
| 11 | ``` |
| 12 | 1. Vertex Processing → Transform geometry |
| 13 | 2. Rasterization → Convert to pixels |
| 14 | 3. Fragment Processing → Color pixels |
| 15 | 4. Output → To screen |
| 16 | ``` |
| 17 | |
| 18 | ### Optimization Principles |
| 19 | |
| 20 | | Technique | Purpose | |
| 21 | |-----------|---------| |
| 22 | | **Frustum culling** | Don't render off-screen | |
| 23 | | **Occlusion culling** | Don't render hidden | |
| 24 | | **LOD** | Less detail at distance | |
| 25 | | **Batching** | Combine draw calls | |
| 26 | |
| 27 | --- |
| 28 | |
| 29 | ## 2. Shader Principles |
| 30 | |
| 31 | ### Shader Types |
| 32 | |
| 33 | | Type | Purpose | |
| 34 | |------|---------| |
| 35 | | **Vertex** | Position, normals | |
| 36 | | **Fragment/Pixel** | Color, lighting | |
| 37 | | **Compute** | General computation | |
| 38 | |
| 39 | ### When to Write Custom Shaders |
| 40 | |
| 41 | - Special effects (water, fire, portals) |
| 42 | - Stylized rendering (toon, sketch) |
| 43 | - Performance optimization |
| 44 | - Unique visual identity |
| 45 | |
| 46 | --- |
| 47 | |
| 48 | ## 3. 3D Physics |
| 49 | |
| 50 | ### Collision Shapes |
| 51 | |
| 52 | | Shape | Use Case | |
| 53 | |-------|----------| |
| 54 | | **Box** | Buildings, crates | |
| 55 | | **Sphere** | Balls, quick checks | |
| 56 | | **Capsule** | Characters | |
| 57 | | **Mesh** | Terrain (expensive) | |
| 58 | |
| 59 | ### Principles |
| 60 | |
| 61 | - Simple colliders, complex visuals |
| 62 | - Layer-based filtering |
| 63 | - Raycasting for line-of-sight |
| 64 | |
| 65 | --- |
| 66 | |
| 67 | ## 4. Camera Systems |
| 68 | |
| 69 | ### Camera Types |
| 70 | |
| 71 | | Type | Use | |
| 72 | |------|-----| |
| 73 | | **Third-person** | Action, adventure | |
| 74 | | **First-person** | Immersive, FPS | |
| 75 | | **Isometric** | Strategy, RPG | |
| 76 | | **Orbital** | Inspection, editors | |
| 77 | |
| 78 | ### Camera Feel |
| 79 | |
| 80 | - Smooth following (lerp) |
| 81 | - Collision avoidance |
| 82 | - Look-ahead for movement |
| 83 | - FOV changes for speed |
| 84 | |
| 85 | --- |
| 86 | |
| 87 | ## 5. Lighting |
| 88 | |
| 89 | ### Light Types |
| 90 | |
| 91 | | Type | Use | |
| 92 | |------|-----| |
| 93 | | **Directional** | Sun, moon | |
| 94 | | **Point** | Lamps, torches | |
| 95 | | **Spot** | Flashlight, stage | |
| 96 | | **Ambient** | Base illumination | |
| 97 | |
| 98 | ### Performance Consideration |
| 99 | |
| 100 | - Real-time shadows are expensive |
| 101 | - Bake when possible |
| 102 | - Shadow cascades for large worlds |
| 103 | |
| 104 | --- |
| 105 | |
| 106 | ## 6. Level of Detail (LOD) |
| 107 | |
| 108 | ### LOD Strategy |
| 109 | |
| 110 | | Distance | Model | |
| 111 | |----------|-------| |
| 112 | | Near | Full detail | |
| 113 | | Medium | 50% triangles | |
| 114 | | Far | 25% or billboard | |
| 115 | |
| 116 | --- |
| 117 | |
| 118 | ## 7. Anti-Patterns |
| 119 | |
| 120 | | ❌ Don't | ✅ Do | |
| 121 | |----------|-------| |
| 122 | | Mesh colliders everywhere | Simple shapes | |
| 123 | | Real-time shadows on mobile | Baked or blob shadows | |
| 124 | | One LOD for all distances | Distance-based LOD | |
| 125 | | Unoptimized shaders | Profile and simplify | |
| 126 | |
| 127 | --- |
| 128 | |
| 129 | > **Remember:** 3D is about illusion. Create the impression of detail, not the detail itself. |