czm_translateRelativeToEye
Translates a position (or any vec3
) that was encoded with EncodedCartesian3,
and then provided to the shader as separate high
and low
bits to
be relative to the eye. As shown in the example, the position can then be transformed in eye
or clip coordinates using czm_modelViewRelativeToEye or czm_modelViewProjectionRelativeToEye,
respectively.
This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as described in Precisions, Precisions.
Parameters:
Name | Type | Description |
---|---|---|
high |
vec3 | The position's high bits. |
low |
vec3 | The position's low bits. |
Returns:
vec3
The position translated to be relative to the camera's position.
Example
attribute vec3 positionHigh; attribute vec3 positionLow; void main() { vec4 p = czm_translateRelativeToEye(positionHigh, positionLow); gl_Position = czm_modelViewProjectionRelativeToEye * p; }