From c26827e37c3b3439c026db94dd7369ae63fcd3a6 Mon Sep 17 00:00:00 2001 From: ppillot Date: Sat, 23 Dec 2023 20:21:23 -0500 Subject: [PATCH] Fix banding appearing after antialiasing A banding effect was due to a loss of precision when copying the texture between render targets as linear encoding requires more precision. --- src/viewer/viewer.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/viewer/viewer.ts b/src/viewer/viewer.ts index 2eeecf98..e6856020 100644 --- a/src/viewer/viewer.ts +++ b/src/viewer/viewer.ts @@ -16,7 +16,8 @@ import { Scene, Mesh, Group, Object3D, Uniform, Fog, DirectionalLight, AmbientLight, BufferGeometry, BufferAttribute, - LineSegments + LineSegments, + HalfFloatType } from 'three' import '../shader/BasicLine.vert' import '../shader/BasicLine.frag' @@ -511,7 +512,10 @@ export default class Viewer { { minFilter: LinearFilter, magFilter: LinearFilter, - format: RGBAFormat + format: RGBAFormat, + type: this.supportsHalfFloat ? HalfFloatType : ( + SupportsReadPixelsFloat ? FloatType : UnsignedByteType + ) } ) @@ -521,11 +525,9 @@ export default class Viewer { minFilter: NearestFilter, magFilter: NearestFilter, format: RGBAFormat, - type: UnsignedByteType - // using HalfFloatType or FloatType does not work on some Chrome 61 installations - // type: this.supportsHalfFloat ? HalfFloatType : ( - // SupportsReadPixelsFloat ? FloatType : UnsignedByteType - // ) + type: this.supportsHalfFloat ? HalfFloatType : ( + SupportsReadPixelsFloat ? FloatType : UnsignedByteType + ) } )