-1
\$\begingroup\$

Recently, I've been making a 3D game (hint my questions), and I recently have modified a pixelization shader from a unity shader graph tutorial. The thing is, I want to render the shader on the WHOLE screen, not just a single object, but while researching, I've come across something called Framebuffer Objects (FBOs), which make it pretty much easier (basically just grabs the frame and turns it into an image for you to "process" it before it gets rendered on the screen), but I don't really want to use FBOs. How would I come across doing this? I've researched a little and came across using a quad, but since my game is 3D, not 2D, I have a perspective camera, so I don't know how that would turn out.

\$\endgroup\$
0
\$\begingroup\$

Are you using a game engine? If yes, your game engine likely comes in with a built in post-processing system/pipeline, in which case you shouldn't have to worry about frame buffers for simple post-processing.

If your engine doesn't have a post-fx system, or you're making an engine from scratch: yes you would use a quad. The key, is that instead of rendering/transforming the quad in world-space you would render and position it in view-space so it will be fixed in the screen instead of in the world. You'll do this changing whatever transformation matrix is being used to displace the quads vertices to a view-space-matrix.

You might want to familiarize yourself with the purpose of matrices (which effectively act as stores for transformations in 3D games) and the basic graphics / shader pipeline.

Here's a link which offers an overview of the role of matrices and spaces in realtime 3D rendering.

\$\endgroup\$
14
  • \$\begingroup\$ no, im using LWJGL \$\endgroup\$
    – Pale_Gray
    May 20 at 3:45
  • \$\begingroup\$ and I am using depreciated methods, so no binding vaos and vbos \$\endgroup\$
    – Pale_Gray
    May 20 at 3:46
  • \$\begingroup\$ hmm im not familiar with non-modern open GL or LWJGL: but the key is change the transformation matrix for the quad from world-space to view space. Then you can set the quads vertices effectively in 2D space. \$\endgroup\$
    – Charly
    May 20 at 3:49
  • \$\begingroup\$ So like, use a different fragment and vertex shader file to convert the matrices into a view matrix, rendering the quad flat on the screen. \$\endgroup\$
    – Pale_Gray
    May 20 at 3:50
  • 1
    \$\begingroup\$ For more complex post-fx, you'll have to use FBOs. With the above method described, you're limited in what you can actually read from. You don't have full access to read from the texture that you're currently writing to. Good luck! \$\endgroup\$
    – Charly
    May 20 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.