Class TiltViewClipPlanesEvaluator

Evaluates camera clipping planes taking into account ground distance and camera tilt (pitch) angle (angle between look-at vector and ground surface normal).

Hierarchy

Constructors

  • Allows to setup near/far offsets (margins), rendered geometry elevation relative to sea level as also minimum near plane and maximum far plane distance constraints.

    Parameters

    • maxElevation: number = EarthConstants.MAX_BUILDING_HEIGHT

      defines near plane offset from the ground in the surface normal direction, positive values allows to render elevated terrain features (mountains, buildings). Defaults to Burj Khalifa building height.

    • minElevation: number = 0

      defines far plane offset from the ground surface, negative values moves far plane below the ground level (use it to render depressions). Default zero - sea level.

    • nearMin: number = 1.0

      minimum allowable near plane distance from camera, must be bigger than zero.

    • nearFarMarginRatio: number = 0.05

      minimum distance between near and far plane, as a ratio of average near/far plane distance, it have to be significantly bigger than zero (especially if [[maxElevation]] and [[minElevation]] are equal), otherwise you may notice flickering when rendering, or even render empty scene if frustum planes are almost equal.

    • farMaxRatio: number = 6.0

      maximum ratio between ground and far plane distance, allows to limit viewing distance at overall. Have to be bigger than 1.0.

    Returns TiltViewClipPlanesEvaluator

    Remarks

    It is strongly recommended to set some reasonable [[nearFarMargin]] (offset) between near and far planes to avoid flickering.

    Note

    Keep in mind that this evaluator does not evaluate terrain (or building) elevation automatically, to keep such features rendered (between frustum planes) use [[minElevation]], [[maxElevation]] constraints. You may change this parameters at any time, but it requires repeating [[evaluatePlanes]] step, if your camera is moving you need to evaluate planes anyway.

    Note

    You may treat [[minElevation]] and [[maxElevation]] parameters as the maximum and minimum renderable elevation respectively along the surface normal, when camera is constantly looking downwards (top-down view). If you need ClipPlanesEvaluator for cameras that support tilt or yaw please use TiltViewClipPlanesEvaluator.

    Note

    [[nearFarMaxRatio]] does not limit far plane when spherical projection is in use, the algorithm used there estimates distance to point on tangent where line from camera touches the sphere horizon and there is no reason to clamp it.

Properties

farMaxRatio: number = 6.0

maximum ratio between ground and far plane distance, allows to limit viewing distance at overall. Have to be bigger than 1.0.

m_tmpQuaternion: Quaternion = ...

Helper object for reducing performance impact.

m_tmpVectors: Vector3[] = ...

Helper for reducing number of objects created at runtime.

nearFarMarginRatio: number = 0.05

minimum distance between near and far plane, as a ratio of average near/far plane distance, it have to be significantly bigger than zero (especially if [[maxElevation]] and [[minElevation]] are equal), otherwise you may notice flickering when rendering, or even render empty scene if frustum planes are almost equal.

nearMin: number = 1.0

minimum allowable near plane distance from camera, must be bigger than zero.

Accessors

  • get maxElevation(): number
  • Get maximum elevation to be covered by camera frustum.

    Returns number

  • set maxElevation(elevation): void
  • Set maximum elevation above sea level to be rendered.

    Parameters

    • elevation: number

      the elevation (altitude) value in world units (meters).

    Returns void

    Remarks

    Note

    If you set this exactly to the maximum rendered feature height (altitude above the sea, you may notice some flickering or even polygons disappearing related to rounding errors or depth buffer precision. In such cases increase [[nearFarMargin]] or add a little bit offset to your assumed maximum elevation.

    Note

    Reasonable values are in between (-DeadSeeDepression, MtEverestHeight>, both values are defined in [[EarthConstant]] as [[EarthConstant.MIN_ELEVATION]] and [[EarthConstant.MAX_ELEVATION]] respectively.

    See

    minElevation for more information about precision and rounding errors.

  • get minElevation(): number
  • Get minimum elevation to be covered by camera frustum.

    Returns number

  • set minElevation(elevation): void
  • Set minimum elevation to be rendered, values beneath the sea level are negative.

    Parameters

    • elevation: number

      the minimum elevation (depression) in world units (meters).

    Returns void

    Remarks

    Note

    If you set this parameter to zero you may not see any features rendered if they are just below the sea level more than half of [[nearFarMargin]] assumed. Similarly if set to -100m and rendered features lays exactly in such depression, you may notice that problem. The errors usually come from projection precision loss and depth buffer nature (significant precision loss closer to far plane). Thus is such cases either increase the margin (if you are sure features are just at this elevation, or setup bigger offset for [[minElevation]]. Reasonable values are between <-DeadSeaDepression, MtEverestHeight), where the first denotes lowest depression on the Earth defined as [[EarthConstants.MIN_ELEVATION]] and the second is the highest point our planet.

    See

    https://developer.nvidia.com/content/depth-precision-visualized

  • get minimumViewRange(): ViewRanges
  • Get minimum view range that is possible to achieve with current evaluator settings.

    Returns ViewRanges

    Note

    This value will not change after evaluator is constructed.

Methods

Generated using TypeDoc