Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TopViewClipPlanesEvaluator

Top view, clip planes evaluator that computes view ranges based on ground distance and elevation.

deprecated

Default evaluator TiltViewClipPlanesEvaluator supports top-down views.

remarks

This evaluator supports both planar and spherical projections, although it behavior is slightly different in each case. General algorithm sets near plane and far plane close to ground level, but taking into account maximum and minimum elevation of features on the ground.

note

This evaluator supports only cameras which are always looking down the ground surface (top-down view) along surface normal and does not preserve correct clip planes when modifying camera pitch (tilt) angle. In simple words it is suitable only for top view camera settings.

Hierarchy

Implements

Index

Constructors

constructor

  • new TopViewClipPlanesEvaluator(maxElevation?: number, minElevation?: number, nearMin?: number, nearFarMarginRatio?: number, farMaxRatio?: number): TopViewClipPlanesEvaluator
  • 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.

    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.

    Parameters

    • Default value 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.

    • Default value 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.

    • Default value nearMin: number = 1

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

    • Default value 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.

    • Default value farMaxRatio: number = 6

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

    Returns TopViewClipPlanesEvaluator

Properties

Readonly farMaxRatio

farMaxRatio: number

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

Protected m_tmpQuaternion

m_tmpQuaternion: Quaternion = new THREE.Quaternion()

Helper object for reducing performance impact.

Protected m_tmpVectors

m_tmpVectors: Vector3[] = [new THREE.Vector3(),new THREE.Vector3(),new THREE.Vector3()]

Helper for reducing number of objects created at runtime.

Readonly nearFarMarginRatio

nearFarMarginRatio: number

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.

Readonly nearMin

nearMin: number

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

Accessors

maxElevation

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

    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.

    Returns number

  • Set maximum elevation above sea level to be rendered.

    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.

    Parameters

    • elevation: number

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

    Returns void

minElevation

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

    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

    Returns number

  • Set minimum elevation to be rendered, values beneath the sea level are negative.

    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

    Parameters

    • elevation: number

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

    Returns void

Protected minimumViewRange

Methods

evaluateClipPlanes

Protected evaluateDistancePlanarProj

Protected evaluateDistanceSphericalProj

Protected getFovBasedFarPlane

  • getFovBasedFarPlane(camera: PerspectiveCamera, d: number, r: number, fovAngle: number, projection: Projection): number

Generated using TypeDoc