Lua Shader Geometric Functions
From GiderosMobile
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Function | Syntax | Description |
---|---|---|
length | float=length(x) | Returns the length of vector x. |
distance | float=distance(p0,p1) | Returns the distance between p0 and p1. |
dot | float=dot(x,y) | Returns the dot product of x and y. |
cross | vec3=cross(x,y) | Returns the cross product of x and y. |
normalize | mix(x) | Returns a vector in the same direction as x but with a length of 1. |
faceforward | faceforward(N,I.Nref) | If dot(Nref,I)<0 return N, otherwise return –N. |
reflect | reflect(I,N) | For the incident vector I and surface orientation N, returns the reflection direction: I–2∗dot(N,I)∗N |
refract | refract(I,N,eta) | For the incident vector I and surface normal N, and the ratio of indices of refraction eta, return the refraction vector. |