My Account


RSS
oZone3D.Net RSS Feeds»RSS 2.0 Feeds

Blogs
»Demoniak3D Blog
»JeGX's Infamous Lab

Sponsors

Modul8: real time video mixing and compositing


Link to Us

oZone3D.Net 100% Realtime 3D

»All Links

Web Partners

www.geeks3d.com
www.benchmarkhq.ru
www.tdt3d.com
www.steph3d.net
www.g-truc.net
www.worldpcspecs.com


Banners Exchange

www.jmax-hardware.com
cgindia.blogspot.com
grapejuice.c.la
www.game-lab.com


Links Exchange

»CYGAD's 3DXtra

Search
Google
Web
oZone3D.Net
 
Image Filtering with GLSL - Convolution Kernels

By Jérôme Guinot - jegx [at] ozone3d [dot] net

Initial draft: December 8, 2005
Last update: January 8, 2006


Translated from french by Samir Fitouri - soundcheck [at] ozone3d [dot] net




[ Index ]

Introduction | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7

»Next Page



2 - Gaussian Filter


This filter is used to add blur to an image.
1  2  1
2  4  2
1  2  1

The demo associated with this filter is DEMO_gaussian_filter.xml
.



Load the DEMO_gaussian_kernel.xml in Demoniak3D file and you will get the following result:


Fig.2 - Gaussian filter.
The working of the shaders in this tutorial is the following: the base image is plated on a mesh plane. The left part of the image (texture coordinate u < 0.495) is filtered while the right part (u > 0.505) is not. All the texels that are located in the [0.495; 0.505] interval will be colored in red in order to form a vertical separating line.

The dimension of the base texture must be of a power of 2. In our case, they are 256x256. These measurements are passed as uniform variables to the pixel shaders in order to calculate the distances to access the neighboring pixels to the pixel being processed.

The vertex and pixel shaders being the same for all the filters, only the convolution core will be given.

If the code of the previous pixel shader does not work properly, it is possible to take of the branches and to unroll the loop as shown in the following code:




All the previous codes run properly on a nVidia GPU based graphic controller. Graphics controllers featuring the ATI chipsets seem not to support the constant array functionality. In case of an ATI chipset, the pixel shader code becomes:





The code of the pixel shader above is fully operational on a Radeon 9800pro graphics controller featuring the Catalyst 5.11 drivers. The accompanying projects are therefore provided in two versions: one exclusively intended for the nVidia chipsets while an other is meant for both ATI and nVidia.


3 - Mean Filter


This Filter is used for the image noise elimination.
1  1  1
1  1  1
1  1  1

The demo associated with this filter is DEMO_mean_filter.xml.


Fig.3 - Mean Filter.




[ Index ]

Introduction | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Page 7

»Next Page







Language:


Demoniak3D
Current Version: 1.23.0
»Demoniak3D
»Download
»Libraries and Plugins
»Demos
»Online Help - Reference Guide
»Codes Samples


GPU Caps Viewer
Current Version: 1.4.2
»GPU Caps Viewer
»GPU DB Submissions


FurMark
Current Version: 1.4.0
»FurMark
»Benchmark Submissions


Geeks3D News
Page generated in 0.06867790222168 seconds.