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