05 · 可选效果与设置
本 ZIP 包含全部所需文件,不依赖前一章。解压为游戏 shaderpacks 目录的直接子目录。静态收据与实机观察分别记录。
下载与身份
ZIP SHA-256:
6a0ddf77300c99a49fce65f7f894adac9ffed250c317477048f2c8549f5e9d40源码指纹:
9b79e19737d998178227184552c9221bf12b05fa1b27f9d551519cfbf7293770完整源码
README.md
md
# Amber course 05-options / 琥珀课程
Website-authored teaching pack, Manifest 5 / Scene ABI 2, host f8aaa5c4218f54536ccf994a2d512aed2e3678b7.
## Install / 安装
Extract the ZIP as shaderpacks/05-options/shaderpack.json (no extra wrapper folder). In a creative test world run /switchshader 05-options. Use the authored Shader Pack settings to edit options and apply. Reload by switching to the same pack again. /switchshader builtin restores BuiltIn.
ZIP 解压后根目录直接包含 shaderpack.json。使用创造测试世界;修改设置后应用,切换同名包可重载。
## Appearance / 效果
Amber uses a gentle warm contrast.
Chapter 05 returns from the MRT debug view to the chapter 03 color pipeline; the extra debug attachments are deliberately removed. Terrain alpha-tested, transparent and sorted-translucent routes keep host BuiltIn fallback.
## Options / 选项
course:grade (default true): disabling removes grade from the active closure and presents scene color directly. course:strength (0–1, default 0.65) is a Program define and recompiles.
## Verify / 验证
Run the pinned shaderpack-analyzer pack validate, scene explain, graph dump --contract 2 and program interface --contract 2 commands. For options use scene --options and data commands --options. Graph CLI on this baseline does not consume option overrides: use dawnlight/dumpGraph JSON-RPC inputs.options for branch graphs. See https://core.eltancex.top/tutorial/05-options and its English counterpart.
Check source/archive SHA-256 against the website inventory. Static success does not prove GPU compilation or runtime data. Use a creative world; load, edit settings, reload, resize, export reports, then switch to BuiltIn. Test Android, VR, different GPUs and device loss separately. No universal compatibility, performance gate or release-ready claim.
## Ownership / 来源
Course source: https://github.com/EltanceX/dawnlight-core-docs/tree/main/examples/course/05-options
Public host contracts: https://gitea.com/EltanceX/DawnlightCore at the pinned commit above. No host binary or private source is included.1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
settings.json
json
{
"schemaVersion": 1,
"defaultLocale": "en-US",
"translations": {
"zh-CN": {
"page.amber": "琥珀课程",
"course:grade": "调色",
"course:strength": "调色强度(重新编译)"
},
"en-US": {
"page.amber": "Amber course",
"course:grade": "Color grade",
"course:strength": "Grade strength (recompile)"
}
},
"pages": [
{
"id": "amber",
"title": "page.amber",
"groups": [
{
"id": "look",
"controls": [
{
"id": "grade",
"option": "course:grade",
"widget": "toggle",
"label": "course:grade"
},
{
"id": "strength",
"option": "course:strength",
"widget": "slider",
"label": "course:strength",
"min": 0,
"max": 1,
"step": 0.05,
"format": "0.00",
"enabledWhen": [
{
"option": "course:grade",
"equals": true
}
]
}
]
}
]
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
shaderpack.json
json
{
"manifestVersion": 5,
"sceneAbiVersion": 2,
"expectedCatalogSha256": "4bc28c17beffea2311a422fff9f633d2e4f03784460d0254adda8af2e766d84c",
"id": "course:05-options",
"name": "Dawnlight Course · Amber 05-options",
"version": "1.0.0",
"author": "EltanceX",
"description": "Website-authored Amber course snapshot; see README for tested scope.",
"shaderRoot": "shaders",
"options": [
{
"id": "course:grade",
"type": "boolean",
"default": true,
"impact": [
"pipeline",
"resources"
]
},
{
"id": "course:strength",
"type": "number",
"default": 0.65,
"min": 0,
"max": 1,
"impact": [
"program"
]
}
],
"resources": [
{
"id": "course:scene/color",
"kind": "texture2D",
"lifetime": "persistent",
"size": {
"mode": "viewport"
},
"format": "rgba8"
},
{
"id": "course:scene/depth",
"kind": "texture2D",
"lifetime": "persistent",
"size": {
"mode": "viewport"
},
"format": "depth24"
},
{
"id": "course:post/color",
"kind": "texture2D",
"lifetime": "persistent",
"size": {
"mode": "viewport"
},
"format": "rgba8"
}
],
"programs": [
{
"id": "course:scene/terrain",
"kind": "graphics",
"vertex": "terrain.vsh",
"fragment": "terrain.psh",
"compileMode": "officialCompatible"
},
{
"id": "course:post/grade",
"kind": "graphics",
"vertex": "fullscreen.vsh",
"fragment": "grade.psh",
"compileMode": "manifestDriven",
"defines": {
"GRADE_STRENGTH": {
"option": "course:strength"
}
}
},
{
"id": "course:post/present",
"kind": "graphics",
"vertex": "fullscreen.vsh",
"fragment": "present.psh",
"compileMode": "manifestDriven"
}
],
"frameTarget": {
"targets": {
"colors": [
{
"location": 0,
"resource": "course:scene/color",
"loadOp": "clear",
"storeOp": "store",
"clearValue": [
0,
0,
0,
1
]
}
],
"depth": {
"resource": "course:scene/depth",
"loadOp": "clear",
"storeOp": "store",
"clearValue": 1
}
}
},
"passes": [
{
"id": "course:terrain_opaque",
"enabled": true,
"stage": {
"template": "dawnlight:command_list",
"version": 1,
"target": "world",
"phase": "opaque"
},
"services": [],
"programs": [
"course:scene/terrain"
],
"commands": [
{
"type": "engineDraw",
"sceneProvider": {
"id": "dawnlight:scene_draw/terrain_opaque",
"version": 2
},
"targets": {
"colors": [
{
"location": 0,
"resource": "course:scene/color",
"loadOp": "load",
"storeOp": "store"
}
],
"depth": {
"resource": "course:scene/depth",
"loadOp": "clear",
"storeOp": "store",
"clearValue": 1
}
},
"state": {
"blend": "opaque",
"depth": "default",
"rasterizer": "cullCounterClockwiseScissor"
},
"viewport": {
"source": "target",
"restore": "frame",
"synchronizeScissor": true
},
"program": "course:scene/terrain",
"sceneBindings": [
{
"symbol": "u_viewProjectionMatrix",
"contract": "dawnlight:scene_binding/view_projection",
"version": 1,
"frequency": "view"
},
{
"symbol": "u_origin",
"contract": "dawnlight:scene_binding/terrain_origin",
"version": 1,
"frequency": "view"
},
{
"symbol": "u_lightTable",
"contract": "dawnlight:scene_binding/light_table",
"version": 1,
"frequency": "batch"
},
{
"symbol": "u_texture",
"contract": "dawnlight:scene_binding/block_texture",
"version": 1,
"frequency": "draw",
"binding": 0
}
]
}
],
"inputs": [
"course:scene/color",
"course:scene/depth"
],
"outputs": [
"course:scene/color",
"course:scene/depth"
]
},
{
"id": "course:terrain_alpha_tested",
"enabled": true,
"stage": {
"template": "dawnlight:command_list",
"version": 1,
"target": "world",
"phase": "opaque",
"ordering": {
"after": [
"course:terrain_opaque"
]
}
},
"services": [],
"programs": [],
"commands": [
{
"type": "engineDraw",
"sceneProvider": {
"id": "dawnlight:scene_draw/terrain_alpha_tested",
"version": 2
},
"targets": {
"colors": [
{
"location": 0,
"resource": "course:scene/color",
"loadOp": "load",
"storeOp": "store"
}
],
"depth": {
"resource": "course:scene/depth",
"loadOp": "load",
"storeOp": "store"
}
},
"state": {
"blend": "opaque",
"depth": "default",
"rasterizer": "cullCounterClockwiseScissor"
},
"viewport": {
"source": "target",
"restore": "frame",
"synchronizeScissor": true
}
}
],
"inputs": [
"course:scene/color",
"course:scene/depth"
],
"outputs": [
"course:scene/color",
"course:scene/depth"
]
},
{
"id": "course:terrain_transparent",
"enabled": true,
"stage": {
"template": "dawnlight:command_list",
"version": 1,
"target": "world",
"phase": "transparent"
},
"services": [],
"programs": [],
"commands": [
{
"type": "engineDraw",
"sceneProvider": {
"id": "dawnlight:scene_draw/terrain_transparent",
"version": 2
},
"targets": {
"colors": [
{
"location": 0,
"resource": "course:scene/color",
"loadOp": "load",
"storeOp": "store"
}
],
"depth": {
"resource": "course:scene/depth",
"loadOp": "load",
"storeOp": "store"
}
},
"state": {
"blend": "alphaBlend",
"depth": "default",
"rasterizer": "cullCounterClockwiseScissor"
},
"viewport": {
"source": "target",
"restore": "frame",
"synchronizeScissor": true
}
}
],
"inputs": [
"course:scene/color",
"course:scene/depth"
],
"outputs": [
"course:scene/color",
"course:scene/depth"
]
},
{
"id": "course:terrain_sorted_translucent",
"enabled": true,
"stage": {
"template": "dawnlight:command_list",
"version": 1,
"target": "world",
"phase": "transparent",
"ordering": {
"after": [
"course:terrain_transparent"
]
}
},
"services": [],
"programs": [],
"commands": [
{
"type": "engineDraw",
"sceneProvider": {
"id": "dawnlight:scene_draw/terrain_sorted_translucent",
"version": 2
},
"targets": {
"colors": [
{
"location": 0,
"resource": "course:scene/color",
"loadOp": "load",
"storeOp": "store"
}
],
"depth": {
"resource": "course:scene/depth",
"loadOp": "load",
"storeOp": "store"
}
},
"state": {
"blend": "alphaBlend",
"depth": "default",
"rasterizer": "cullCounterClockwiseScissor"
},
"viewport": {
"source": "target",
"restore": "frame",
"synchronizeScissor": true
}
}
],
"inputs": [
"course:scene/color",
"course:scene/depth"
],
"outputs": [
"course:scene/color",
"course:scene/depth"
]
},
{
"id": "course:grade",
"enabled": true,
"stage": {
"template": "dawnlight:command_list",
"version": 1,
"target": "afterDraw",
"phase": "afterDraw"
},
"services": [],
"programs": [
"course:post/grade"
],
"commands": [
{
"type": "fullscreen",
"program": "course:post/grade",
"bindings": [
{
"kind": "sampler2D",
"symbol": "u_sceneColor",
"binding": 0,
"resource": "course:scene/color"
}
],
"state": {
"blend": "opaque",
"depth": "disabled",
"rasterizer": "cullNoneScissor"
},
"viewport": {
"source": "target",
"restore": "frame",
"synchronizeScissor": true
},
"targets": {
"colors": [
{
"location": 0,
"resource": "course:post/color",
"loadOp": "dontCare",
"storeOp": "store"
}
]
}
}
],
"inputs": [
"course:scene/color"
],
"outputs": [
"course:post/color"
],
"enabledWhen": [
{
"option": "course:grade",
"equals": true
}
]
},
{
"id": "course:present-grade",
"enabled": true,
"stage": {
"template": "dawnlight:command_list",
"version": 1,
"target": "afterDraw",
"phase": "screenOutput",
"ordering": {
"after": [
"course:grade"
]
}
},
"services": [],
"programs": [
"course:post/present"
],
"commands": [
{
"type": "present",
"program": "course:post/present",
"bindings": [
{
"kind": "sampler2D",
"symbol": "u_postColor",
"binding": 0,
"resource": "course:post/color"
}
],
"state": {
"blend": "opaque",
"depth": "disabled",
"rasterizer": "cullNoneScissor"
},
"viewport": {
"source": "frame",
"restore": "none",
"synchronizeScissor": true
}
}
],
"inputs": [
"course:post/color"
],
"outputs": [],
"enabledWhen": [
{
"option": "course:grade",
"equals": true
}
]
},
{
"id": "course:present-raw",
"enabled": true,
"stage": {
"template": "dawnlight:command_list",
"version": 1,
"target": "afterDraw",
"phase": "screenOutput"
},
"services": [],
"programs": [
"course:post/present"
],
"commands": [
{
"type": "present",
"program": "course:post/present",
"bindings": [
{
"kind": "sampler2D",
"symbol": "u_postColor",
"binding": 0,
"resource": "course:scene/color"
}
],
"state": {
"blend": "opaque",
"depth": "disabled",
"rasterizer": "cullNoneScissor"
},
"viewport": {
"source": "frame",
"restore": "none",
"synchronizeScissor": true
}
}
],
"inputs": [
"course:scene/color"
],
"outputs": [],
"enabledWhen": [
{
"option": "course:grade",
"equals": false
}
]
}
],
"sceneCategories": [
{
"id": "dawnlight:scene/terrain_opaque",
"version": 1,
"mode": "override",
"stage": "course:terrain_opaque"
},
{
"id": "dawnlight:scene/terrain_alpha_tested",
"version": 1,
"mode": "builtin"
},
{
"id": "dawnlight:scene/terrain_transparent",
"version": 1,
"mode": "builtin"
},
{
"id": "dawnlight:scene/terrain_sorted_translucent",
"version": 1,
"mode": "builtin"
}
],
"settings": "settings.json"
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
shaders/fullscreen.vsh
glsl
#version 320 es
precision highp float;
out vec2 v_uv;
void main() {
const vec2 corners[4] = vec2[4](vec2(-1.0, -1.0), vec2(1.0, -1.0), vec2(-1.0, 1.0), vec2(1.0, 1.0));
vec2 position = corners[gl_VertexID & 3];
v_uv = position * 0.5 + 0.5;
gl_Position = vec4(position, 0.0, 1.0);
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
shaders/grade.psh
glsl
#version 320 es
precision highp float;
uniform sampler2D u_sceneColor;
in vec2 v_uv;
layout(location = 0) out vec4 o_color;
void main() {
vec3 source = texture(u_sceneColor, v_uv).rgb;
vec3 amber = (source - 0.5) * 1.06 + 0.5;
amber *= vec3(1.06, 1.0, 0.93);
o_color = vec4(clamp(mix(source, amber, float(GRADE_STRENGTH)), 0.0, 1.0), 1.0);
}1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
shaders/present.psh
glsl
#version 320 es
precision highp float;
uniform sampler2D u_postColor;
in vec2 v_uv;
layout(location = 0) out vec4 o_color;
void main() {
o_color = texture(u_postColor, v_uv);
}1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
shaders/terrain.psh
glsl
#version 320 es
// <Sampler Name='u_samplerState' Texture='u_texture' />
precision highp float;
precision highp int;
uniform sampler2D u_texture;
in vec2 v_texcoord;
in vec4 v_color;
layout(location = 0) out vec4 o_sceneColor;
void main() {
vec4 albedo = texture(u_texture, v_texcoord) * v_color;
o_sceneColor = vec4(albedo.rgb * vec3(0.92, 1.0, 0.92), albedo.a);
}1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
shaders/terrain.vsh
glsl
#version 320 es
// <Semantic Name='TEXCOORD' Attribute='a_texcoord' />
// <Semantic Name='POSITION' Attribute='a_position' />
// <Semantic Name='COLOR' Attribute='a_color' />
// <Semantic Name='IDENTIFIER' Attribute='a_identifier' />
// <Semantic Name='NORMAL' Attribute='a_normal' />
// <Semantic Name='LIGHTLEVEL' Attribute='a_lightLevel' />
// <Semantic Name='PURELIGHT' Attribute='a_pureLight' />
// <Semantic Name='HEIGHTDATA' Attribute='a_heightData' />
uniform mat4 u_viewProjectionMatrix;
uniform vec2 u_origin;
uniform float u_lightTable[96];
layout(location = 0) in vec2 a_texcoord;
layout(location = 1) in vec3 a_position;
layout(location = 2) in vec4 a_color;
layout(location = 3) in uint a_identifier;
layout(location = 4) in vec3 a_normal;
layout(location = 5) in float a_lightLevel;
layout(location = 6) in float a_pureLight;
layout(location = 7) in float a_heightData;
out vec2 v_texcoord;
out vec4 v_color;
out vec3 v_normalEncoded;
flat out highp uint v_identifier;
void main() {
int lightIndex = clamp(int(a_lightLevel) - 1, 0, 95);
float light = clamp(u_lightTable[lightIndex], 0.0, 1.0);
v_texcoord = a_texcoord;
v_color = vec4(a_color.rgb * light, a_color.a);
v_normalEncoded = clamp(a_normal / 255.0, 0.0, 1.0);
v_identifier = a_identifier;
vec3 relativePosition = vec3(a_position.x - u_origin.x, a_position.y, a_position.z - u_origin.y);
gl_Position = u_viewProjectionMatrix * vec4(relativePosition, 1.0);
OPENGL_POSITION_FIX;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
验证范围
固定 Analyzer 对源码和新解压 ZIP 执行 pack、scene、graph 和全部 Program interface 检查,归一化输出哈希一致。此静态收据不提供驱动或真实世界结论;日期明确的运行观察与限制见对应章节。