• Stars
    star
    244
  • Rank 165,399 (Top 4 %)
  • Language GLSL
  • Created over 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Useful GLSL filters adapted for Processing

Filters4Processing

A growing collection of pixel shaders ported to Processing to be used with the filter() function. Most of these shaders come from the excellent Shadertoy by Iñigo Quilez.

Note: This repository focuses on filters. If you want to port any other type of shader from Shadertoy to Processing, check out this other repository Shadertoy2Processing

Filters

Gaussian blur

screenshot

Barrel Blur Chroma

screenshot

Barrel & Pincushion

screenshot

Bicubic Filter

screenshot

Bilateral Filter (denoise)

screenshot

Contrast, Saturation, Brightness

screenshot

Dithering

screenshot

Edge filter

screenshot

Metaballs

screenshot

Droste

screenshot

Usage

This is a minimal example showing how to import a shader file in Processing and use it as a filter.

Note: Some shaders require additional uniforms. For details, refer to the example sketches included.

// Create an image object
PImage  myImage;

// Create a shader object
PShader myFilter;

void setup() {

  size( 512, 512, P2D );

  // Import the image file
  myImage  = loadImage( "texture.jpg" );

  // Import the shader file
  myFilter = loadShader( "shader.glsl" );

  // Pass the size of the window to the shader
  myFilter.set("sketchSize", float(width), float(height));

}

void draw() {

  // Draw the image on the scene
  image( myImage, 0, 0 );

  // Apply the shader to the scene
  filter( myFilter );

}

Notes about porting filters from Shadertoy

Shadertoy and Processing both have their own quirks when it comes to shader programming. We need to make some changes in order to make Shadertoy code work with Processing.

Replace: void mainImage( out vec4 fragColor, in vec2 fragCoord ) -> void main( void )

Replace all:

  • iChannel0 -> texture
  • fragCoord -> gl_FragCoord
  • fragColor -> gl_FragColor

There is more to it than this but these tips should cover most basic filters.

Now go dig for some shaders and help us extend the library of filters available for Processing!

Acknowledgments

Thanks to all the Shadertoy contributors for their hard work. This collection wouldn't exist without them. Thanks to Andres Colubri for his work on the Processing Shader API.

License

All shaders from Shadertoy belong to there respective authors. Unless otherwise specified in the shader file, they are licensed under Creative Commons (CC BY-NC-SA 3.0)

More Repositories

1

HicEtNunc-p5js-templates

JavaScript
73
star
2

Processing-Experiments

Various quick sketches
GLSL
70
star
3

Shadertoy2Processing

Get GLSL code from Shadertoy.com to run inside of Processing
53
star
4

signalfilter

A signal filtering library for Processing
HTML
44
star
5

PencilToP5

A minimal demo of a simple drawing tool supporting the Apple Pencil in iOS Safari
JavaScript
36
star
6

svgpeck

A minimalist vector sketching tool for pen plotter artists
Processing
32
star
7

glsltutoP5

Port of the ThNdl GLSL shader tutorial examples to Processing
Java
14
star
8

movelib

A Processing interface for the Move Controller based on the PS Move API.
Processing
11
star
9

MoveP5

Prototype for an extended Processing PS Move library based on the PS Move API
Java
6
star
10

lockFacetimeAutoExposure

A simple demo showing how to temporarily disable Auto-Exposure on built-in cameras (Facetime or iSight) on MacOSX 10.7 and up using Cocoa and AVFoundation.
Objective-C
4
star
11

Move-Ribbon---a-PS-Move-API-demo-in-Processing

This sketch demonstrates how to implement tracking with the PS Move API in Processing
Java
3
star
12

dogeBeGone_extension

A Chrome extension that brings back the classic Twitter icon, free from any dog-related imagery.
JavaScript
3
star
13

dynamite_juggle

A Game for one PS Move and a bunch of crazy people
Java
2
star
14

P3Dlessons

A compilation of sketches showing how to create 3D shapes in Processing (backup material for a workshop given at OpenTechSchool Berlin)
Java
2
star
15

CCBerlin

Creative Code Berlin
Processing
1
star
16

AudioRoamerAR

Processing
1
star
17

SableRaf.github.io

HTML
1
star