3D games skill

3D game development principles.

by davila7·MIT license·★ 32,299 Stars on the repo·GitHub ↗

Use now

Files of 3D games

davila7/main1 file shown
SKILL.md
Show the full text136 lines

3D Game Development

Principles for 3D game systems.


1. Rendering Pipeline

Stages
1. Vertex Processing → Transform geometry
2. Rasterization → Convert to pixels
3. Fragment Processing → Color pixels
4. Output → To screen
Optimization Principles
Technique Purpose
Frustum culling Don't render off-screen
Occlusion culling Don't render hidden
LOD Less detail at distance
Batching Combine draw calls

2. Shader Principles

Shader Types
Type Purpose
Vertex Position, normals
Fragment/Pixel Color, lighting
Compute General computation
When to Write Custom Shaders
  • Special effects (water, fire, portals)
  • Stylized rendering (toon, sketch)
  • Performance optimization
  • Unique visual identity

3. 3D Physics

Collision Shapes
Shape Use Case
Box Buildings, crates
Sphere Balls, quick checks
Capsule Characters
Mesh Terrain (expensive)
Principles
  • Simple colliders, complex visuals
  • Layer-based filtering
  • Raycasting for line-of-sight

4. Camera Systems

Camera Types
Type Use
Third-person Action, adventure
First-person Immersive, FPS
Isometric Strategy, RPG
Orbital Inspection, editors
Camera Feel
  • Smooth following (lerp)
  • Collision avoidance
  • Look-ahead for movement
  • FOV changes for speed

5. Lighting

Light Types
Type Use
Directional Sun, moon
Point Lamps, torches
Spot Flashlight, stage
Ambient Base illumination
Performance Consideration
  • Real-time shadows are expensive
  • Bake when possible
  • Shadow cascades for large worlds

6. Level of Detail (LOD)

LOD Strategy
Distance Model
Near Full detail
Medium 50% triangles
Far 25% or billboard

7. Anti-Patterns

❌ Don't ✅ Do
Mesh colliders everywhere Simple shapes
Real-time shadows on mobile Baked or blob shadows
One LOD for all distances Distance-based LOD
Unoptimized shaders Profile and simplify

Remember: 3D is about illusion. Create the impression of detail, not the detail itself.

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

Discussion

Alternatives