FAQ  •  Register  •  Login

drawflame and timerefresh

Moderator: Inside3D Admins

<<

r00k

Posts: 922

Joined: Sat Nov 13, 2004 10:39 pm

Post Tue Apr 17, 2012 9:34 am

drawflame and timerefresh

I've noticed that r_drawflame 0 (used in some engines) will give me over 1400 fps on the start map using timerefresh, with flames on it cuts down just below 900. There are only 4 flames drawn in that room!
Are all the flames on the map being drawn thru the efrag drawing code or am i missing why 4 models kill 500fps?!
<<

Spike

Posts: 2084

Joined: Fri Nov 05, 2004 3:12 am

Location: UK

Post Tue Apr 17, 2012 1:27 pm

Re: drawflame and timerefresh

it probably includes a 5th in the easy skill selection.
any engine that still uses fans/strips instead of drawing the lot in one go is transforming/interpolating/lighting each vertex up to 3 times, and messes up its cpu cache on every api call.

also if there are particle effects attached, then yeah, framerates will plummet.

]/r_drawflame 1
]timerefresh
0.024622 seconds (5198.631454 fps)
]/r_drawflame 0
]timerefresh
0.024011 seconds (5330.949493 fps)

fte still interpolates verticies on the cpu, but only once (yay for vertex arrays). lighting is done in a vertex shader. fte's model/backend separation is basically like q3, just the backend knows about glsl and model lighting is one of the things that is offloaded onto the gpu.
fte doesn't use vbos for models still. it really should be fixed to do so though as platforms like nacl would really benefit from it, as would 10k vertex skeletal models (though those are already positioned on the gpu).
<<

mh

User avatar

Posts: 2172

Joined: Sat Jan 12, 2008 1:38 am

Post Tue Apr 17, 2012 7:28 pm

Re: drawflame and timerefresh

I must add r_drawflame to DirectQ and restore timerefresh (no front-buffer drawing in D3D tho... :( )

Some other possible causes come to mind here. Flames are static entities rather than dynamic, so depending on how you handle adding static entities to the visible edicts list you could find that you're adding each entity multiple times as frames build up. That would certainly hurt performance.

The cause here is that static entities get added during R_RecursiveWorldNode, which will get called multiple times during a timerefresh, but the visible edicts list is only cleared in CL_RelinkEntities. So if you have 5 torches in your scene, each frame will add an extra 5 torches in addition to those that have already gone before. By the time the final frame comes around you could have thousands of torches in your scene, but looking like there are only 5 as they'll all occupy the same 5 positions.

This is a slightly insidious problem because it doesn't show up so badly in normal gameplay, so you may not even be aware that you have it.

Putting a sexy particle effect on the model could be a bad idea here; depending on how efficiently you draw particles, of course. But my bet is on the static entity adding being the cause.
Like the fifth day of playing 24-hour Scrabble when you don't want to use any letters because each one means a world to you because you're so deranged.
<<

r00k

Posts: 922

Joined: Sat Nov 13, 2004 10:39 pm

Post Tue Apr 17, 2012 8:36 pm

Re: drawflame and timerefresh

The cause here is that static entities get added during R_RecursiveWorldNode, which will get called multiple times during a timerefresh...


Ok I got ya. If i just record a simple 30 second demo of me walking around the start map, and then timedemo that demo once with flames once without, im only losing about 10-20 fps with torches on.

Phew!
<<

mh

User avatar

Posts: 2172

Joined: Sat Jan 12, 2008 1:38 am

Post Tue Apr 17, 2012 9:27 pm

Re: drawflame and timerefresh

Just got to test this more fully with DirectQ. timerefresh numbers are a bit different here because D3D won't let you draw to the front buffer, but they're consistently different so that makes them valid for comparisons within DirectQ.

Standard behaviour is:

r_drawflame 1 - 1175 fps
r_drawflame 0 - 1178 fps

If I remove the guard I have against entities being added more than once in each rendered frame I get:

r_drawflame 1 - 832 fps
r_drawflame 0 - 1178 fps (unchanged)
Like the fifth day of playing 24-hour Scrabble when you don't want to use any letters because each one means a world to you because you're so deranged.

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Icons provided by Aha Soft