Skip to content

Commit

Permalink
Fix banding appearing after antialiasing
Browse files Browse the repository at this point in the history
A banding effect was due to a loss of precision when copying the texture between render targets as linear encoding requires more precision.
  • Loading branch information
ppillot committed Dec 24, 2023
1 parent 54363c1 commit c26827e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/viewer/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -511,7 +512,10 @@ export default class Viewer {
{
minFilter: LinearFilter,
magFilter: LinearFilter,
format: RGBAFormat
format: RGBAFormat,
type: this.supportsHalfFloat ? HalfFloatType : (
SupportsReadPixelsFloat ? FloatType : UnsignedByteType
)
}
)

Expand All @@ -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
)
}
)

Expand Down

0 comments on commit c26827e

Please sign in to comment.