Can someone explain to me the cycle of Filters? I know that initFilter gets called first, but per frame, what gets called first, next, last, etc.?
Also, what is the variable in Filter called “material” for? Is that the output material? What are the different forced-techniques? Looking in the SSAOFilter class I see one is “PreNormalPass” so I assume that renders the normals to a texture?
What about Passes? Usage examples?
I would volunteer to organize all of the needed info into one place and maybe work on a page for it but I hardly have time anymore.
the methods are called in this order (pretty much the same flow as processors):
initFilter() is called once when the FilterPostPorcessor is initialized or when the filter is added to the processor and this one as already been initialized.
for each frame the methods are called in that sequence :
preFrame() occurs before anything happens
postQueue() occcurs once the queues have been populated (there is one queue per bucket and 2 additional queues for the shadows, casters and recievers). Note that geometries in the queues are the one in the view frustum.
postFrame occurs once the main frame has been rendered (the back buffer)
Those methods are optional in a filter, they are only there if you want to hook in the rendering process.
The material variable is here for convenience. You have a getMaterial method that returns the material that’s gonna be used to render the full screen quad. It just happened that in every implementation I had a material attribute in all my sub-classes, so I just put it back in the abstract class. Most of the time getMaterial returns this attribute.
Forced-technique can be any technique really, they are more related with the material system than to the filters but anyway. When you use a forced technique the renderer tries to select it on the material of each geometry, if the technique does not exists for the material the geometry is not rendered.
You assume well about the SSAO filer, the normal of the scene are rendered to a texture in a pre pass.
Passes : these are filters in filters in a way. First they are a convenient way to initialize a FrameBuffer and the associated textures it needs, then you can use them for what ever you want.
For example, a Pass can be (as in the SSAO filter) an extra render of the scene with a forced technique, and you have to handle the render yourself in the postQueue method.
It can be a post pass to do after the main filter has been rendered to screen (for example an additional blur pass used in SSAO again). You have a list of passes called postRenderPass in the Filter abstract class. If you add a pass to this list, it’ll be automatically rendered by the FilterPostProcessor during the filter chain.
@nehon another question: When you input a Vector3 to a material, isn’t it automatically put into view-space? If so, how could I reverse this in a filter? As far as I remember the regular GLSL constants like g_WorldViewMatrix don’t work in filters since it’s on a Quad and not the actual scene.
@vinexgames said:
@nehon another question: When you input a Vector3 to a material, isn't it automatically put into view-space?
Not sure what you mean... the value you send is the value you receive there is no space involved in the process...
@vinexgames said:
As far as I remember the regular GLSL constants like g_WorldViewMatrix don't work in filters since it's on a Quad and not the actual scene.
yes you have to pass the one from the scene camera as a mat param if you need it.
What are you trying to do exactly? As a rule of thumb if you need to transform a vector material parameter it’s better to transform it once on the cpu side before sending it to the shader instead of transforming it in the shader one per vertex or once per pixel.
@nehon I’m giving deferred shading another run. I have directional lights working perfectly fine, but when it comes to point-lights it’s not quite right. So my question would be, how can I change view-space to world-space on a Filter? Which matrix would be used for this?
@vinexgames said:
@nehon I'm giving deferred shading another run. I have directional lights working perfectly fine, but when it comes to point-lights it's not quite right. So my question would be, how can I change view-space to world-space on a Filter? Which matrix would be used for this?
you need the inverse ViewMatrix.
which can be easily computed using camera.getViewMatrix().inverse() (don't use inverseLocal here or you'll screw everything).
@nehon Ahh, I see. Since you’re the one that created the SSAO filter, the code that reconstructs position from depth in the SSAO shader is in view-space, right?