Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (526)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Practical Post Processing  (Read 1230 times)
0 Members and 1 Guest are viewing this topic.
Offline Slyth2727
« Posted 2014-06-11 00:18:17 »

I'm implementing a post processing system into my engine for.. well post processing, and I've been debating ways to do it. I finally settled on a system that goes like this:

1. Render whole scene to a texture.
2. Render said texture to a quad with a shader "postProcess". (I have to invert the y of the texture coordinate in my vertex shader for some reason)
3. Align quad to the user and render it.

This way, I can edit the whole scene with any shader I please, and quite easily.
However, this seems like a bit of a hack. Is this the general way post processing is implemented, or is there a different way? Also, with this, I can't simply sample gl_FragCoord.z and linearize it for depth coordinates, I have to render the depth buffer to another FBO and send that in to my post process shader.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline wessles

JGO Wizard


Medals: 74
Projects: 4
Exp: 4 years


Radirius Software


« Reply #1 - Posted 2014-06-11 01:32:02 »

I don't really get what you are asking, so I will just comment on random bits that you said.

I don't think it feels like a hack; this should work just fine.

Where did z depth buffers come into the picture?

Offline Slyth2727
« Reply #2 - Posted 2014-06-11 02:17:57 »

I don't really get what you are asking, so I will just comment on random bits that you said.

I don't think it feels like a hack; this should work just fine.

Where did z depth buffers come into the picture?

I'm asking about the best way to implement a post processing system into an existing engine. Check http://en.wikipedia.org/wiki/Video_post-processing if you don't know what it is.

The depth buffer is important in many post processing effects, so I need to have an easy, non expensive way to access it. Currently I have to render it to a whole nother FBO and send that in to my post processing shaders in order to use it, and that may not be the best way. However this is the way I will have to do it once I implement deferred rendering, so I may want to just keep it this way.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline The Lion King
« Reply #3 - Posted 2014-06-11 02:33:10 »

http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/#Using_the_depth

Read this and the shadow and light mapping stuff on the same site.

"You have to want it more than you want to breath, then you will be successful"
Offline Slyth2727
« Reply #4 - Posted 2014-06-11 04:03:12 »

http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/#Using_the_depth

Read this and the shadow and light mapping stuff on the same site.

I've actually already read the shadow stuff on that site, I've got shadows in the engine already as well.
But I've not seen the depth stuff on the site yet, thanks for that!

Edit:

I've done a bit of research, and I understand the subject a bit more.

In order to do what I want (have the regular rendered buffer as well as the depth buffer) without more than one FBO, I will need to implement multiple render targets. To do this, I pass in multiple attachments, formats, and internal formats as an array. In my case, I'd pass in GL_RGBA and GL_COLOR_ATTACHMENT0 for the regular render and GL_DEPTH_COMPONENT and GL_DEPTH_ATTACHMENT for the depth. Then use glDrawBuffers (plural) instead of the regular glDrawBuffer. However, where I get stuck is where sample each one in my post process shader. I pass in one texture, from the FBO, however how do I sample from the depth buffer vs the regular render?

Edit 2:
It was late, and I was asking a silly question. Nevermind the above question.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (72 views)
2014-11-26 15:22:04

toopeicgaming1999 (62 views)
2014-11-26 15:20:36

toopeicgaming1999 (15 views)
2014-11-26 15:20:08

SHC (29 views)
2014-11-25 12:00:59

SHC (27 views)
2014-11-25 11:53:45

Norakomi (32 views)
2014-11-25 11:26:43

Gibbo3771 (27 views)
2014-11-24 19:59:16

trollwarrior1 (40 views)
2014-11-22 12:13:56

xFryIx (78 views)
2014-11-13 12:34:49

digdugdiggy (56 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!