PDA

View Full Version : GLSL shaders for images



nishantmc
04-26-2011, 06:45 PM
Hi,

Using a lib i loaded a bmp image as a texture and i rendered it in opengl. Is it possible to apply shaders on the texture to give a tooning effect?

_x57_
05-02-2011, 03:38 AM
If you mean toon-shading (cel-shading) ... i believe this is normally applied to 3d-models rather than images.
However, if you know an image filter that does what you need you can most likely implement it as a shader somehow.

Ilian Dinev
05-02-2011, 04:28 AM
try decimating the color.
if the frag shader is currently "gl_FragColor=color;"
then:


float scale = 8.0;
color = floor(color*scale);
color/= scale;
gl_FragColor = color;

V-man
05-03-2011, 02:25 PM
Sobel filter which is also known as edge detection algorithm for 2d images.