dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

depth of field

 
dev.gamez.lv Forum Index -> OpenGL
View previous topic :: View next topic  
Author Message
S1
Indago dalībnieks
Indago dalībnieks


Joined: 31 Jul 2005
Posts: 219
Location: Jelgava

PostPosted: Tue Jul 25, 2006 10:50 pm    Post subject: depth of field

intreses pēc mēģināju panākt depth of field izmantojot glAccum, viss strādā, taču 0-2 FPS(it kā jau iepriekš zināju par zemo performanci) . gribētu zināt vai eksistē kāds cits paņēmiens, neizmantojot šaderus?

Last edited by S1 on Wed Jul 26, 2006 1:17 pm; edited 1 time in total
Back to top
View user's profile Send e-mail
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Tue Jul 25, 2006 11:24 pm    Post subject:

glAccum tu lietoji starp iepriekšējiem kadriem, vai kameru pakustinot renderēji scēnu pa jaunam?
It kā ati sdk samplī "MotionBlur" nemanīju sliktu fps (ok, man varbūt par krutu videokarte, rīt darbā uz sūdīgākas pamēģināšu).
Back to top
View user's profile Send e-mail
S1
Indago dalībnieks
Indago dalībnieks


Joined: 31 Jul 2005
Posts: 219
Location: Jelgava

PostPosted: Wed Jul 26, 2006 1:15 pm    Post subject:

šeit būs kods:
Code:
procedure TForm1.DXTimer1Timer(Sender: TObject; LagCount: Integer);
var i : byte;
begin
glClear(GL_ACCUM_BUFFER_BIT);                                       
for i := 0 to 7 do
     begin
     glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity;
     glOrtho(-1,1,1,-1,0,-10);
     glTranslate(0.02*j8[i].x, 0.02*j8[i].y, 1);
     drawPlane(300,300,texture);
     glAccum (GL_ACCUM, 0.125);
     end;
glAccum (GL_RETURN, 1.0);
SwapBuffers(h_DC);
end;
Back to top
View user's profile Send e-mail
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Wed Jul 26, 2006 5:05 pm    Post subject:

Ah nu jā, tur renderējot scēnu 8 reizes, gan kadru skaids būs 8 reizes mazāks.

Pamēģini kā ATI SDK dara - bluro ar iepriekšējiem kadriem ("Motion Blur" samplis). Ideja tur apmēram tāda:
pašā programmas sākumā:
Code:

   // Initialize the accumulation buffer
   drawScene();
   glAccum(GL_LOAD, 1);

Un zīmējost scēnu:
Code:

   // Draw the scene as usual.
   drawScene();

   float bf = blurFactor->getValue();
   if (bf > 0){
      bf = powf(bf, 50 * frameTime);

      // Multiply the accumulation buffer with a constant less than 1
      glAccum(GL_MULT, bf);
      // Add the framebuffer contents scaled down
      glAccum(GL_ACCUM, 1.0f - bf);

      // Transfer back to framebuffer
      glAccum(GL_RETURN, 1);
   }

Šo vajag likt tavas DXTimer1Timer fjas vietā.
Back to top
View user's profile Send e-mail
S1
Indago dalībnieks
Indago dalībnieks


Joined: 31 Jul 2005
Posts: 219
Location: Jelgava

PostPosted: Thu Jul 27, 2006 1:13 pm    Post subject:

3 FPS! laikam nav labi izmantot glAccum. varbūt kautko var pasākt ar ARB(radeon 8500) laikam OpenGL 1.3
Back to top
View user's profile Send e-mail
Display posts from previous:   
dev.gamez.lv Forum Index -> OpenGL All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group