ドキュメント

Unity Engine


User Manual

Script Reference

Unity Engine


Writing HLSL shader programs

Resources for writing HLSL shader programs inside a Pass block in a custom ShaderLab shader.
読み終わるまでの所要時間 1 分最終更新 22日前

Write High-Level Shader Language (HLSL) vertex and fragment shader programs inside a
Pass
block in a custom ShaderLab shader.

Page

Description

Introduction to HLSL shader programsLearn about writing shader programs in HLSL in Unity, and vertex and fragment shaders.
Add an HLSL shader programUse the
HLSLPROGRAM
directive to add a shader program to a shader pass.
Reuse HLSL codeInclude or duplicate HLSL in different places, or share
#pragma
directives across different shaders.
Input data into HLSLCreate a
struct
that declares shader variables and connects them to the vertex data of the mesh.
Sample a texture in HLSLDeclare and sample a texture in HLSL using a sampler.
Writing HLSL for different graphics APIsWrite HLSL to take into account how graphics rendering differs between different graphics APIs.
Use 16-bit precision in shadersUse 16-bit precision in GPU calculations, so shaders use less memory, bandwidth, and power, and calculations are faster.
Pass information to the shader compilerUse the
#define
,
#pragma
, and
#define_for_platform_compiler
directives to pass information to the shader compiler.

Additional resources