https://github.com/ruby-processing/filters4jruby_art
GLSL video and image filters for JRubyArt
https://github.com/ruby-processing/filters4jruby_art
filters glsl jrubyart processing shader
Last synced: 8 months ago
JSON representation
GLSL video and image filters for JRubyArt
- Host: GitHub
- URL: https://github.com/ruby-processing/filters4jruby_art
- Owner: ruby-processing
- License: gpl-3.0
- Created: 2017-02-15T11:24:06.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-30T07:35:05.000Z (over 8 years ago)
- Last Synced: 2025-02-17T12:45:42.173Z (11 months ago)
- Topics: filters, glsl, jrubyart, processing, shader
- Language: GLSL
- Size: 1.64 MB
- Stars: 3
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
filters4jruby_art
==================
A port of [Filters4Processing][] to JRubyArt
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](https://www.shadertoy.com) by Iñigo Quilez.
### To run / watch shader sketches
NB: glsl files are also _watched_, so you can edit the shader of the sketch running in
watch mode, and it will automatically reload when you save your changes...
```bash
# autorun all sketches
cd filters4jruby_art
rake # assume rake and processing and jruby_art installed
```
Run / Watch individual sketches as follows
```bash
k9 -r sketch.rb
# or k9 -w sketch.rb
```
## Filters
### Barrel Blur Chroma

### Barrel & Pincushion

### Bicubic Filter

### Bilateral Filter (denoise)

### Contrast, Saturation, Brightness

### Dithering

### Edge filter

## Usage
This is a minimal example showing how to import shader file in JRubyArt and use it as a filter.
*Note: Some shaders require additional uniforms. For details, refer to the example sketches included.*
```ruby
attr_reader :my_filter, :my_image
def settings
size(512, 512, P2D)
end
def setup
sketch_title 'My Sketch'
# import an image object
@my_image = load_image(data_path('texture.jpg'))
# load a shader object
@my_filter = load_shader(data_path('shader.glsl'))
# pass the window size to the shader
my_filter.set('sketchSize', width.to_f, height.to_f)
end
def draw
background(0)
# Draw the image on the scene
image(my_image, 0, 0)
# Applies the shader to everything that has already been drawn
return if mouse_pressed?
filter(my_filter)
end
```
## 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/JRubyArt. See [wiki](https://github.com/ruby-processing/filters4jruby_art/wiki) which you are welcome to edit if you know better
Now go dig for some [shaders](https://www.shadertoy.com/results?query=filter) and help us extend the library of filters available for Processing/jruby_art!
*Note: It is possible to port other types of shaders, but this repository focuses on filters.*
## Acknowledgments
Port to processing by Raphaël de Courville.
Thanks to all the Shadertoy contributors for their hard work. This collection wouldn't exist without them. Thanks to Andrés 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](http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US))
## Tools
[Syntax highlighting for glsl in vim](https://github.com/beyondmarc/glsl.vim)
[Filters4Processing]:https://github.com/SableRaf/Filters4Processing