자료/Article

HLSL - Abridged Quick Reference – Intrinsic Functions

쑥갓 2005. 7. 20. 21:34
abs(a)
Absolute value (per component).
reflect(i, n)
Returns the reflection vector v, given the entering ray direction i, and the surface normal n. Such that v = i - 2 * dot(i, n) * n
sin(x)
cos(x)
tan(x)
Returns the sine/cosine/tangent of x.
refract(i, n, eta)
Returns the refraction vector v, given the entering ray direction i, the surface normal n, and the relative index of refraction eta. If the angle between i and n is too great given eta, refract returns (0,0,0).
cross(a, b)
Returns the cross product of two 3-D vectors.
round(x)
Rounds x to the nearest integer.
distance(a, b)
Returns the distance between two points, a and b.
rsqrt(a)
Inverse square root: 1 / Square root (per component).
dot(a, b)
Returns the dot product of two vectors a and b.
saturate(x)
Clamps x to the range [0, 1].
frac(x)
Returns the fractional part f of x, such that f is a value greater than or equal to 0, and less than 1.
sqrt(a)
Square root (per component).
lerp(a, b, s)
Returns a + s(b - a). This linearly interpolates between a and b, such that the return value is a when s is 0, and b when s is 1.
tex1D(s, t)
1-D texture lookup. s is a sampler or a sampler1D object.  t is a scalar.
max(a,b)
min(a, b)
Selects the greater/lesser of a and b.
tex2D(s, t)
2-D texture lookup. s is a sampler or a sampler2D object.  t is a 2-D texture coordinate.
mul(a, b)
Performs matrix multiplication between a and b. If a is a vector, it’s treated as row vector. If b is a vector, it is treated as column vector.
tex3D(s, t)
3-D volume texture lookup. s is a sampler or a sampler3D object.  t is a 3-D texture coordinate.
normalize(x)
Returns the normalized vector x / length(x). If the length of x is 0, the result is indefinite.
texCUBE(s, t)
3-D cube texture lookup. s is a sampler or a samplerCUBE object.  t is a 3-D texture coordinate.
pow(x, y)
Returns xy