Skip to content

Convolution2DPass ​

Methods ​

buildVertexBuffer ​

Build the vertex buffer of the screen-aligned quad the convolved result is drawn to.

computeKernelWeight ​

Sum the kernel components to get the weight the convolved color is divided by. A kernel that sums to zero or less weighs 1, leaving the result unscaled.

ArgumentTypeRequiredDescription
kernelArray[Number] or TypedArrayYesThe convolution kernel.

extend ​

Method used to decorate a given object (publicAPI+model) with vtkConvolution2DPass characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIConvolution2DPassInitialValuesNo(default: {})

getFragmentShaderCode ​

Generate the fragment shader that convolves the delegate output with a kernel of the given dimension. The kernel is unrolled into the source, so a new dimension needs a new shader.

ArgumentTypeRequiredDescription
kernelDimensionNumberYesThe width and height of the square kernel.

getFramebuffer ​

Get the framebuffer the delegate passes render into, or null before the first traversal.

getKernel ​

Get the convolution kernel, in row-major form.

getKernelDimension ​

Get the width and height of the square convolution kernel.

newInstance ​

Method used to create a new instance of vtkConvolution2DPass.

ArgumentTypeRequiredDescription
initialValuesIConvolution2DPassInitialValuesNofor pre-setting some of its content

setKernel ​

Set the convolution kernel. It has to be a flat, row-major array of kernelDimension * kernelDimension components. Setting it to null makes the next traversal rebuild the identity kernel, which leaves the delegate output untouched.

ArgumentTypeRequiredDescription
kernelArray[Number] or TypedArrayYesThe convolution kernel.

setKernelDimension ​

Set the width and height of the square convolution kernel. It has to be odd, so that the kernel has a center.

ArgumentTypeRequiredDescription
kernelDimensionNumberYesThe kernel dimension.