@ericrisco/rsc 0.1.34 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/README.md +28 -2
  2. package/manifest.json +241 -2
  3. package/package.json +1 -1
  4. package/scripts/lib/domains.js +1 -0
  5. package/scripts/lib/recommend.js +4 -0
  6. package/skills/agent-eval/SKILL.md +1 -1
  7. package/skills/analyze/SKILL.md +1 -1
  8. package/skills/brand-voice/SKILL.md +1 -1
  9. package/skills/brand-voice/references/voice-guide-template.md +14 -0
  10. package/skills/building-agents/SKILL.md +2 -2
  11. package/skills/competitor-watch/SKILL.md +9 -4
  12. package/skills/competitor-watch/references/tracker-schema.md +19 -0
  13. package/skills/constitution/references/constitution-template.md +10 -0
  14. package/skills/content-engine/SKILL.md +1 -1
  15. package/skills/content-engine/references/brief-and-pipeline.md +15 -1
  16. package/skills/course-builder/references/grounding-and-scoping.md +23 -0
  17. package/skills/course-storytelling/references/learner-grounding.md +22 -2
  18. package/skills/decision-records/SKILL.md +14 -1
  19. package/skills/decision-records/references/templates.md +20 -0
  20. package/skills/design/references/brand-grounding.md +11 -1
  21. package/skills/game-design/SKILL.md +170 -0
  22. package/skills/game-design/evals/README.md +13 -0
  23. package/skills/game-design/evals/cases.yaml +47 -0
  24. package/skills/game-design/references/mechanics-and-loops.md +78 -0
  25. package/skills/game-design/references/playtesting-and-scope.md +58 -0
  26. package/skills/game-design/references/progression-and-economy.md +70 -0
  27. package/skills/game-storytelling/SKILL.md +159 -0
  28. package/skills/game-storytelling/evals/README.md +28 -0
  29. package/skills/game-storytelling/evals/cases.yaml +51 -0
  30. package/skills/game-storytelling/references/branching-and-state.md +134 -0
  31. package/skills/game-storytelling/references/dialogue-tools.md +117 -0
  32. package/skills/game-storytelling/references/environmental-storytelling.md +71 -0
  33. package/skills/gamedev-multiplayer/SKILL.md +250 -0
  34. package/skills/gamedev-multiplayer/evals/README.md +12 -0
  35. package/skills/gamedev-multiplayer/evals/cases.yaml +44 -0
  36. package/skills/gamedev-multiplayer/references/godot-high-level-multiplayer.md +133 -0
  37. package/skills/gamedev-multiplayer/references/prediction-and-latency.md +104 -0
  38. package/skills/gamedev-multiplayer/references/unity-and-unreal-netcode.md +166 -0
  39. package/skills/gamedev-pathing/SKILL.md +242 -0
  40. package/skills/gamedev-pathing/evals/README.md +14 -0
  41. package/skills/gamedev-pathing/evals/cases.yaml +49 -0
  42. package/skills/gamedev-pathing/references/navmesh-workflow.md +110 -0
  43. package/skills/gamedev-pathing/references/search-algorithms.md +135 -0
  44. package/skills/gamedev-pathing/references/steering-and-avoidance.md +120 -0
  45. package/skills/gamedev-physics/SKILL.md +225 -0
  46. package/skills/gamedev-physics/evals/README.md +12 -0
  47. package/skills/gamedev-physics/evals/cases.yaml +54 -0
  48. package/skills/gamedev-physics/references/character-controllers.md +120 -0
  49. package/skills/gamedev-physics/references/determinism-and-queries.md +124 -0
  50. package/skills/gamedev-physics/references/layers-and-masks.md +115 -0
  51. package/skills/gamedev-shaders/SKILL.md +252 -0
  52. package/skills/gamedev-shaders/evals/README.md +14 -0
  53. package/skills/gamedev-shaders/evals/cases.yaml +45 -0
  54. package/skills/gamedev-shaders/references/effect-recipes.md +205 -0
  55. package/skills/gamedev-shaders/references/godot-shading-language.md +133 -0
  56. package/skills/gamedev-shaders/references/unity-and-unreal-shaders.md +169 -0
  57. package/skills/gamedev-shipping/SKILL.md +236 -0
  58. package/skills/gamedev-shipping/evals/README.md +9 -0
  59. package/skills/gamedev-shipping/evals/cases.yaml +55 -0
  60. package/skills/gamedev-shipping/references/mobile-and-desktop.md +127 -0
  61. package/skills/gamedev-shipping/references/stores-and-ci.md +162 -0
  62. package/skills/gamedev-shipping/references/web-export-headers.md +140 -0
  63. package/skills/godot/SKILL.md +319 -0
  64. package/skills/godot/evals/README.md +13 -0
  65. package/skills/godot/evals/cases.yaml +50 -0
  66. package/skills/godot/references/export-and-testing.md +102 -0
  67. package/skills/godot/references/gdscript-style.md +84 -0
  68. package/skills/godot/references/godot3-to-4-traps.md +89 -0
  69. package/skills/godot/references/nodes-scenes-resources.md +109 -0
  70. package/skills/harness/SKILL.md +3 -3
  71. package/skills/harness/references/daily-curation-automation.md +8 -6
  72. package/skills/harness/references/obsidian-scaffolding.md +16 -9
  73. package/skills/harness/references/wiki-article-template.md +31 -14
  74. package/skills/harness/references/wiki-index-template.md +7 -3
  75. package/skills/harness/references/wiki-protocol.md +120 -54
  76. package/skills/harness/references/wiki-worklog-template.md +5 -1
  77. package/skills/instagram-api/SKILL.md +8 -1
  78. package/skills/instagram-api/references/insights-metrics.md +8 -1
  79. package/skills/knowledge-ops/SKILL.md +9 -9
  80. package/skills/knowledge-ops/evals/cases.yaml +1 -1
  81. package/skills/knowledge-ops/references/gardening-playbook.md +18 -8
  82. package/skills/level-design/SKILL.md +175 -0
  83. package/skills/level-design/evals/README.md +35 -0
  84. package/skills/level-design/evals/cases.yaml +58 -0
  85. package/skills/level-design/references/blockout-to-art.md +118 -0
  86. package/skills/level-design/references/guidance-and-readability.md +152 -0
  87. package/skills/level-design/references/pacing-and-encounters.md +142 -0
  88. package/skills/linkedin-api/SKILL.md +10 -1
  89. package/skills/linkedin-strategy/SKILL.md +12 -0
  90. package/skills/linkedin-strategy/references/wiki-records.md +27 -1
  91. package/skills/marketing/references/brand-grounding.md +22 -2
  92. package/skills/medium-strategy/SKILL.md +12 -0
  93. package/skills/medium-strategy/references/wiki-records.md +39 -1
  94. package/skills/medium-writing/SKILL.md +19 -0
  95. package/skills/plan/references/plan-template.md +12 -1
  96. package/skills/roast-me/tools/adapters/__pycache__/__init__.cpython-312.pyc +0 -0
  97. package/skills/roast-me/tools/adapters/__pycache__/base.cpython-312.pyc +0 -0
  98. package/skills/roast-me/tools/adapters/__pycache__/claude.cpython-312.pyc +0 -0
  99. package/skills/roast-me/tools/adapters/__pycache__/codex.cpython-312.pyc +0 -0
  100. package/skills/roast-me/tools/adapters/__pycache__/gemini.cpython-312.pyc +0 -0
  101. package/skills/roast-me/tools/adapters/__pycache__/registry.cpython-312.pyc +0 -0
  102. package/skills/shortform-packaging/SKILL.md +7 -2
  103. package/skills/shortform-packaging/references/package-templates.md +13 -2
  104. package/skills/shortform-strategy/SKILL.md +30 -6
  105. package/skills/shortform-strategy/references/learning-loop-template.md +9 -1
  106. package/skills/specify/references/spec-template.md +12 -1
  107. package/skills/tiktok-api/SKILL.md +6 -2
  108. package/skills/tiktok-api/references/wiki-schema.md +38 -4
  109. package/skills/unity/SKILL.md +282 -0
  110. package/skills/unity/evals/README.md +8 -0
  111. package/skills/unity/evals/cases.yaml +43 -0
  112. package/skills/unity/references/build-and-platforms.md +65 -0
  113. package/skills/unity/references/input-system.md +102 -0
  114. package/skills/unity/references/lifecycle-deep-dive.md +75 -0
  115. package/skills/unreal/SKILL.md +270 -0
  116. package/skills/unreal/evals/README.md +12 -0
  117. package/skills/unreal/evals/cases.yaml +45 -0
  118. package/skills/unreal/references/blueprint-cpp-parity.md +109 -0
  119. package/skills/unreal/references/gameplay-framework.md +95 -0
  120. package/skills/unreal/references/packaging.md +83 -0
  121. package/skills/verify/SKILL.md +11 -1
  122. package/skills/youtube-api/SKILL.md +7 -2
  123. package/skills/youtube-api/references/wiki-schema.md +25 -4
  124. package/skills/youtube-packaging/SKILL.md +10 -2
  125. package/skills/youtube-packaging/references/description-and-chapters.md +70 -2
  126. package/skills/youtube-strategy/SKILL.md +9 -2
  127. package/skills/youtube-strategy/references/wiki-records.md +39 -6
  128. package/skills/youtube-strategy/scripts/verify.sh +4 -0
  129. package/skills/youtube-thumbnails/SKILL.md +10 -5
  130. package/skills/youtube-thumbnails/references/experiment-log-format.md +28 -2
