Skip to content
Open
Show file tree
Hide file tree
Changes from 123 commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
6802991
refactor(core): migrate shaders from core/shaderlib to shader package…
zhuxudong Apr 8, 2026
ffb3cd2
fix(shader): move camera_ProjectionParams to Common.glsl and fix test…
zhuxudong Apr 9, 2026
c197623
refactor(shader): reorganize into Shaders/ + ShaderLibrary/ and migra…
zhuxudong Apr 10, 2026
826abfd
fix(shader): restore original FXAA3_11.glsl and align FinalAntiAliasi…
zhuxudong Apr 13, 2026
ff3d86e
refactor(shader): use shared Utility UsePass for ShadowCaster/DepthOn…
zhuxudong Apr 13, 2026
1dd8f99
refactor(shader): remove shader path/chunk loading and ShaderChunkLoader
zhuxudong Apr 13, 2026
92b67cf
refactor(shader): sync curl noise and particle noise module from PR #…
zhuxudong Apr 13, 2026
b337fd8
refactor(shader): simplify registerShaders to use Shader.create directly
zhuxudong Apr 13, 2026
240b166
refactor(shader): make shader package pure data and auto-register fro…
zhuxudong Apr 13, 2026
9ff0d11
fix(shader): remove duplicate lowercase shaders/index.ts from git index
zhuxudong Apr 13, 2026
1d10bdd
fix(shader): add RenderQueueType variable binding to ShadowCaster and…
zhuxudong Apr 13, 2026
8e108e2
refactor(shader): precompile .shader files at build time and init early
zhuxudong Apr 14, 2026
9031bc4
fix(shader): correct shadow sampling and BlinnPhong skinning normal t…
zhuxudong Apr 14, 2026
b7c1750
refactor(shader): use precompiled .gsp files for built-in shaders and…
zhuxudong Apr 14, 2026
a2c0286
refactor(shader): revert lazy init and migrate render states to .shader
zhuxudong Apr 14, 2026
18e4c06
fix(shader): remove duplicate lowercase shader paths from git index
zhuxudong Apr 14, 2026
db8e322
refactor(shader): migrate render states to shaderData and fix precomp…
zhuxudong Apr 14, 2026
db902e7
fix(core): restore shaderLab init to _initialize to match dev/2.0
zhuxudong Apr 14, 2026
fa03f1b
feat(shader): add and fix Editor properties for built-in shaders
zhuxudong Apr 15, 2026
752f508
fix(shader): export Particle, Trail, Skybox, SkyProcedural from /sour…
zhuxudong Apr 15, 2026
2a15b7f
fix(shader): fix type resolution for .gsp imports and update types paths
zhuxudong Apr 15, 2026
6629e9e
refactor(shader-lab): strip comments before preprocessing and unify c…
zhuxudong Apr 15, 2026
4dbaef3
refactor(shader): auto-generate libs/index.ts, fix build pipeline, an…
zhuxudong Apr 17, 2026
c524e21
fix(shader): fix review issues from PR #2961 audit
zhuxudong Apr 17, 2026
762e332
fix(shader): remove UIScript placeholders and export SpriteSource
zhuxudong Apr 17, 2026
ce62b04
refactor(shader): remove PBRSpecular shader
zhuxudong Apr 17, 2026
a69041d
fix(shader-lab): support macro-defined type aliases in LALR parser
zhuxudong Apr 20, 2026
9aa355e
fix(test): update tests for renamed shaders and variable-bound render…
zhuxudong Apr 20, 2026
1551a70
fix(shader): update include paths and UsePass refs after migration
zhuxudong Apr 20, 2026
f9cfd90
fix: include global.d.ts in shader types output for /sources subpath
zhuxudong Apr 20, 2026
c542fe4
refactor(e2e): remove engine-toolkit dependency
zhuxudong Apr 20, 2026
1dd3455
refactor(shader): extract Common/Attributes.glsl from PBR
zhuxudong Apr 20, 2026
0251af9
refactor(shader): remove Varyings placeholder from DepthOnly
zhuxudong Apr 20, 2026
87b7557
chore: merge dev/2.0 and resolve conflicts
zhuxudong Apr 20, 2026
9174bfa
Merge remote-tracking branch 'origin/dev/2.0' into refactor/glsl-to-s…
zhuxudong Apr 20, 2026
95a2448
style(shader-lab): fix prettier formatting in CFG.ts
zhuxudong Apr 20, 2026
13ab0a7
refactor(shader): replace inline Attributes with Common/Attributes.glsl
zhuxudong Apr 21, 2026
5d356ee
refactor(e2e): migrate shaders to ShaderLab syntax
zhuxudong Apr 21, 2026
ed5d7b1
build(shader): update gsp precompiled outputs
zhuxudong Apr 21, 2026
6dfbdac
fix(e2e): move Shader.create after engine init in opaque-texture
zhuxudong Apr 21, 2026
2f1160b
fix(build): use pathToFileURL for Windows ESM import compatibility
zhuxudong Apr 21, 2026
080b0e2
refactor(core): clean up dead code after shader migration
zhuxudong Apr 21, 2026
89de157
docs(shader): update docs for ShaderLab migration
zhuxudong Apr 21, 2026
4ef73cb
fix(test): replace stale GLSL includes in Shader.test.ts
zhuxudong Apr 21, 2026
b78ce6b
fix(shader): fix Windows build by normalizing path separators
zhuxudong Apr 21, 2026
338f158
chore: merge dev/2.0 and resolve test conflicts
zhuxudong Apr 21, 2026
d349163
fix(shader): initialize render state variables for BaseMaterial and e…
zhuxudong Apr 22, 2026
d6bd7ff
fix(core): split constant/variable render state so Material.renderSta…
zhuxudong Apr 22, 2026
eb88bf5
fix(shader): remove duplicate camera_VPMat declarations in DepthOnly …
zhuxudong Apr 22, 2026
10a9d82
refactor(shader): migrate Particle shaders to ShaderLab Attributes pa…
zhuxudong Apr 22, 2026
99d96e1
fix(e2e): use shaderData for custom blend factors in canvas-transparency
zhuxudong Apr 22, 2026
c2a6842
fix(shader): remove duplicate camera_ProjectionParams in BackgroundTe…
zhuxudong Apr 22, 2026
0f98d18
fix(shader): use all-variable render state for Particle and Trail sha…
zhuxudong Apr 22, 2026
392c54e
fix(shader): add missing normalize for interpolated normal in BlinnPh…
zhuxudong Apr 22, 2026
0ac96a2
fix(shader): remove duplicate clearCoat roughness AA factor in PBR ge…
zhuxudong Apr 22, 2026
0e3988b
refactor(core): per-property render state priority with material.rend…
zhuxudong Apr 23, 2026
fd58554
fix(shader): use geometric TBN for clear coat normal texture
zhuxudong Apr 23, 2026
326c046
fix(shader): update PBR.gsp for clear coat TBN fix
zhuxudong Apr 23, 2026
d7bdbe8
test(e2e): update physx-customUrl baseline after removing engine-tool…
zhuxudong Apr 24, 2026
e1bd8ea
test(e2e): update physx-collision baseline after removing engine-tool…
zhuxudong Apr 24, 2026
a2ff3b8
refactor(core): remove unused TransformFeedbackShader
zhuxudong Apr 24, 2026
7d2b096
test(core): add render state priority and BaseMaterial render API tests
zhuxudong Apr 24, 2026
27d797d
test(core): extend BaseMaterial with alphaCutoff branch coverage
zhuxudong Apr 24, 2026
2d89bf6
refactor(shader): address review feedback on render state and PBR
zhuxudong Apr 27, 2026
b9e4d4f
build(shader-lab): consolidate build tooling into @galacean/engine-sh…
zhuxudong Apr 28, 2026
65df8ea
docs(shader): rename shaderlab-XX tutorials to shader-XX
GuoLei1990 Apr 28, 2026
ee6e8c0
refactor(shader-compiler): rename ShaderLab to ShaderCompiler
GuoLei1990 Apr 28, 2026
ea94e41
build(shader-compiler): register project-local glsl includes during p…
zhuxudong Apr 28, 2026
e229654
refactor(shader-compiler): drop library option from precompile API
zhuxudong Apr 28, 2026
1f17f50
chore(shader-compiler): merge dev/2.0 macro AST refactor
zhuxudong Apr 28, 2026
6312a6c
fix(shader-compiler): drop dead Lexer comment-stripping override
zhuxudong Apr 28, 2026
bc91ce5
fix(shader-compiler): strip comments before include regex
zhuxudong Apr 28, 2026
25c6fe2
refactor(shader-compiler): unify macro-as-type-alias via type_specifi…
zhuxudong Apr 28, 2026
10f8870
fix(shader-compiler): bootstrap standalone runtime build for cold-sta…
zhuxudong Apr 28, 2026
2a7e6b4
fix(shader-compiler): accept MACRO_CALL as declarator name
zhuxudong Apr 28, 2026
93c4908
fix(shader-compiler): emit prettier-friendly libs/index.ts
zhuxudong Apr 28, 2026
23dec05
fix(shader-compiler): use // prettier-ignore for libs/index.ts export…
zhuxudong Apr 28, 2026
28cb88d
fix(shader-compiler): bootstrap-safe precompile (skip when runtime mi…
zhuxudong Apr 28, 2026
0b9d0e2
style(shader-compiler): apply prettier wrap in bundler index
zhuxudong Apr 28, 2026
70fc755
refactor(shader-compiler): unify precompile watch into startWatcher
zhuxudong Apr 28, 2026
5c07850
fix(shader-compiler): emit triple-slash reference in libs/index.ts
zhuxudong Apr 29, 2026
967bad8
refactor(shader-compiler): drop triple-slash hint in libs/index.ts
zhuxudong Apr 29, 2026
90d39ff
refactor(shader): rename libs/ to compiled/ for clearer intent
GuoLei1990 Apr 29, 2026
1747515
refactor(shader): regroup Particle/Trail under Effect/ namespace
GuoLei1990 Apr 29, 2026
e08af33
refactor(shader): remove raw GLSL shader path
GuoLei1990 Apr 29, 2026
8f2da42
test(e2e): migrate raw GLSL shader cases to ShaderLab
GuoLei1990 Apr 29, 2026
0f6c425
refactor: migrate remaining raw GLSL Shader.create callers to ShaderLab
GuoLei1990 Apr 29, 2026
d21484b
refactor(shader): drop material.renderState; align render-state with …
GuoLei1990 Apr 30, 2026
ef118a5
test(e2e): remove redundant sphere render-state seeding in shader-ren…
GuoLei1990 Apr 30, 2026
95355d4
perf(shader): inline render-state resolution; drop _resolveValue and …
GuoLei1990 Apr 30, 2026
3de421c
test(e2e): align spriteMask-customStencil with dev/2.0 usage shape
GuoLei1990 Apr 30, 2026
251be3c
perf(material): cache render-state ShaderProperties; early-return in …
GuoLei1990 Apr 30, 2026
0c99c94
style(mask-manager): camelCase locals; unify stencil checks on explic…
GuoLei1990 Apr 30, 2026
20a0464
style(render-state): replace single-letter locals with descriptive names
GuoLei1990 Apr 30, 2026
8d61263
refactor(shader): simplify _resolveUsePass parsing
GuoLei1990 Apr 30, 2026
22812d1
refactor(shader): drop redundant +k coercion in _applyRenderStates
GuoLei1990 Apr 30, 2026
6835a70
refactor(shader): merge ShaderLib map into ShaderFactory
GuoLei1990 Apr 30, 2026
f1a7af0
feat(shader): restore relative-path resolution for #include
GuoLei1990 Apr 30, 2026
33f0318
refactor(shader): rename ShaderLibrary directory to chunks
GuoLei1990 Apr 30, 2026
4bb88a5
Revert "refactor(shader): rename ShaderLibrary directory to chunks"
GuoLei1990 Apr 30, 2026
8a529db
build(shader): auto-generate ShaderLibrary index from disk
GuoLei1990 Apr 30, 2026
b5706d7
refactor(shader): clean up engine-shader package layout for editor + …
GuoLei1990 May 1, 2026
59a1361
fix(shader): prevent prettier from rewriting generated source indexes
GuoLei1990 May 1, 2026
57c167b
test(e2e): bump #include paths to the new ShaderLibrary/ namespace
GuoLei1990 May 1, 2026
6f26218
revert(shader-compiler): drop bug-fix logic on top of dev/2.0 baseline
GuoLei1990 May 1, 2026
e324909
revert(shader-compiler): also drop early CFG/AST bug-fix commits
GuoLei1990 May 1, 2026
923fca1
revert(shader-compiler): drop a69041d6f ShaderTargetParser/ShaderComp…
GuoLei1990 May 1, 2026
ecf03cf
revert(shader-compiler): drop unused removeComments / skipComment hel…
GuoLei1990 May 1, 2026
3040ab5
fix(shader): restore stripped comments in ScalableAmbientOcclusion.glsl
GuoLei1990 May 1, 2026
87cb2b5
fix(shader-compiler): correct macro identifier handling and surface p…
GuoLei1990 May 1, 2026
b8b18b1
refactor(shader): unify shader-source path field across sources entry
GuoLei1990 May 1, 2026
0a269a7
chore(shader-compiler): sync TargetParser.y with CFG.ts macro-declara…
GuoLei1990 May 1, 2026
f85c7a9
fix(shader-compiler): keep sibling-arm var declaration across cross-#…
GuoLei1990 May 1, 2026
7a71057
refactor(shader): reorganize shader directory taxonomy
GuoLei1990 May 1, 2026
ea2d000
refactor(shader-compiler): decouple precompile from build artifacts v…
GuoLei1990 May 1, 2026
bd50c31
fix(test): inject ShaderFactory._includeMap when assigning Shader._sh…
GuoLei1990 May 1, 2026
7eb144f
refactor(core): consolidate ShaderFactory into shader/ and trim dead …
GuoLei1990 May 1, 2026
cae5296
refactor(shader): tighten tangent gating in PBR/BlinnPhong to skip un…
GuoLei1990 May 1, 2026
375e5c5
fix(e2e): align shader-mrt UsePass path and refresh particle baseline
GuoLei1990 May 1, 2026
68d30d8
fix(e2e): make particle shape-transform deterministic by deferring en…
GuoLei1990 May 1, 2026
7fad7d4
refactor(shader): tidy ShaderLibrary layout and drop dead Common chunks
GuoLei1990 May 1, 2026
b7db30b
refactor(shader): rename .gsp precompile artifact to .shaderc
GuoLei1990 May 1, 2026
a34ebcf
refactor(shader-compiler): make standalone with math as sole runtime dep
GuoLei1990 May 2, 2026
80077fc
refactor(shader-compiler): tighten b:compiler resolve to debug-only a…
GuoLei1990 May 2, 2026
e639e5a
refactor(core): move flavor bootstrap (ShaderPool / Polyfill / System…
GuoLei1990 May 4, 2026
ee1d9f3
test: import WebGLEngine from the umbrella package, matching real use…
GuoLei1990 May 4, 2026
8f55285
test(e2e): allow 4-pixel LSB tolerance for animator-reuse
GuoLei1990 May 6, 2026
1e1b99c
refactor(core): hide RenderState classes from public exports
GuoLei1990 May 6, 2026
3251b0c
test(state): import state classes via @galacean/engine-core/src after…
GuoLei1990 May 6, 2026
5799bd5
fix(build): chain precompile before watch/dev
zhuxudong May 7, 2026
ced0005
fix(shader-compiler): scope repeat-include warn
zhuxudong May 7, 2026
a1e0f5d
fix(shader): declare queue var in pipeline passes
zhuxudong May 7, 2026
04e0509
fix(shader-compiler): skip block-comment include
zhuxudong May 7, 2026
c10d7d7
fix(loader): remove material.renderState parsing
zhuxudong May 7, 2026
f7f2887
fix(shader-compiler): clear chunk cache on watch include edits
zhuxudong May 7, 2026
7597b17
refactor(shader-compiler): scope chunk cache to ShaderCompiler instance
GuoLei1990 May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion docs/en/basics/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Includes the following sub-packages:
| [@galacean/engine](https://www.npmjs.com/package/@galacean/engine) | Core architecture logic and core functionalities | [API](/apis/galacean) |
| [@galacean/engine-physics-lite](https://www.npmjs.com/package/@galacean/engine-physics-lite) | Lightweight physics engine | [Doc](/en/docs/physics/overall) |
| [@galacean/engine-physics-physx](https://www.npmjs.com/package/@galacean/engine-physics-physx) | Full-featured physics engine | [Doc](/en/docs/physics/overall) |
| [@galacean/engine-shaderlab](https://www.npmjs.com/package/@galacean/engine-shaderlab) | Galacean Shader compiler | [Doc](/en/docs/graphics/material/shader) |
| [@galacean/engine-shader-compiler](https://www.npmjs.com/package/@galacean/engine-shader-compiler) | Galacean Shader compiler | [Doc](/en/docs/graphics/material/shader) |
| [@galacean/engine-xr](https://www.npmjs.com/package/@galacean/engine-xr) | XR logic package | [Doc](/en/docs/xr/overall) |
| [@galacean/engine-xr-webxr](https://www.npmjs.com/package/@galacean/engine-xr-webxr) | WebXR backend | [Doc](/en/docs/xr/overall) |
| [@galacean/engine-ui](https://www.npmjs.com/package/@galacean/engine-ui) | UI | [Doc](/en/docs/UI/overall) |
Expand Down
8 changes: 4 additions & 4 deletions docs/en/graphics/material/baseUse.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can select materials in the editor and switch shaders to observe real-time r

<Image src="https://gw.alipayobjects.com/zos/OasisHub/cd87c11a-7a68-4cde-a19a-40cff943e878/2025-02-10%25252017.05.33.gif" />

Each shader has different rendering effects and application scenarios. For more details, refer to [Built-in Shader Tutorial](/en/docs/graphics/material/builtinShaders/pbr/) and [Custom Shader Tutorial](/en/docs/graphics/material/examples/shaderlab-01-basic-shader).
Each shader has different rendering effects and application scenarios. For more details, refer to [Built-in Shader Tutorial](/en/docs/graphics/material/builtinShaders/pbr/) and [Custom Shader Tutorial](/en/docs/graphics/material/examples/shader-01-basic-shader).

## Creating Custom Shaders
If built-in shaders cannot meet your needs, we can create a custom shader. In the editor asset panel, create a new Shader and choose PBR template or Unlit template:
Expand All @@ -54,7 +54,7 @@ The editor will automatically help us create the Shader file and [UIScript](/en/
/>

<Callout type="info">
For specific shader content writing, you can quickly get started with [Custom Shader Tutorial](/en/docs/graphics/material/examples/shaderlab-01-basic-shader).
For specific shader content writing, you can quickly get started with [Custom Shader Tutorial](/en/docs/graphics/material/examples/shader-01-basic-shader).
</Callout>

## Shader Data Transfer
Expand All @@ -72,13 +72,13 @@ Pass "Forward" {
mat4 renderer_MVPMat;

// Through including code fragments
#include "Transform.glsl"
#include "Common/Transform.glsl"
}
...
```

## Next Steps
- [Custom Shader](/en/docs/graphics/material/examples/shaderlab-01-basic-shader) - Start your shader creation journey from scratch
- [Custom Shader](/en/docs/graphics/material/examples/shader-01-basic-shader) - Start your shader creation journey from scratch
- [Shader Syntax Deep Learning](/en/docs/graphics/material/shader) - Complete syntax reference
- [Shader Built-in Variables Reference](/en/docs/graphics/material/variables) - All built-in variables provided by the engine
- [Shader Built-in API Reference](/en/docs/graphics/material/shaderAPI) - All Shader APIs provided by the engine
Expand Down
10 changes: 5 additions & 5 deletions docs/en/graphics/material/examples/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"shaderlab-01-basic-shader": "Basic Shader Syntax",
"shaderlab-02-render-state": "Render State Control",
"shaderlab-03-ui-script": "UIScript System",
"shaderlab-04-multi-pass": "Multi-Pass Rendering",
"shaderlab-05-advance": "Advanced Features & Code Reuse"
"shader-01-basic-shader": "Basic Shader Syntax",
"shader-02-render-state": "Render State Control",
"shader-03-ui-script": "UIScript System",
"shader-04-multi-pass": "Multi-Pass Rendering",
"shader-05-advance": "Advanced Features & Code Reuse"
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
title: Basic Shader Syntax
---

This tutorial will introduce the basic syntax of ShaderLab using a simple texture rendering shader. Through this basic example, you will learn:
- The basic structure of ShaderLab
This tutorial will introduce the basic syntax of Galacean Shader using a simple texture rendering shader. Through this basic example, you will learn:
- The basic structure of Galacean Shader
- How to declare variables and structures
- Basic vertex shader transformations
- Texture sampling in fragment shaders
Expand All @@ -15,7 +15,7 @@ src="https://mdn.alipayobjects.com/huamei_dmxymu/afts/img/A*Ykx2T7IuiAIAAAAAT0AA

## Shader Structure

ShaderLab uses a three-level nested structure: `Shader``SubShader``Pass`
Galacean Shader uses a three-level nested structure: `Shader``SubShader``Pass`

```glsl
Shader "Tutorial/01-BasicShader" {
Expand Down Expand Up @@ -205,4 +205,4 @@ This shader will:
4. Multiply the texture color with the base color to get the final color


Go to [Playground](/examples/shaderlab-01-basic-shader)
Go to [Playground](/examples/shader-01-basic-shader)
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,4 @@ This shader demonstrates:
3. Face culling showing different surfaces
4. Stencil masking implementing complex selection effects

Go to [Playground](/examples/shaderlab-02-render-state) to experience the effect.
Go to [Playground](/examples/shader-02-render-state) to experience the effect.
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@ gl_FragColor = color;
3. Simulates the property binding logic in UIScript
4. Observe the effects of enabling/disabling texture and animation, and the dynamic changes in brightness and contrast

Go to [Playground](/examples/shaderlab-03-ui-script)
Go to [Playground](/examples/shader-03-ui-script)
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,4 @@ This shader will:
* The two passes are combined to create an outline effect.
* You can adjust the outline width and color.

Go to [Playground](/examples/shaderlab-04-multi-pass)
Go to [Playground](/examples/shader-04-multi-pass)
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ src="https://mdn.alipayobjects.com/huamei_dmxymu/afts/img/A*YPhHTr6_96AAAAAAQ-AA
The `#include` directive allows you to reference external code snippets, enabling code reuse:

```glsl
#include "Common.glsl" // Common functions
#include "Skin.glsl" // Skeletal animation
#include "Common/Common.glsl" // Common functions
#include "Skin/Skin.glsl" // Skeletal animation
```

**Benefits:**
Expand All @@ -43,7 +43,7 @@ These snippets are registered by default in the editor. Learn more about the AP

#### Common.glsl - Common Functions
```glsl
#include "Common.glsl"
#include "Common/Common.glsl"

// Provides common mathematical functions and constants
float value = pow2(0.5); // Square function
Expand All @@ -52,7 +52,7 @@ vec4 linearColor = sRGBToLinear(color); // sRGB to linear color conversion

#### Skin.glsl - Skeletal Animation
```glsl
#include "Skin.glsl"
#include "Skin/Skin.glsl"

// Provides skeletal animation-related functions
mat4 skinMatrix = getSkinMatrix(attr);
Expand All @@ -75,7 +75,7 @@ vec4 WEIGHTS_0; // Bone weight
};
``` Skeleton Transformation Calculation
```glsl
#include "Skin.glsl"
#include "Skin/Skin.glsl"

Varyings vert(Attributes Attribute) {
Varyings output;
Expand All @@ -102,7 +102,7 @@ Shader "Tutorial/05-SkinnedUnlit" {
SubShader "Default" {
Pass "Forward" {
// Engine-provided variables and matrices
#include "Transform.glsl"
#include "Common/Transform.glsl"

// Material properties
vec4 material_BaseColor;
Expand All @@ -122,7 +122,7 @@ vec2 uv;
};

// Include engine-provided skinned animation code snippet
#include "Skin.glsl"
#include "Skin/Skin.glsl"

VertexShader = vert;
FragmentShader = frag;
Expand Down Expand Up @@ -238,7 +238,7 @@ gl_FragColor = vec4(normal * 0.5 + 0.5, 1.0);


### 3. Leveraging the Advantages of Macros
During compilation, ShaderLab will remove unused code blocks. Therefore, using macros appropriately can significantly improve performance.
During compilation, the shader compiler will remove unused code blocks. Therefore, using macros appropriately can significantly improve performance.

```glsl
// Without macros: Every pixel needs to be checked
Expand Down Expand Up @@ -271,4 +271,4 @@ This shader will:
2. Use the engine's built-in `Skin.glsl` fragment shader to implement skeletal animation
3. Achieve efficient skeletal animation rendering

Go to [Playground](/examples/shaderlab-05-advance)
Go to [Playground](/examples/shader-05-advance)
6 changes: 3 additions & 3 deletions docs/en/graphics/material/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ material.shaderData.setTexture("material_BaseTexture", texture);
```

<Callout type="info">
Want to get started quickly? Jump directly to [Custom Shader Tutorial](/en/docs/graphics/material/examples/shaderlab-01-basic-shader) to start your first custom shader!
Want to get started quickly? Jump directly to [Custom Shader Tutorial](/en/docs/graphics/material/examples/shader-01-basic-shader) to start your first custom shader!
</Callout>

## Recommended Learning Path

1. **Understand Basics**: Read this overview to understand core material concepts
2. **Experience Built-ins**: Try using [Built-in Shaders](/en/docs/graphics/material/builtinShaders)
3. **Hands-on Practice**: Follow the [Tutorial](/en/docs/graphics/material/examples/shaderlab-01-basic-shader) to create your first custom shader
3. **Hands-on Practice**: Follow the [Tutorial](/en/docs/graphics/material/examples/shader-01-basic-shader) to create your first custom shader
4. **Deep Learning**: Check [Shader Introduction](/en/docs/graphics/material/shader) for complete syntax
5. **Problem Solving**: Use [Shader Built-in Variables](/en/docs/graphics/material/variables) and [Shader API](/en/docs/graphics/material/shaderAPI)

<Callout type="info">
For more practical examples, check [Online Examples](/examples/shaderlab-01-basic-shader).
For more practical examples, check [Online Examples](/examples/shader-01-basic-shader).
</Callout>
35 changes: 14 additions & 21 deletions docs/en/graphics/material/shader.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
title: Shader Introduction
---

ShaderLab is a proprietary shader description language developed by Galacean. It provides a complete syntax for defining the structure, properties, rendering states, and shader code of a shader. With ShaderLab, developers can create a wide range of visual effects, from simple to complex.
Galacean Shader is a proprietary shader description language developed by Galacean. It provides a complete syntax for defining the structure, properties, rendering states, and shader code of a shader. With Galacean Shader, developers can create a wide range of visual effects, from simple to complex.

## What is ShaderLab?
## What is Galacean Shader?

ShaderLab is a declarative shader description language that organizes the various components of a shader into a modular structure. Unlike traditional GLSL/HLSL, ShaderLab not only includes shader code but also encompasses complete information such as material property definitions, UI configuration, and rendering state settings. ### Problems Solved
Galacean Shader is a declarative shader description language that organizes the various components of a shader into a modular structure. Unlike traditional GLSL/HLSL, Galacean Shader not only includes shader code but also encompasses complete information such as material property definitions, UI configuration, and rendering state settings. ### Problems Solved
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Split the heading onto its own line to avoid broken Markdown rendering.

At Line 9, ### Problems Solved is appended to paragraph text, so it won’t reliably render as a heading. Put it on a separate line.

✏️ Proposed fix
-Galacean Shader is a declarative shader description language that organizes the various components of a shader into a modular structure. Unlike traditional GLSL/HLSL, Galacean Shader not only includes shader code but also encompasses complete information such as material property definitions, UI configuration, and rendering state settings. ### Problems Solved
+Galacean Shader is a declarative shader description language that organizes the various components of a shader into a modular structure. Unlike traditional GLSL/HLSL, Galacean Shader not only includes shader code but also encompasses complete information such as material property definitions, UI configuration, and rendering state settings.
+
+### Problems Solved
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Galacean Shader is a declarative shader description language that organizes the various components of a shader into a modular structure. Unlike traditional GLSL/HLSL, Galacean Shader not only includes shader code but also encompasses complete information such as material property definitions, UI configuration, and rendering state settings. ### Problems Solved
Galacean Shader is a declarative shader description language that organizes the various components of a shader into a modular structure. Unlike traditional GLSL/HLSL, Galacean Shader not only includes shader code but also encompasses complete information such as material property definitions, UI configuration, and rendering state settings.
### Problems Solved
🧰 Tools
🪛 LanguageTool

[style] ~9-~9: Opting for a less wordy alternative here may improve the clarity of your writing.
Context: ... traditional GLSL/HLSL, Galacean Shader not only includes shader code but also encompasses complete information such as material p...

(NOT_ONLY_ALSO)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/en/graphics/material/shader.mdx` at line 9, The paragraph currently has
the heading marker "### Problems Solved" appended to its text; split it so the
heading is on its own line by moving the "### Problems Solved" token out of the
paragraph and placing it on a new line (ensure there's a blank line before the
heading for proper Markdown rendering) in docs/en/graphics/material/shader.mdx.


The `ShaderLab` framework primarily addresses the following pain points in traditional shader development:
The `Galacean Shader` framework primarily addresses the following pain points in traditional shader development:

- **Code Duplication**: Writing vertex and fragment shaders requires two separate files, and varying and uniform variables need to be declared twice.
- **Script Assembly**: Multiple SubShaders and Passes require script assembly.
Expand All @@ -25,7 +25,7 @@ The `ShaderLab` framework primarily addresses the following pain points in tradi
- **⚡ High Performance**: Compile-time optimization and efficient runtime execution.
- **🌐 Cross-Platform**: Automatically adapts to different graphics APIs.

## ShaderLab Structure
## Galacean Shader Structure

```glsl showLineNumbers {3-4, 16, 21, 24, 39, 49, 51, 54, 56, 58, 66, 69, 73, 77-78, 80, 90 }
Shader "Custom/MyShader" {
Expand Down Expand Up @@ -78,7 +78,7 @@ DestinationAlphaBlendFactor = BlendFactor.OneMinusSourceAlpha;
// -------------------- SubShader Definition --------------------
SubShader "Default" {
// Include Shadow Caster Pass
UsePass "pbr/Default/ShadowCaster"
UsePass "Utility/ShadowMap/Default/ShadowCaster"

// Custom Pass
Pass "Forward Pass" {
Expand All @@ -100,7 +100,7 @@ DepthState = customDepthState;


// Include code snippets
#include "Common.glsl"
#include "Common/Common.glsl"


// Specify vertex and fragment shader entry points
Expand Down Expand Up @@ -135,7 +135,7 @@ gl_FragColor = baseColor;

### 1. Shader Module

The Shader module is the root module of ShaderLab, defining the basic information and global settings of the shader:
The Shader module is the root module of Galacean Shader, defining the basic information and global settings of the shader:

```glsl showLineNumbers {1-8}
Shader "Custom/MyShader" {
Expand Down Expand Up @@ -363,23 +363,16 @@ return output;
Include code snippets using the `#include` directive:

```glsl showLineNumbers
#include "Common.glsl" // Common functions
#include "Light.glsl" // Lighting calculation
#include "Shadow.glsl" // Shadow calculation
#include "Fog.glsl" // Fog effect calculation
#include "Common/Common.glsl" // Common functions
#include "Common/Light.glsl" // Lighting calculation
#include "Shadow/Shadow.glsl" // Shadow calculation
#include "Common/Fog.glsl" // Fog effect calculation
#include "./MyCustom.glsl" // Custom snippet
```

## Registering Code Snippets

The framework provides many built-in code snippets; developers can register them directly for use:

```ts showLineNumbers {4} filename="Typescript"
import { registerIncludes } from "@galacean/engine-shader";

// Register the built-in ShaderLab code snippets.
registerIncludes();
```
Built-in code snippets are automatically registered when the engine is created — no manual registration is needed.

For custom snippets, you can register them manually through an interface...

Expand All @@ -394,7 +387,7 @@ ShaderFactory.registerInclude('YourKey', shaderSource);

## UIScript Scripting System

`UIScript` is one of the core features of `ShaderLab`, allowing you to implement intelligent property panel interactions via TypeScript scripts, including setting macro switches and rendering states:
`UIScript` is one of the core features of `Galacean Shader`, allowing you to implement intelligent property panel interactions via TypeScript scripts, including setting macro switches and rendering states:

```ts showLineNumbers {}
import { ShaderUIScript, Material } from "@galacean/engine";
Expand Down
Loading
Loading