Sign in to follow this  
golgoth

GLSL post effects!

Recommended Posts

golgoth    100
Hi all! Im trying to multi sample the final output of my rendering pipepline! i had succesful results using glEnable(GL_MULTISAMPLE_ARB) but it is really slow... so id like to try it with a glsl shader... the process is simple... i render to texture the pBuffer and apply it to a plane in ortho mode over everything... so far its all good, the entire scene is rendered on that plane... i can also apply a simple fragment shader like: void main (void) { gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); } everything turns green... so the piepline seams ok... now... how can i access and transform every single pixels and play with them?... maybe a simple invert color or to gray scale shader sample will do help alot... ultimatly a blur effect will make my day! thx! golgoth

Share this post


Link to post
Share on other sites
OrangyTang    1298
For a simple blur, just sample the texture at multiple points around your current fragment's position and avarage them for the final output. If you put the screen-space fragment position in the texture coordinates then you can offset this for each texture sample you need to do (offset can be calculated based on texture resolution and stored in a uniform var).

However a blur is not the same as multisampling, and even if you were to do multisampling in a fragment shader I doubt I'd be any faster than the normal way (most likely slower).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this