A call for Garbage

Thinking about improving the Artwork in Vega Strike, or making your own Mod? Submit your question and ideas in this forum.

Moderator: pyramid

klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

I'm not saying that. I'm saying that it wouldn't be a good idea, performance-wise, to have them in separate vertex buffers (hence, separate batches).
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Ah, sorry; what do you mean by 'batches'?
At each rendering frame there could be one or more objects instanced, but not too many, probably. If by batching you mean sending all the vertexes for all the objects as a single array, though, I don't think it should be that much of a deal maker or breaker. We're not talking hundreds of thousands of vertexes here. The abundance I'm thinking of is perhaps a bit more than the craps floating in Privateer; not a piece of crap per cubic meter. Maybe as you arrive to your destination and are flying slow, therefore, there might be as much as one crap object in every 10x10x10 meter cube, average.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

Batches are basic rendering operations.

Code: Select all

glDrawElements(...);
is a batch.

They imply a dialogue between CPU and GPU that has the potential to overload the CPU, while leaving the GPU idle, if there are too many of them implying to little work for the gPU. That's the case when a batch draws a single garbage item.

And try to estimate the number of garbage items on screen, rather than per volume... that's a much more meaningful number.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

Actually, how many objects per frame are being added to (and deleted from) the screen, would be most meaningful, right? As the CPU only needs to send the object to the GPU at creation time?

Assuming the above is right:

Max distance is when object is 1 pixel in size. These objects are about a foot and a half in size, 50 cm, so, assuming vertical frustrum is, say, 30 degrees, divided by 1024, that's 0.03 degrees per pixel.

tan(.03 deg) =~ 0.0005

50 cm / 0,0005 = 500,000 cm = 5km.

Okay, just to simplify, let's consider a rectangular spawning plane 5 km ahead, about 5 x 3 km. At station arrival speed (speed of sound, say) and with typical in-station density of garbage (1 piece per 1000 m^3), we get:

Speed of sound = 333 m/s
Assuming 66 Hz refresh,
333/666 = 30/6 = 5

The answer is 5

No, just kidding :)

5 meters x 5000 meters x 3000 meters / 1000 m^3 = ....

= 5 x 5 x 3000 = 25 x 3 x 1000 = 75,000 ... ahem....

I'm starting to see the point of particle systems... :(

Why didn't I do the math before? I usually do. :oops:
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

chuck_starchaser wrote:Actually, how many objects per frame are being added to (and deleted from) the screen, would be most meaningful, right? As the CPU only needs to send the object to the GPU at creation time?
Actually, it isn't. On-screen, that's the one. That's the minimum amount of particles you must update CPU-side, and the amount of objects to tell the GPU to draw.
chuck_starchaser wrote:Why didn't I do the math before? I usually do. :oops:
:roll: I'm begninning to embrace one of my ideas - one that would preclude true physics behavior, though: implicit coordinates.

Say... I just give the vertex shader the parameters, and it takes care of placing the objects in space... all 75000 of them... by using a pseudorandom function with some parameters to be able to control animation (like rotation, translation - if any - etc...)
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

I didn't know a shader could create vertexes; I thought they could only move them around.

Hmm... or are you talking about having the geometry there already and the shader instancing it with various placements and rotations? That was what I was thinking about originally.
Anyhow, the numbers could be reduced by using a particle system as LOD. Soon as a particle is getting too close it transmutes into a piece of crap. And only the ones near your line of view. If you turn your head, never mind. Hell with it.
Last edited by chuck_starchaser on Wed Jan 18, 2006 7:53 pm, edited 1 time in total.
klauss
Elite
Elite
Posts: 7243
Joined: Mon Apr 18, 2005 2:40 pm
Location: LS87, Buenos Aires, República Argentina

Post by klauss »

That's true, but the CPU needs do nothing.
So... it would create (only once) a vertex buffer with, say, 1000 objects, and call it to create them in batches of a thousand. The GPU does the rest - positioning and everything.

That's called shader instancing. A feature I'm going to try to use for asteroid fields.
Oíd mortales, el grito sagrado...
Call me "Menes, lord of Cats"
Wing Commander Universe
chuck_starchaser
Elite
Elite
Posts: 8014
Joined: Fri Sep 05, 2003 4:03 am
Location: Montreal
Contact:

Post by chuck_starchaser »

klauss wrote: That's called shader instancing. A feature I'm going to try to use for asteroid fields.
Now he tells me... ;-)
Post Reply