Screen tearing effect


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


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

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.