Skip to content

How do I create a filter with an additional texture? #10489

Answered by asturur
applekeeper-cat asked this question in Q&A
Discussion options

You must be logged in to vote

I extended the base filter and created the LutFilter for example

export class Lut16Filter extends filters.BaseFilter<'LutFilter'> {
  static type = 'LutFilter';

  declare cacheName: string;

  declare textureRef: WebGLTexture | null;

  declare lutTable: HTMLImageElement;

  static uniformLocations = ['uLut'];

  getFragmentSource() {
    return `precision highp float;
    uniform sampler2D uTexture;
    // here is the loot sampler
    uniform sampler2D uLut;
    varying vec2 vTexCoord;
    void main() {
      ...your lutTable shader...  
    }`;
  }

 createTexture(backend: WebGLFilterBackend, image: TexImageSource) {
    const { gl } = backend;

    const texture = backend.getCachedTex…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@applekeeper-cat
Comment options

@asturur
Comment options

Answer selected by applekeeper-cat
@applekeeper-cat
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants