기술 자료

Unity Engine


User Manual

Script Reference

Unity Engine


Writing a custom shader in ShaderLab and HLSL

Resources and techniques for writing Shader objects, subshaders and shader passes in ShaderLab and HLSL.
읽는 시간 1분최근 업데이트: 한 달 전

Resources and techniques for writing Shader objects, subshaders and shader passes in ShaderLab and HLSL.

Page

Description

Create a shader fileCreate a customshader asset file either using the Unity Editor or manually.
Add a subshader in a custom shaderUse a
SubShader
block to add one or more sections that define different GPU settings and shader programs for different hardware, render pipelines, and runtime settings.
Add a shader pass in a custom shaderUse 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 commandInsert a named Pass from another Shader object, to avoid reduce code duplication in shader source files.
Writing HLSL shader programsResources for writing HLSL shader programs inside a
Pass
block in a custom ShaderLab shader.
GLSL in UnityIf a platform supports OpenGL Core and OpenGL ES, you can write OpenGL Shading Language (GLSL) shader programs in Unity.
Setting the render state on the GPUResources for using commands in a subshader or shader pass that change the render state on the GPU.

Additional resources