Page 3 of 9

Re: xml based postprocessing framework

Posted: Sat Sep 03, 2011 5:35 am
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?

Re: xml based postprocessing framework

Posted: Sun Sep 04, 2011 4:04 am
by Granyte
i'll give it a go when i will get around fixing my project that use it

Re: xml based postprocessing framework

Posted: Sun Sep 04, 2011 7:20 am
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...

Re: xml based postprocessing framework

Posted: Sun Sep 04, 2011 9:47 am
by christianclavet
Is the FXAA algorithm is a postprocess shader that you added to the framework?

Re: xml based postprocessing framework

Posted: Sun Sep 04, 2011 11:28 am
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

Re: xml based postprocessing framework

Posted: Sun Sep 04, 2011 3:06 pm
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/

Re: xml based postprocessing framework

Posted: Sun Sep 04, 2011 5:19 pm
by tbw
Hi Christian,

I will will ceck this out immediataly...

Re: xml based postprocessing framework

Posted: Thu Oct 06, 2011 10:33 pm
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?

Re: xml based postprocessing framework

Posted: Sat Dec 17, 2011 8:53 pm
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?

Re: xml based postprocessing framework

Posted: Sun Dec 18, 2011 3:19 am
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?

Re: xml based postprocessing framework

Posted: Sun Dec 18, 2011 1:03 pm
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.

Re: xml based postprocessing framework

Posted: Sun Dec 18, 2011 1:19 pm
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

Re: xml based postprocessing framework

Posted: Sun Dec 18, 2011 1:19 pm
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 ... :?

Re: xml based postprocessing framework

Posted: Sun Dec 18, 2011 4:21 pm
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?

Re: xml based postprocessing framework

Posted: Fri Jan 13, 2012 8:25 am
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.