Texture properties
Understand the extra properties Unity adds for texture.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前
For each texture that is setup as a shader/material property, Unity also sets up some extra information in additional vector properties.
Texture tiling & offset
Materials often have Tiling and Offset fields for their texture properties. This information is passed into shaders in a float4 {TextureName} property:
_ST- contains X tiling value
x - contains Y tiling value
y - contains X offset value
z - contains Y offset value
w
For example, if a shader contains texture named , the tiling information will be in a vector.
_MainTex_MainTex_STTexture size
{TextureName} - a float4 property contains texture size information:
_TexelSize- contains 1.0/width
x - contains 1.0/height
y - contains width
z - contains height
w
Texture HDR parameters
{TextureName} - a float4 property with information on how to decode a potentially HDR (e.g. RGBM-encoded) texture depending on the color space used. See function in UnityCG.cginc shader include file.
_HDRDecodeHDR