@@ -123,6 +123,12 @@ export interface NgtsHTMLContentOptions {
123123 * Defaults to the canvas container or `events.connected` element.
124124 */
125125 parent ?: HTMLElement | ElementRef < HTMLElement > ;
126+ /**
127+ * Computes z-index with a logarithmic scale, which prevents
128+ * near objects from all having the same z-index when
129+ * camera.far is very large.
130+ */
131+ logarithmicDepth ?: boolean ;
126132}
127133
128134const defaultHtmlContentOptions : NgtsHTMLContentOptions = {
@@ -354,7 +360,7 @@ export class NgtsHTMLContent extends NgtHTML {
354360 occlusionGeometry ,
355361 isRaycastOcclusion ,
356362 { camera, size, viewport, raycaster, scene } ,
357- { calculatePosition, eps, zIndexRange, sprite, distanceFactor } ,
363+ { calculatePosition, eps, zIndexRange, logarithmicDepth , sprite, distanceFactor } ,
358364 { transform, occlude, scale } ,
359365 ] = [
360366 this . host . nativeElement ,
@@ -432,7 +438,7 @@ export class NgtsHTMLContent extends NgtHTML {
432438 : [ halfRange - 1 , 0 ]
433439 : zIndexRange ;
434440
435- renderer . setStyle ( hostEl , 'z-index' , `${ objectZIndex ( group , camera , zRange ) } ` ) ;
441+ renderer . setStyle ( hostEl , 'z-index' , `${ objectZIndex ( group , camera , zRange , logarithmicDepth ) } ` ) ;
436442
437443 if ( transform ) {
438444 const [ widthHalf , heightHalf ] = [ size . width / 2 , size . height / 2 ] ;
0 commit comments