PDA

View Full Version : Screen tearing effect



vooku666
04-15-2016, 03:22 AM
Hi,

I was wandering about how to implement a screen tearing effect, such as this (photoshop demo):

2254
2255

I imagine the work should be done in the fragment shader, as if I did it in the vertex shader, everything would be just deformed and not cut. I can send the offset in via an input variable or calculate it in the shader, but how to move the fragments? Also, would I have to do it in every fragment shader I'm using (say 3 for different kinds of objects) or is there a way to acces all the fragments below the current one?

Thank you

Spoops
04-15-2016, 09:58 AM
You have to do post-processing, i.e. rendering your scene to a texture, then use that texture on a full screen quad with the desired effect in the fragment shader. What you called accessing fragments would be fetching texels on that texture.