[Shader]UnityShaderLab属性常用限定语义

2020/08 21 23:08
[NoScaleOffset]
不允许调纹理的Tiling和Offset值

[HideInInspector]
在Shader的Inspector中不显示

[PerRendererData]
Texture value for this property will be queried from renderer's MaterialPropertyBlock, instead of from the material. This corresponds to the "[PerRendererData]" attribute in front of a property in the shader code.
比如在UI中使用

[Normal]
Signifies that values of this property contain Normal (normalized vector) data.
When this flag is set, the default material Inspector will display warning if incompatible data was assigned in the Material. For instance default material Inspector will warn and suggest to fix the texture that is not marked as Normalmap. This corresponds to "[Normal]" attribute in front of property in the shader code.
指示他是法线

[HDR]
Signifies that values of this property contain High Dynamic Range (HDR) data.
When this flag is set, the default material Inspector will display warning if incompatible data was assigned in the Material. For instance default material Inspector will warn and suggest to fix the texture that contain alpha channel (unsupported in HDR textures). This corresponds to "[HDR]" attribute in front of property in the shader code.
指示HDR

[Gamma]
Signifies that values of this property are in gamma space and should not be gamma corrected.
When this flag is set, colors passed into the shader will not be linearized. For more information see https://docs.unity3d.com/Manual/LinearLighting.html:

[NonModifiableTextureData]
Do not allow this texture property to be edited in the Inspector.
This property is specified via the shader importer and should not be user controlled.