@@ -0,0 +1,45 @@
1
+ skill: gamedev-shaders
2
+
3
+ should_trigger:
4
+ - prompt: "Write me a dissolve shader in Godot 4 that burns an object away from bottom to top with a glowing orange edge."
5
+ why: "Dissolve is a named recipe and the core use case; Godot 4 .gdshader authoring is owned here."
6
+ - prompt: "How do I make a rim light / fresnel glow on a 3D character in Unity URP?"
7
+ why: "Rim/fresnel is a named recipe; 'how do I make X effect' is an explicit trigger; Unity shader authoring is per-engine mapped here."
8
+ - prompt: "My translucent particle shader tanks the framerate on mobile. How do I fix the overdraw?"
9
+ why: "Shader performance — overdraw, transparency, mobile — is a dedicated section; symptom-only trigger routes here, not to a generic profiler."
10
+ - prompt: "Set up a full-screen post-process effect in Unreal that reads scene depth and draws outlines."
11
+ why: "Post-processing / full-screen effects per engine is a core section; Unreal Post Process material + SceneTexture is covered."
12
+ - prompt: "Cómo hago un shader de agua con refracción y espuma en los bordes."
13
+ why: "Spanish water/flow recipe request; the description carries the Spanish 'cómo hago un shader de agua'."
14
+ - prompt: "Convert this toon/cel shading effect from my Godot project to a Unity Shader Graph."
15
+ why: "Toon/cel is a named recipe and cross-engine conversion is an explicit use case; the skill carries a Godot↔Unity↔Unreal map."
16
+ - prompt: "What coordinate space are NORMAL and VIEW in inside a Godot spatial fragment shader, and why does my world-space fresnel look wrong?"
17
+ why: "Coordinate-spaces / fundamentals plus a Godot-specific gotcha (view-space normals) both live in this skill."
18
+
19
+ should_not_trigger:
20
+ - prompt: "Write the GDScript that spawns enemies on a timer and tracks the player's score."
21
+ route_to: "godot"
22
+ why: "Gameplay logic and engine APIs belong to the engine skill; this skill only owns the shading, not the script around it."
23
+ - prompt: "My rigid body tunnels through thin walls at high speed — how do I fix the collision detection?"
24
+ route_to: "gamedev-physics"
25
+ why: "Physics simulation and collision (continuous collision detection) is gamedev-physics; a shader has nothing to do with it."
26
+ - prompt: "My build has 40k shader variants and takes an hour to compile — how do I strip variants for the console ship?"
27
+ route_to: "gamedev-shipping"
28
+ why: "Shader-variant stripping in the build/ship pipeline is gamedev-shipping; this skill keeps per-shader authoring performance."
29
+ - prompt: "Optimize this SQL query that's doing a full table scan on every page load."
30
+ route_to: "sql"
31
+ why: "'Shader is slow' overlaps the word 'optimize' but this is database work with zero GPU/material surface."
32
+ - prompt: "Set up the URP asset, camera stack, and renderer features for my Unity project's rendering settings."
33
+ route_to: "unity"
34
+ why: "Project-level render pipeline configuration is engine setup (unity), not writing a shader/material; this skill starts once you're authoring the shader itself."
35
+
36
+ capability:
37
+ - scenario: "Author a Godot 4.x spatial dissolve shader that burns an object away with a glowing edge, and expose it to be animated from code."
38
+ must_include:
39
+ - "Starts with 'shader_type spatial;' (a valid Godot 4 shader type token)"
40
+ - "Samples a noise texture and uses discard (or ALPHA_SCISSOR) below an animatable threshold uniform to cut the pixels"
41
+ - "Adds an emissive edge band via smoothstep around the threshold so the burn edge glows (uses EMISSION)"
42
+ - "Declares color uniforms with the ': source_color' hint (NOT the removed Godot 3 'hint_color')"
43
+ - "Does NOT use the removed SCREEN_TEXTURE/DEPTH_TEXTURE built-ins; if a screen/depth read is needed it declares a 'hint_screen_texture'/'hint_depth_texture' uniform"
44
+ - "Explains driving the threshold uniform from code via set_shader_parameter or an AnimationPlayer track (not hard-coded)"
45
+ - "Notes that discard disables early-Z / costs overdraw, or otherwise addresses the performance implication"
@@ -0,0 +1,205 @@
1
+ # Effect recipes
2
+
3
+ Full per-engine detail behind SKILL.md's recipe table. Each recipe: the technique, then code.
4
+ Godot examples are `.gdshader` (4.x); Unity is URP HLSL/Shader Graph; Unreal is Material graph
5
+ described as node chains (drop to a Custom node only where noted).
6
+
7
+ ---
8
+
9
+ ## 1. Dissolve
10
+
11
+ **Technique.** Sample a noise texture, compare to an animated `threshold`; cut pixels below it;
12
+ add an emissive band in a thin range above the threshold so the edge glows as the object burns.
13
+
14
+ **Godot (spatial):**
15
+
16
+ ```glsl
17
+ shader_type spatial;
18
+ render_mode cull_disabled;
19
+ uniform sampler2D noise : hint_default_white;
20
+ uniform float threshold : hint_range(0.0, 1.0) = 0.0;
21
+ uniform float edge = 0.05;
22
+ uniform vec3 edge_color : source_color = vec3(1.0, 0.4, 0.0);
23
+ void fragment() {
24
+ float n = texture(noise, UV).r;
25
+ if (n < threshold) discard;
26
+ float e = smoothstep(threshold, threshold + edge, n);
27
+ ALBEDO = vec3(0.6);
28
+ EMISSION = edge_color * (1.0 - e) * 4.0; // >1 for bloom
29
+ }
30
+ ```
31
+
32
+ **Unity URP (fragment):** `float n = SAMPLE_TEXTURE2D(_Noise, s, uv).r; clip(n - _Threshold);`
33
+ then `emission = _EdgeColor * (1 - smoothstep(_Threshold, _Threshold + _Edge, n));`. In Shader
34
+ Graph: Sample Texture → Step/Smoothstep → Alpha Clip Threshold + Emission.
35
+
36
+ **Unreal:** Blend Mode = Masked. Noise Texture → Subtract Threshold parameter → **Opacity Mask**.
37
+ For the glow, `Smoothstep` around the threshold → multiply EdgeColor → **Emissive Color**. Animate
38
+ Threshold via a Dynamic Material Instance or a Curve.
39
+
40
+ ---
41
+
42
+ ## 2. Rim light & outline
43
+
44
+ **Rim (fresnel).** Brightens grazing angles: `rim = pow(1 - saturate(dot(N, V)), power)`. Cheap,
45
+ per-pixel, great for shields/highlights.
46
+
47
+ **Godot:**
48
+
49
+ ```glsl
50
+ shader_type spatial;
51
+ uniform vec3 rim_color : source_color = vec3(0.4, 0.7, 1.0);
52
+ uniform float power : hint_range(0.5, 8.0) = 3.0;
53
+ void fragment() {
54
+ float f = pow(1.0 - dot(normalize(NORMAL), normalize(VIEW)), power);
55
+ EMISSION = rim_color * f;
56
+ }
57
+ ```
58
+
59
+ **Unity:** Fresnel Effect node (Power input) → multiply color → Emission. **Unreal:** Fresnel node
60
+ → multiply → Emissive Color.
61
+
62
+ **Outline** — two approaches:
63
+ - **Inverted hull** (mesh outline): a second pass that pushes vertices along their normals and
64
+ renders only back faces in the outline color. Godot: a second material pass with
65
+ `render_mode cull_front;` and `VERTEX += NORMAL * width;` in `vertex()`. Unity: an extra Pass
66
+ with `Cull Front` offsetting `positionOS` along the normal. Unreal: post-process, or a second
67
+ mesh scaled along normals.
68
+ - **Post-process edge detect** (screen outline): compare neighboring **depth** and **normal**
69
+ samples; large deltas = an edge. Domain = Post Process (UE) / Full Screen (URP) / ColorRect
70
+ reading `hint_depth_texture` (Godot). Best for uniform-width screen outlines regardless of mesh.
71
+
72
+ ---
73
+
74
+ ## 3. Toon / cel
75
+
76
+ **Technique.** Replace smooth diffuse `N·L` with quantized bands (a hard `step`, a few
77
+ `smoothstep` bands, or a 1D ramp texture lookup). Add a stepped specular and optional rim.
78
+
79
+ **Godot (custom lighting via `light()`):**
80
+
81
+ ```glsl
82
+ shader_type spatial;
83
+ uniform sampler2D ramp : hint_default_white, filter_linear;
84
+ void light() {
85
+ float ndl = clamp(dot(NORMAL, LIGHT), 0.0, 1.0);
86
+ float band = texture(ramp, vec2(ndl, 0.5)).r; // ramp = your toon gradient
87
+ DIFFUSE_LIGHT += ATTENUATION * LIGHT_COLOR.rgb * band;
88
+ }
89
+ ```
90
+
91
+ Cheaper hard cut without a ramp: `float band = step(0.5, ndl);` or two-step
92
+ `smoothstep(0.48, 0.5, ndl)`. **Unity:** compute `NdotL` in a lit HLSL pass and quantize, or a
93
+ Shader Graph with the main light direction + Step. **Unreal:** custom shading is limited without
94
+ engine mods — approximate with a Post Process banding of scene color, or `CustomLighting`-style
95
+ math in an Unlit material driven by a light vector parameter.
96
+
97
+ ---
98
+
99
+ ## 4. Water / flow
100
+
101
+ **Technique.** Two scrolling normal maps at different speeds/scales summed for waves; refract the
102
+ scene behind by offsetting the screen UV with the normal; add depth-based foam where scene depth
103
+ is close to the surface. A **flow map** (RG = 2D flow direction) advects UVs for rivers.
104
+
105
+ **Godot (spatial, refraction + normals):**
106
+
107
+ ```glsl
108
+ shader_type spatial;
109
+ render_mode cull_disabled;
110
+ uniform sampler2D normal_map : hint_normal, repeat_enable;
111
+ uniform sampler2D screen_tex : hint_screen_texture, filter_linear_mipmap;
112
+ uniform sampler2D depth_tex : hint_depth_texture;
113
+ uniform float speed = 0.03;
114
+ uniform float strength = 0.02;
115
+ void fragment() {
116
+ vec2 uv1 = UV + vec2(TIME * speed, 0.0);
117
+ vec2 uv2 = UV - vec2(0.0, TIME * speed * 0.7);
118
+ vec3 n = normalize(texture(normal_map, uv1).xyz + texture(normal_map, uv2).xyz - 1.0);
119
+ vec2 refr = SCREEN_UV + n.xy * strength;
120
+ ALBEDO = texture(screen_tex, refr).rgb;
121
+ NORMAL_MAP = n * 0.5 + 0.5;
122
+ }
123
+ ```
124
+
125
+ Foam: compare linearized `depth_tex` at `SCREEN_UV` to the surface's own depth; where the
126
+ difference is small, `mix` toward white. **Unity:** two Sample Texture 2D (normal) with
127
+ Time-driven offsets → combine → Scene Color offset by normal; Scene Depth node difference for
128
+ foam. **Unreal:** Panner nodes on normal maps, Refraction pin, and `SceneDepth − PixelDepth` for a
129
+ foam mask; Single Layer Water shading model for oceans.
130
+
131
+ ---
132
+
133
+ ## 5. Force field / shield
134
+
135
+ **Technique.** Fresnel base + a scrolling hex/pattern texture, boosted where the mesh intersects
136
+ other geometry (scene-depth difference), additive/translucent. Optional hit ripples from a
137
+ world-space impact point parameter.
138
+
139
+ **Godot:**
140
+
141
+ ```glsl
142
+ shader_type spatial;
143
+ render_mode blend_add, cull_disabled, unshaded, depth_draw_never;
144
+ uniform sampler2D pattern : repeat_enable;
145
+ uniform sampler2D depth_tex : hint_depth_texture;
146
+ uniform vec3 color : source_color = vec3(0.2, 0.7, 1.0);
147
+ uniform float power : hint_range(0.5, 8.0) = 2.0;
148
+ void fragment() {
149
+ float fres = pow(1.0 - dot(normalize(NORMAL), normalize(VIEW)), power);
150
+ float hex = texture(pattern, UV + TIME * 0.05).r;
151
+ // intersection glow
152
+ float scene = texture(depth_tex, SCREEN_UV).x;
153
+ vec4 v = INV_PROJECTION_MATRIX * vec4(SCREEN_UV * 2.0 - 1.0, scene, 1.0);
154
+ float edge = smoothstep(0.0, 1.0, abs(-v.z / v.w - (-VERTEX.z)));
155
+ EMISSION = color * (fres + hex * 0.3 + (1.0 - edge));
156
+ ALPHA = clamp(fres + hex * 0.3, 0.0, 1.0);
157
+ }
158
+ ```
159
+
160
+ **Unity/Unreal:** Fresnel + Panner on a pattern texture, additive/translucent blend, and a Scene
161
+ Depth vs pixel-depth difference (Unity Scene Depth node; UE `SceneDepth − PixelDepth`) for the
162
+ intersection band.
163
+
164
+ ---
165
+
166
+ ## 6. Hologram
167
+
168
+ **Technique.** Scanlines from `sin(worldY * freq + TIME)`, fresnel edge glow, periodic flicker
169
+ (noise or `sin`), a small per-channel UV offset for chromatic fringing, additive or translucent.
170
+
171
+ **Godot:**
172
+
173
+ ```glsl
174
+ shader_type spatial;
175
+ render_mode blend_add, cull_disabled, unshaded;
176
+ uniform vec3 color : source_color = vec3(0.3, 0.9, 1.0);
177
+ uniform float lines = 120.0;
178
+ uniform float speed = 2.0;
179
+ varying vec3 wpos;
180
+ void vertex() { wpos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; }
181
+ void fragment() {
182
+ float scan = 0.5 + 0.5 * sin(wpos.y * lines + TIME * speed);
183
+ float fres = pow(1.0 - dot(normalize(NORMAL), normalize(VIEW)), 2.0);
184
+ float flicker = 0.9 + 0.1 * sin(TIME * 30.0);
185
+ EMISSION = color * (scan * 0.6 + fres) * flicker;
186
+ ALPHA = (scan * 0.5 + fres) * flicker;
187
+ }
188
+ ```
189
+
190
+ **Unity:** world-position Y into a Sine → scanlines; Fresnel node; Time-driven flicker; additive.
191
+ **Unreal:** `WorldPosition.B` (Z-up) → Sine → scanlines, Fresnel, Time flicker → Emissive; Blend
192
+ Mode Translucent/Additive, Unlit. Chromatic fringing: sample the effect at slightly offset UVs per
193
+ R/G/B channel.
194
+
195
+ ---
196
+
197
+ ## Cross-cutting notes
198
+
199
+ - **Additive/translucent** effects (shield, hologram, force field) stack overdraw — keep them
200
+ small on screen and unshaded (`render_mode unshaded` / Unlit / Emissive-only).
201
+ - **Depth-based** recipes (foam, intersection glow, screen outline) need the engine's depth
202
+ texture enabled: URP *Depth Texture* toggle; UE reads SceneDepth natively; Godot's
203
+ `hint_depth_texture` is available in the forward+ / mobile renderers.
204
+ - Author tunables (speed, power, colors, thresholds) as **parameters/uniforms** and drive them
205
+ from an animation track or code — never bake magic numbers you'll want to tweak live.
@@ -0,0 +1,133 @@
1
+ # Godot 4.x shading language
2
+
3
+ Depth behind SKILL.md's Godot section. Targets Godot 4.4/4.5. Godot ships its own GLSL-like
4
+ language in `.gdshader` files; a `ShaderMaterial` binds a shader to a node and stores uniform values.
5
+
6
+ ## The five shader types
7
+
8
+ Every `.gdshader` starts with exactly one `shader_type`:
9
+
10
+ | `shader_type` | Drives | Key entry points |
11
+ | --- | --- | --- |
12
+ | `spatial` | 3D materials on `MeshInstance3D` etc. | `vertex()`, `fragment()`, `light()` |
13
+ | `canvas_item` | 2D (`Sprite2D`, `TextureRect`, `Control`, …) | `vertex()`, `fragment()`, `light()` |
14
+ | `particles` | GPU particle process (`GPUParticles2D/3D`) | `start()`, `process()` |
15
+ | `sky` | `Sky` resource in an `Environment` | `sky()` |
16
+ | `fog` | `FogVolume` local volumetric fog | `fog()` |
17
+
18
+ Tokens are exact: `canvas_item` has an underscore, `particles` is plural.
19
+
20
+ ## Uniforms and hints
21
+
22
+ `uniform`s become material parameters (editable in the inspector, settable from code). Hints tell
23
+ the engine how to treat them:
24
+
25
+ ```glsl
26
+ uniform vec4 albedo : source_color = vec4(1.0); // sRGB→linear color picker
27
+ uniform float amount : hint_range(0.0, 1.0, 0.01) = 0.5;// slider min,max,step
28
+ uniform sampler2D tex : source_color, filter_linear_mipmap, repeat_enable;
29
+ uniform sampler2D mask : hint_default_white; // default when unbound (also _black, _transparent)
30
+ uniform sampler2D screen_tex : hint_screen_texture, filter_linear_mipmap;
31
+ uniform sampler2D depth_tex : hint_depth_texture;
32
+ uniform sampler2D nr_tex : hint_normal_roughness_texture;
33
+ global uniform float game_time; // shared project-wide global
34
+ instance uniform vec4 tint : source_color; // per-instance override
35
+ ```
36
+
37
+ Migration from Godot 3 (never emit the left side): `hint_color`/`hint_albedo` → `source_color`;
38
+ `hint_white`/`hint_black` → `hint_default_white`/`hint_default_black`; the `SCREEN_TEXTURE`,
39
+ `DEPTH_TEXTURE`, `NORMAL_TEXTURE` **built-ins** → `hint_screen_texture` / `hint_depth_texture` /
40
+ `hint_normal_roughness_texture` **uniforms**.
41
+
42
+ Texture filter/repeat qualifiers: `filter_nearest`, `filter_linear`, `filter_nearest_mipmap`,
43
+ `filter_linear_mipmap`, `filter_linear_mipmap_anisotropic`; `repeat_enable`, `repeat_disable`.
44
+
45
+ ## varying — vertex → fragment
46
+
47
+ Declare at file scope, write in `vertex()`, read (interpolated) in `fragment()`:
48
+
49
+ ```glsl
50
+ varying vec3 world_pos;
51
+ void vertex() { world_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz; }
52
+ void fragment() { /* use world_pos */ }
53
+ ```
54
+
55
+ Add an interpolation qualifier when needed: `varying flat int id;` (no interpolation),
56
+ `varying smooth vec3 n;` (default).
57
+
58
+ ## render_mode
59
+
60
+ Comma-separated flags right after `shader_type`. Common spatial modes:
61
+
62
+ ```glsl
63
+ render_mode blend_add, cull_disabled, unshaded, depth_draw_opaque, depth_test_disabled, shadows_disabled;
64
+ ```
65
+
66
+ `blend_mix|add|sub|mul`; `cull_back|front|disabled`; `unshaded` (skip lighting); `depth_draw_*`;
67
+ `fog_disabled`. canvas_item supports `blend_*`, `unshaded`, `light_only`, etc.
68
+
69
+ ## Built-ins by type (most-used)
70
+
71
+ **spatial `fragment()` — inputs:** `UV`, `UV2`, `NORMAL` (view space), `VIEW` (view space, toward
72
+ camera), `VERTEX` (view-space position), `COLOR` (vertex color), `SCREEN_UV`, `TIME`,
73
+ `FRAGCOORD`, matrices `MODEL_MATRIX`, `VIEW_MATRIX`, `INV_VIEW_MATRIX`, `PROJECTION_MATRIX`,
74
+ `INV_PROJECTION_MATRIX`. **outputs:** `ALBEDO`, `ALPHA`, `METALLIC`, `ROUGHNESS`, `SPECULAR`,
75
+ `EMISSION`, `NORMAL_MAP` (tangent-space, expects 0–1), `NORMAL_MAP_DEPTH`, `AO`, `RIM`,
76
+ `CLEARCOAT`, `ALPHA_SCISSOR_THRESHOLD`.
77
+
78
+ **spatial `vertex()`:** read/write `VERTEX`, `NORMAL`, `TANGENT`, `UV`, `COLOR`; write `POSITION`
79
+ directly (in clip space) to bypass the standard transform — used for full-screen quads:
80
+ `POSITION = vec4(VERTEX.xy, 1.0, 1.0);`.
81
+
82
+ **canvas_item `fragment()`:** inputs `UV`, `COLOR` (vertex×modulate), `SCREEN_UV`, `TEXTURE`
83
+ (the node's texture), `TEXTURE_PIXEL_SIZE`, `TIME`; output `COLOR`. `MODULATE` exposes the
84
+ CanvasItem modulate separately.
85
+
86
+ **particles `process()`:** `TRANSFORM`, `VELOCITY`, `COLOR`, `CUSTOM`, `LIFETIME`, `DELTA`,
87
+ `RESTART`, `EMISSION_TRANSFORM`, `ATTRACTOR_FORCE`.
88
+
89
+ ## Screen and depth reads
90
+
91
+ `SCREEN_TEXTURE` is gone — declare a uniform:
92
+
93
+ ```glsl
94
+ shader_type canvas_item;
95
+ uniform sampler2D screen_tex : hint_screen_texture, filter_linear_mipmap;
96
+ void fragment() { COLOR = texture(screen_tex, SCREEN_UV); } // what's behind this node
97
+ ```
98
+
99
+ Depth to view/world position in a spatial full-screen pass:
100
+
101
+ ```glsl
102
+ uniform sampler2D depth_tex : hint_depth_texture;
103
+ void fragment() {
104
+ float d = texture(depth_tex, SCREEN_UV).x;
105
+ vec4 ndc = vec4(SCREEN_UV * 2.0 - 1.0, d, 1.0);
106
+ vec4 view = INV_PROJECTION_MATRIX * ndc; view.xyz /= view.w; // view-space position
107
+ float linear_depth = -view.z;
108
+ }
109
+ ```
110
+
111
+ ## ShaderMaterial from code (GDScript)
112
+
113
+ ```gdscript
114
+ var mat := ShaderMaterial.new()
115
+ mat.shader = preload("res://dissolve.gdshader")
116
+ mesh.material_override = mat
117
+ mat.set_shader_parameter("threshold", 0.7)
118
+ mat.set_shader_parameter("edge_color", Color(1, 0.4, 0))
119
+ # animate a uniform each frame
120
+ func _process(delta): mat.set_shader_parameter("threshold", t)
121
+ ```
122
+
123
+ C# parity: `mat.SetShaderParameter("threshold", 0.7f);`. Prefer an `AnimationPlayer` track on the
124
+ material's `shader_parameter/<name>` for authored animations.
125
+
126
+ ## Common gotchas
127
+
128
+ - `NORMAL` and `VIEW` in a spatial `fragment()` are **view space**, not world — transform with
129
+ `INV_VIEW_MATRIX` if you need world space (e.g. triplanar, world-space fresnel toward a point).
130
+ - Re-`normalize()` interpolated normals per pixel.
131
+ - `discard` (and `ALPHA_SCISSOR_THRESHOLD`) disables early depth — costs overdraw; use only for cutouts.
132
+ - Set `render_mode unshaded` on pure-emissive/effect materials to skip the lighting cost.
133
+ - Precompute in `vertex()` and pass a `varying` whenever the quantity interpolates linearly.
@@ -0,0 +1,169 @@
1
+ # Unity 6 & Unreal 5.x shaders
2
+
3
+ Depth behind SKILL.md's Unity and Unreal sections.
4
+
5
+ ---
6
+
7
+ ## Unity 6 (URP / HDRP)
8
+
9
+ Unity 6 (6000.x LTS) ships the Scriptable Render Pipeline as the norm: **URP** (Universal) for
10
+ most projects, **HDRP** (High Definition) for high-end PC/console. The retired Built-in RP still
11
+ exists but do not author new shaders for it.
12
+
13
+ ### Choosing the authoring path
14
+
15
+ | Path | When | Notes |
16
+ | --- | --- | --- |
17
+ | **Shader Graph** | Surface looks, VFX, artist iteration | Visual master stack (Vertex + Fragment blocks); URP/HDRP; compiles to HLSL. |
18
+ | **Hand-written HLSL** | Custom lighting, tight control, compute-driven | ShaderLab wrapper + `HLSLPROGRAM` block including URP libraries. |
19
+
20
+ **Surface shaders (`#pragma surface`) do NOT compile under URP/HDRP** — they are a Built-in-RP
21
+ feature. Under SRP write a lit HLSL pass or use Shader Graph.
22
+
23
+ ### Minimal URP unlit HLSL shader
24
+
25
+ ```hlsl
26
+ Shader "Custom/URPUnlitScroll" {
27
+ Properties {
28
+ _BaseMap ("Texture", 2D) = "white" {}
29
+ _Tint ("Tint", Color) = (1,1,1,1)
30
+ _Speed ("Scroll Speed", Float) = 0.1
31
+ }
32
+ SubShader {
33
+ Tags { "RenderPipeline"="UniversalPipeline" "RenderType"="Opaque" }
34
+ Pass {
35
+ HLSLPROGRAM
36
+ #pragma vertex vert
37
+ #pragma fragment frag
38
+ #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
39
+
40
+ struct Attributes { float4 positionOS : POSITION; float2 uv : TEXCOORD0; };
41
+ struct Varyings { float4 positionHCS : SV_POSITION; float2 uv : TEXCOORD0; };
42
+
43
+ TEXTURE2D(_BaseMap); SAMPLER(sampler_BaseMap);
44
+ CBUFFER_START(UnityPerMaterial)
45
+ float4 _BaseMap_ST; float4 _Tint; float _Speed;
46
+ CBUFFER_END
47
+
48
+ Varyings vert (Attributes IN) {
49
+ Varyings o;
50
+ o.positionHCS = TransformObjectToHClip(IN.positionOS.xyz); // NOT UnityObjectToClipPos
51
+ o.uv = TRANSFORM_TEX(IN.uv, _BaseMap);
52
+ return o;
53
+ }
54
+ half4 frag (Varyings IN) : SV_Target {
55
+ float2 uv = IN.uv + float2(_Time.y * _Speed, 0);
56
+ return SAMPLE_TEXTURE2D(_BaseMap, sampler_BaseMap, uv) * _Tint;
57
+ }
58
+ ENDHLSL
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ For a **lit** pass add `#include ".../Lighting.hlsl"`, compute normals in world space, and call
65
+ `UniversalFragmentPBR` / light loops. `mul(UNITY_MATRIX_MVP, v)` and `UnityObjectToClipPos` are
66
+ Built-in-RP idioms — never emit them for URP.
67
+
68
+ ### Shader Graph mapping (concepts)
69
+
70
+ - **Master stack** = Vertex block (Position/Normal/Tangent) + Fragment block (Base Color, Metallic,
71
+ Smoothness, Emission, Alpha, Normal (Tangent Space)).
72
+ - Time node → scrolling; Fresnel Effect node → rim; Sample Texture 2D → maps; Step/Smoothstep →
73
+ toon banding; Scene Color / Scene Depth nodes need the URP opaque texture / depth toggles on.
74
+ - **Custom Function node** embeds an `.hlsl` snippet inside the graph (the Shader Graph analog of
75
+ UE's Custom node).
76
+
77
+ ### Runtime parameters
78
+
79
+ `Material.SetFloat/SetColor/SetTexture`, or a `MaterialPropertyBlock` on the renderer for
80
+ per-instance values without new material instances. Enable keyword variants with `#pragma
81
+ multi_compile` / `shader_feature` and `Material.EnableKeyword`.
82
+
83
+ ### Full-screen / post-process (URP)
84
+
85
+ Add a **Full Screen Pass Renderer Feature** to the URP Renderer and point it at a *Fullscreen*
86
+ Shader Graph (Fullscreen master) or a Blit material. HDRP uses a Custom Pass Volume / Fullscreen
87
+ Custom Pass. `OnRenderImage`/`Graphics.Blit` image effects are Built-in-RP only.
88
+
89
+ ---
90
+
91
+ ## Unreal 5.x
92
+
93
+ A **Material** is a node graph compiled to HLSL. Targets UE 5.4+.
94
+
95
+ ### Result-node outputs
96
+
97
+ Base Color, Metallic, Specular, Roughness, Anisotropy, Emissive Color, Opacity, Opacity Mask,
98
+ Normal, World Position Offset, Ambient Occlusion, Refraction, Pixel Depth Offset. Which are active
99
+ depends on the Blend Mode and Shading Model.
100
+
101
+ ### Material Domain — pick what it drives
102
+
103
+ | Domain | Use |
104
+ | --- | --- |
105
+ | **Surface** | Standard meshes (default). |
106
+ | **Deferred Decal** | Projected decals onto the g-buffer. |
107
+ | **Light Function** | Modulates a light's contribution. |
108
+ | **Volume** | Volumetric fog/clouds. |
109
+ | **Post Process** | Full-screen effect on a Post Process Volume (see below). |
110
+ | **User Interface** | UMG widget materials. |
111
+
112
+ **Blend Mode**: Opaque / Masked (uses Opacity Mask + a mask clip value) / Translucent (uses
113
+ Opacity) / Additive / Modulate. **Shading Model**: Default Lit / Unlit / Subsurface / Clear Coat /
114
+ Two Sided Foliage / Hair / Eye / Cloth / Single Layer Water.
115
+
116
+ Match the pin to the mode: Opacity needs Translucent/Additive; Opacity Mask needs Masked; feeding
117
+ the wrong one is a silent no-op.
118
+
119
+ ### Custom HLSL node
120
+
121
+ The escape hatch when the node set can't express the logic (loops, bitwise, custom math). Set the
122
+ node's **Output Type**, add named **Inputs** (they become HLSL variables), write HLSL, `return`:
123
+
124
+ ```hlsl
125
+ // Inputs: Time (Scalar), UV (Vector2), Freq (Scalar). Output Type: CMOT Float3.
126
+ float scan = 0.5 + 0.5 * sin(UV.y * Freq + Time * 6.2831);
127
+ float rim = pow(1.0 - saturate(dot(normalize(V), normalize(N))), 3.0); // wire V,N as inputs
128
+ return float3(scan, scan, scan) * rim;
129
+ ```
130
+
131
+ Prefer graph nodes for anything nodes *can* express — Custom nodes block constant-folding and
132
+ some cross-platform optimizations. Reuse shared logic via **Material Functions**.
133
+
134
+ ### Material Instances
135
+
136
+ Mark parameters (right-click a constant → *Convert to Parameter*): Scalar, Vector, Texture,
137
+ StaticSwitch. A **Material Instance Constant** is an authored variant; a **Dynamic Material
138
+ Instance** (`CreateDynamicMaterialInstance`) is set at runtime:
139
+
140
+ ```cpp
141
+ UMaterialInstanceDynamic* MID = Mesh->CreateDynamicMaterialInstance(0, BaseMat);
142
+ MID->SetScalarParameterValue("Dissolve", 0.7f);
143
+ MID->SetVectorParameterValue("EdgeColor", FLinearColor(1, 0.4f, 0));
144
+ ```
145
+
146
+ Static switches compile out branches into variants; use them for feature toggles rather than a
147
+ runtime `if`.
148
+
149
+ ### Post-process material
150
+
151
+ Set Material Domain = **Post Process**, add it to a **Post Process Volume** (or camera). Read the
152
+ frame with **SceneTexture** nodes — `PostProcessInput0` (scene color), `SceneDepth`, world normal,
153
+ custom-depth/custom-stencil for masking specific actors. **Blendable Location** (Before/After
154
+ Tonemapping, etc.) sets ordering; SceneTexture nodes only work in this domain.
155
+
156
+ ---
157
+
158
+ ## Godot ↔ Unity ↔ Unreal quick map
159
+
160
+ | Concept | Godot 4 | Unity URP | Unreal 5 |
161
+ | --- | --- | --- | --- |
162
+ | Color output | `ALBEDO` / `EMISSION` | Base Color / Emission block | Base Color / Emissive Color |
163
+ | Alpha cutout | `discard` / `ALPHA_SCISSOR_THRESHOLD` | `clip()` / Alpha Clip Threshold | Opacity Mask (Masked) |
164
+ | Fresnel/rim | `1 - dot(NORMAL, VIEW)` | Fresnel Effect node | Fresnel node |
165
+ | Screen color | `hint_screen_texture` | Scene Color node / opaque texture | SceneTexture: PostProcessInput0 |
166
+ | Scene depth | `hint_depth_texture` | Scene Depth node | SceneTexture: SceneDepth |
167
+ | Time | `TIME` | Time node / `_Time.y` | Time node |
168
+ | Runtime param | `set_shader_parameter` | `Material.SetFloat` | `SetScalarParameterValue` (MID) |
169
+ | Full-screen FX | ColorRect + `hint_screen_texture` / CompositorEffect | Full Screen Pass Renderer Feature | Post Process material + volume |