Home Reference Source
import {ConvolutionMaterial} from 'postprocessing'
public class | source

ConvolutionMaterial

Extends:

three~ShaderMaterial → ConvolutionMaterial

An optimised convolution shader material.

This material supports dithering.

Based on the GDC2003 Presentation by Masaki Kawase, Bunkasha Games: Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L (Wreckless) and an article by Filip Strugar, Intel: An investigation of fast real-time GPU-based image blur algorithms

Further modified according to Apple's Best Practices for Shaders.

TODO:

  • Remove dithering code from fragment shader.

Constructor Summary

Public Constructor
public

constructor(texelSize: Vector2)

Constructs a new convolution material.

Member Summary

Public Members
public

The current kernel size.

Method Summary

Public Methods
public

Returns the kernel.

public

Sets the texel size.

Public Constructors

public constructor(texelSize: Vector2) source

Constructs a new convolution material.

Params:

NameTypeAttributeDescription
texelSize Vector2
  • optional

The absolute screen texel size.

Public Members

public kernelSize: KernelSize source

The current kernel size.

Public Methods

public getKernel(): Float32Array source

Returns the kernel.

Return:

Float32Array

The kernel.

public setTexelSize(x: Number, y: Number) source

Sets the texel size.

Params:

NameTypeAttributeDescription
x Number

The texel width.

y Number

The texel height.