In modern graphics engines, to correctly render objects, it's necessary to write Vertex and Fragment code snippets that run on the GPU. Those code snippets are known as shaders.
On the devices driven by OpenGL, a shader programming language called GLSL (OpenGL Shading Language) is widely used.
To adapt the industrial workflows and enhance the usability of shader fragments, Cocos Creator has encapsulated a shader framework based on GLSL — Cocos Shader.
This chapter mainly introduces the working and usage of Cocos Shader.
Table of Contents
- Create and Use Shader
- Built-in Shaders
- Built-in Uniforms
- Common Functions
- Render Flow of Forward Rendering and Deferred Shading
- Surface Shader
- Guide to Built-in Surface Shader
- Surface Shader Overview
- Surface Shader Execution Flow
- Macro Remapping
- Function Replacement Using Macros
- Surface Shader Built-in Replaceable Functions
- Render Usages
- Lighting Models
- Surface Material Data Structure
- Shader Stages
- Shader Assembly
- VS Inputs
- FS Inputs
- Customize Surface Shader
- Rendering Debug View
- Legacy Shader
- Write Shaders
- Instanced Attributes
- UBO Layout
- Fallback to WebGL 1.0
- VSCode Extension - Cocos Effect