Horde3D
http://horde3d.org/forums/

Real-time lens blur
http://horde3d.org/forums/viewtopic.php?f=7&t=1196
Page 1 of 1

Author:  DarkAngel [ 18.07.2010, 14:58 ]
Post subject:  Real-time lens blur

I've been posting about this on the GameDev.new forums (details in that link), but seeing Horde made it so easy to prototype this effect I've got to thank you here ;)
Image

Just quickly (in case you don't want to read that link ;) ), this technique involves drawing a grid of quads over the screen. The grid data is static - it's updated by fetching data from a texture in the vertex shader.
Unfortunately my prototype is utterly CPU bound, because I implemented my screen-space quads really quickly with the overlay system:
Code:
   for( int y=0; y<appHeight; y+=16 )
   {
      for( int x=0; x<appWidth; x+=16 )
      {
         float left, top, bottom, right;

         top = bottom = (y+8)/(float)appHeight;
         left = right = (x+8)/(float)appWidth;
         h3dShowOverlay( left, top, 0, 1, left, bottom, 0, 0, right, bottom, 1, 0, right, top, 1, 1,
                     1, 1, 1, 1, _bokehMatRes, (x*3+y*2)%5 );
      }
   }
   
   h3dRender( _cam );
   h3dFinalizeFrame();
   h3dClearOverlays();
I'm guessing that my best bet will be to procedurally create a H3DG file and mesh/model nodes that contain this vertex data? I can then just place them in my scene as usual, but with a special class name on the material, so the pipeline can render them in the right stage.
Does that sound like the best solution?


Thanks again for the flexible renderer - this prototype would have taken me much longer on some other engines!

Author:  MistaED [ 18.07.2010, 15:33 ]
Post subject:  Re: Real-time lens blur

Very fancy DarkAngel!

Just a heads up, the latest SVN has replaced h3dShowOverlay with the plural h3dShowOverlays, and better yet you can batch quads into a single draw call so that would solve your CPU-bound problem.

Author:  marciano [ 19.07.2010, 21:56 ]
Post subject:  Re: Real-time lens blur

Interesting work DarkAngel, I will take a closer look later.

Regarding the grid, as MistaED pointed out, the new overlay function is a lot more efficient (batching together overlays when possible). Using overlays for the grid is a clever idea for getting this up and running quickly, although they are of course intended for user interfaces rather than post processing. Using your own model as you propose is another option that can work out.

However, my preferred solution would be to extend/refactor the DrawQuad pipeline command so that it can optionally use some custom geometry (geo resource). Basically that's just one additional parameter that can be empty in order to use the default fullscreen primitive. I think this would fit very nicely the data-driven nature of our post-processing/pipeline framework.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/