유니티 사이트
float : High precision
generally 32 bits, used for world space positions, texture coordinates, or scalar computations involving complex functions such as trigonometry(삼각법) or power(제곱)/exponentiation(지수).
half : Medium precision
generally 16 bits (range of –60000 to +60000, with about 3 decimal digits of precision).
useful for short vectors, directions, object space positions, high dynamic range colors
fixed : Low precision
generally 11 bits, with a range of –2.0 to +2.0 and 1/256th precision.
useful for regular colors (as typically stored in regular textures) and performing simple operations on them.
Integer data types
often used as loop counters or array indices. For this purpose, they generally work fine across various platforms.
Composite vector/matrix types
HLSL has built-in vector and matrix types that are created from the basic types. For example, float3 is a 3D vector with .x, .y, .z components, and half4 is a medium precision 4D vector with .x, .y, .z, .w components. Alternatively, vectors can be indexed using .r, .g, .b, .a components, which is useful when working on colors.
Texture/Sampler types
Typically you declare textures in your HLSL code as follows:
sampler2D _MainTex;
samplerCUBE _Cubemap;
For mobile platforms, these translate into “low precision samplers”, i.e. the textures are expected to have low precision data in them. If you know your texture contains HDR colors, you might want to use half precision sampler:
sampler2D_half _MainTex;
samplerCUBE_half _Cubemap;
Or if your texture contains full float precision data (e.g. depth texture), use a full precision sampler:
sampler2D_float _MainTex;
samplerCUBE_float _Cubemap;
댓글 없음:
댓글 쓰기