xml based postprocessing framework

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: xml based postprocessing framework

Post by christianclavet »

Hi,

I can confirm that the current GLSL shaders ARE NOT compatible with ATI hardware as they contain syntax errors (NVidia video cards seem to forgive a lot!)
I found a shader debugger and was able to fix all of the GLSL shaders syntax so they work correctly. (They should all work now). I tested some of them on my main rig (NVidia) and my HTPC (Radeon HD 5950) and now the HTPC doesnt give any error and the shaders I tested worked.

Here is a link to the corrected shaders, just replace the ones you have with theses ones and it should work on both platforms now.
http://www.clavet.org/files/download/glsl_fix.zip 32.8kb

I will try to check the HLSL shaders and see if they compile (our project don't use DX but OpenGL). Since the shader debugger can also work with HLSL files, I could try to fix the errors.
EDIT: Tested all the HLSL shader for a ATI/AMD radeon card with only support PS2/VS2 and all shader compiled. So I think for the DX side it ok.

Can someone that have the same problem with the GLSL shaders with ATI/AMD videocard hardware confirm that with this it work on their end?
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: xml based postprocessing framework

Post by Granyte »

i'll give it a go when i will get around fixing my project that use it
tbw
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Re: xml based postprocessing framework

Post by tbw »

I had a deeper look into the performance.
As always when renering to rtt antialiasing is a painful issue.
In my original framework I rendered into a rtt which was scaled twice the screensize

Code: Select all

  
<!-- default auxiliary buffers (auxIn, auxOut and rttDepth)-->
  <RenderTarget id="auxIn" colorFormat="10" scale="2.0" />
  <RenderTarget id="auxOut" colorFormat="10" scale="2.0" />
 
downscaling2x2 in the finalpass leads to an acceptable antialiasing effect (at the cost of framerate).

Now I experimented with the fxaa algorithm designed by Timothy Lottes (http://timothylottes.blogspot.com/2011/ ... eased.html).
I included it into the framework and it gave me a significant boost in terms of framerate.
rtt.xml now look like this:

Code: Select all

  
<!-- default auxiliary buffers (auxIn, auxOut and rttDepth)-->
  <RenderTarget id="auxIn" colorFormat="10" scale="1.0" />
  <RenderTarget id="auxOut" colorFormat="10" scale="1.0" />
 
You can find the project here
http://www.mediafire.com/?9g9cr1n75364zr5.
with the fixed glsl code by christianclavet (big thank you for this!!! :D )
I made some minor changes to the code. (final pass is now a pp in the effect.xml)

Image

DirectX with hlsl works fine but unfortunately I didn't get it to work with openl. Maybe somone of you has got an idea...
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: xml based postprocessing framework

Post by christianclavet »

Is the FXAA algorithm is a postprocess shader that you added to the framework?
tbw
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Re: xml based postprocessing framework

Post by tbw »

yes, in the download I included the fxaa.h (located in the shader dir)
I added another effect

Code: Select all

 
  <!-- EPPE_FINAL_PASS = 25 -->
  <Effect id="25" name="Render To Screen">
    <ShaderPostProcess name="FinalPass" vsFile="vertex.fx" vsType="1" psFile="screenquad.fx" psType="7" psEntry="finalPassFXAA" psUseBufferWidth="1" psUseBufferHeight="1">
      <Texture index="0" textureClamp="1" />
      <RenderSource path="auxIn" />
      <RenderTarget path="" />
    </ShaderPostProcess>
  </Effect>
and the update method now looks like this

Code: Select all

void CPostProcessManager::update()
{
        // render the final pass
        render(EPPE_FINAL_PASS);
}
also I modified the screenquad.fx
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: xml based postprocessing framework

Post by christianclavet »

Hi, Just checked about this. This is really fast. I did not see a drop in FPS while it was used (hlsl)

You could check this for the GLSL shader. They were able to make it work, perhap their shader code would help. I've also read that the FXAA was developped by NVIDIA but it can run on ATI hardware.

http://www.geeks3d.com/20110405/fxaa-fa ... geforce/3/
tbw
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Re: xml based postprocessing framework

Post by tbw »

Hi Christian,

I will will ceck this out immediataly...
mkawick
Posts: 2
Joined: Thu Oct 06, 2011 8:03 pm

Re: xml based postprocessing framework

Post by mkawick »

For the DOF, how do you control the focal depth? In the PostProcessManager, I tried playing with this a bit

DepthMaterial->setVertexShaderConstant("DistanceScale", 0.0006f);

but the results were not stunning. For larger values everything is blurred. A range of -0.0002 to 0.0002 seems fine for distance scale. Is there another value that I should be modifying instead?
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: xml based postprocessing framework

Post by Granyte »

hey i've been looking deep in your code searching for a screenquad exemple and i noted something is it me or you create and destroy a screen quad for every effect every frame?
Justei
Posts: 47
Joined: Fri Aug 20, 2010 11:20 am

Re: xml based postprocessing framework

Post by Justei »

I'm unsure about if this is my fault or well, what it could be...
Anyhow, the problem I am having is that whenever I try to include this into my project I get the following error:

Code: Select all

C:\Users\Kristoffer\Desktop\ChannelIrrlicht\include\irrMap.h|488|error: non-static reference member 'irr::core::map<irr::core::string<wchar_t, irr::core::irrAllocator<wchar_t> >, irr::video::ITexture*>& irr::core::map<irr::core::string<wchar_t, irr::core::irrAllocator<wchar_t> >, irr::video::ITexture*>::AccessClass::Tree', can't use default assignment operator|
Unsure of why this could be :/ I am trying to run this on mingw on Code::Blocks... Any ideas?
Image
tbw
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Re: xml based postprocessing framework

Post by tbw »

Hi Granyte
hey i've been looking deep in your code searching for a screenquad exemple and i noted something is it me or you create and destroy a screen quad for every effect every frame?
Every Effect is basically derived from IPostProcess. IPostProcess itself owns a screenquad.

Code: Select all

        
// screend quad mesh
video::S3DVertex Vertices[4];
u16 Indices[6];
 
The render function uses this screenquad.

Code: Select all

 
void CShaderPostProcess::render()
{
        // clear the projection matrix 
        Engine->getVideo()->setTransform(video::ETS_PROJECTION, core::IdentityMatrix); 
        
        // clear the view matrix 
        Engine->getVideo()->setTransform(video::ETS_VIEW, core::IdentityMatrix); 
 
        // set the transform
        Engine->getVideo()->setTransform(video::ETS_WORLD, core::IdentityMatrix ); 
        
        // select the post proccess material
        Engine->getVideo()->setMaterial(getMaterial());
 
        // render the screen quad
        Engine->getVideo()->drawIndexedTriangleList(Vertices, 4, Indices, 2);
}
This means:
Every Effect has got its own screenquad (oncly created in the constructor) an the screenquad is reused in every frame.

Hope this helps.
Granyte
Posts: 850
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: xml based postprocessing framework

Post by Granyte »

nice well i ended up using the sceen quad exemple from an other post processing exemple cause all i suceded was getting more and more lost lol

anyway thanks for explaining
tbw
Posts: 59
Joined: Sat Jan 15, 2011 9:51 am
Location: Germany

Re: xml based postprocessing framework

Post by tbw »

Hi Justei,
I'm unsure about if this is my fault or well, what it could be...
Anyhow, the problem I am having is that whenever I try to include this into my project I get the following error: .....
I don't know exactly, but I guess this could be a const issue.
Perhaps changing the definition of the RenderTargetMap could help

In PostProcessManager.h change

Code: Select all

        // additional render target textures (defined in rtt.xml)
        core::map<core::stringw, video::ITexture*> RenderTargetMap;
to

Code: Select all

        // additional render target textures (defined in rtt.xml)
        core::map<const core::stringw, video::ITexture*> RenderTargetMap;
I could not evaluate it, because I don't have a testbed for mingw/CodeBlocks ... :?
Justei
Posts: 47
Joined: Fri Aug 20, 2010 11:20 am

Re: xml based postprocessing framework

Post by Justei »

tbw wrote:Hi Justei,
I'm unsure about if this is my fault or well, what it could be...
Anyhow, the problem I am having is that whenever I try to include this into my project I get the following error: .....
I don't know exactly, but I guess this could be a const issue.
Perhaps changing the definition of the RenderTargetMap could help

In PostProcessManager.h change

Code: Select all

        // additional render target textures (defined in rtt.xml)
        core::map<core::stringw, video::ITexture*> RenderTargetMap;
to

Code: Select all

        // additional render target textures (defined in rtt.xml)
        core::map<const core::stringw, video::ITexture*> RenderTargetMap;
I could not evaluate it, because I don't have a testbed for mingw/CodeBlocks ... :?
Didn't seem to change anything unfortunately :/. Any other ideas xD?
Image
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: xml based postprocessing framework

Post by Cube_ »

nice, but what about stability and/or bugs. is it fully tested (Even all obscure shader combinations)?

I will download it, because it is awesome.
"this is not the bottleneck you are looking for"
Post Reply