Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 05:37

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Real-time lens blur
PostPosted: 18.07.2010, 14:58 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: Real-time lens blur
PostPosted: 18.07.2010, 15:33 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
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.

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
 Post subject: Re: Real-time lens blur
PostPosted: 19.07.2010, 21:56 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group