Version: Unity 6 (6000.0)
Language : English
Shader object fundamentals
Create a shader file

Writing a custom shader in ShaderLab and HLSL

Resources and techniques for writing ShaderA program that runs on the GPU. More info
See in Glossary
objects, subshaders and shader passes in ShaderLabUnity’s language for defining the structure of Shader objects. More info
See in Glossary
and HLSL.

Page Description
Create a shader file Create a customshader asset file either using the Unity Editor or manually.
Add a subshader in a custom shader Use a SubShader block to add one or more sections that define different GPU settings and shader programs for different hardware, render pipelinesA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
, and runtime settings.
Add a shader pass in a custom shader Use a Pass block to write instructions for setting the state of the GPU, and the shader programs that run on the GPU.
Include a shader pass with the UsePass command Insert a named Pass from another Shader objectAn instance of the Shader class, a Shader object is container for shader programs and GPU instructions, and information that tells Unity how to use them. Use them with materials to determine the appearance of your scene. More info
See in Glossary
, to avoid reduce code duplication in shader source files.
Writing HLSL shader programs Resources for writing HLSL shader programs inside a Pass block in a custom ShaderLab shader.
Setting the render state on the GPU Resources for using commands in a subshader or shader pass that change the render state on the GPU.

Additional resources

Shader object fundamentals
Create a shader file
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961