Version: Unity 6.2 Alpha (6000.2)
Language : English
Control material properties in the Inspector window
Branching in shaders

Changing how shaders work via branching and keywords

Sometimes, you want the same shaderA program that runs on the GPU. More info
See in Glossary
to do different things under different circumstances. For example, you might want to configure different settings for different materials, define functionality for different hardware, or dynamically change the behavior of shaders at runtime. You might also want to avoid executing computationally expensive code when it’s not needed, such as texture reads, vertex inputs, interpolators, or loops.

You can use conditionals to define behavior that the GPU only executes under certain conditions.

Page Description
Shader branching Resources for using conditionals to create static and dynamic branches in shaders, and branch using built-in macros.
Shader keywords Resources and techniques for adding shader keywords, using them to create branches and shader variants, and toggling them in the Unity Editor or in a script.

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答
Control material properties in the Inspector window
Branching in shaders
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961