Browse Source

fix fxaa antialiasing

- was broken when used with other postprocessing effects
- expose texture.filter
Alexander Rose 3 years ago
parent
commit
a98f5e1047
2 changed files with 5 additions and 1 deletions
  1. 2 1
      src/mol-canvas3d/passes/postprocessing.ts
  2. 3 0
      src/mol-gl/webgl/texture.ts

+ 2 - 1
src/mol-canvas3d/passes/postprocessing.ts

@@ -306,7 +306,8 @@ export class PostprocessingPass {
         this.nSamples = 1;
         this.blurKernelSize = 1;
 
-        this.target = webgl.createRenderTarget(width, height, false, 'uint8', 'nearest');
+        // needs to be linear for anti-aliasing pass
+        this.target = webgl.createRenderTarget(width, height, false, 'uint8', 'linear');
 
         this.outlinesTarget = webgl.createRenderTarget(width, height, false);
         this.outlinesRenderable = getOutlinesRenderable(webgl, depthTexture);

+ 3 - 0
src/mol-gl/webgl/texture.ts

@@ -186,6 +186,7 @@ export interface Texture {
     readonly format: number
     readonly internalFormat: number
     readonly type: number
+    readonly filter: number
 
     getWidth: () => number
     getHeight: () => number
@@ -326,6 +327,7 @@ export function createTexture(gl: GLRenderingContext, extensions: WebGLExtension
         format,
         internalFormat,
         type,
+        filter,
 
         getWidth: () => width,
         getHeight: () => height,
@@ -415,6 +417,7 @@ export function createNullTexture(gl?: GLRenderingContext): Texture {
         format: 0,
         internalFormat: 0,
         type: 0,
+        filter: 0,
 
         getWidth: () => 0,
         getHeight: () => 0,