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.
  • Loading branch information
ppillot committed Apr 11, 2024
1 parent 77ca97d commit e363d4c
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, ColorSpace
LineSegments, ColorSpace,
HalfFloatType
} from 'three'
import '../shader/BasicLine.vert'
import '../shader/BasicLine.frag'
Expand Down Expand Up @@ -521,7 +522,10 @@ export default class Viewer {
{
minFilter: LinearFilter,
magFilter: LinearFilter,
format: RGBAFormat
format: RGBAFormat,
type: this.supportsHalfFloat ? HalfFloatType : (
SupportsReadPixelsFloat ? FloatType : UnsignedByteType
)
}
)
this.sampleTarget.texture.colorSpace = this.parameters.outputColorSpace
Expand All @@ -532,11 +536,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
)
}
)
this.holdTarget.texture.colorSpace = this.parameters.outputColorSpace
Expand Down

0 comments on commit e363d4c

Please sign in to comment.