Better Rendering Performancef

Started by
8 comments, last by Arex 18 years ago
Im starting this thread because im so frustrated and that because After a while since I started DX , reading many articles And books about DX , ppl are directing me to ABC answers Or most the time to ABC how to spell and English grammar :-) Ok I respect all kind of opinions and all kind point of views I almost have my own engine done which has many features But I still need to know many things actually I end up in a huge mess I know I might ask the same Question that was there somewhere and was answered already But I don’t think that’s enough I need to see more opinions more answers more point of views you cant say this can be done In this way and that’s it we are programmers and we all know things can be done in many many ways. Who he will share his piece of information will be for sure appreciated And get all the gratitude So now let me start my second reason of starting this thread Well Im not asking from repliers to answer all what im going to mention here Pick any point you want and discuss it, or just don’t :-) The subject is about best DX rendering performance 1- Textures: what’s the best way to deal with textures> loading, managing, rendering 2- Vertex, index buffers: as reducing the amount of drawprimitive calls And as how to deal with view frustum when you build many primitives in single Vertex buffer (landscape, trees, plants ... etc) and also billboarding these primitive 3- Meshes: calling drawsubset lots of time(many meshes in the scene) will knock The performance down so what’s the best way to solve that? 4- Collision detection: ive done something crazy checking if two objects intersect I first started with bounding box intersect checking then if its true I take both Transformed Vertex buffer chunks and compare them in separate thread well my PC died but im sure This can work somehow!! Do u have any better ideas?? more points to come , laters for now Have fun thinking, sharing and participating :-)
Advertisement
Quote:Original post by katkiller
1- Textures: what’s the best way to deal with textures> loading, managing,
rendering

Here is my experience about textures:
-use DDS textures with mip maps present in the file (10x loading speed compared to JPGs)
-use as small textures as possible. convince your artists that using 1024x1024 textures is usually BAAAAAD. (measure how large a texture is going to be on screen, and use a size close to that)
-use 2^x sized textures (they'll be resized anyway, unless you force it not to - but DDS conversion will do this anyway)
-use texture atlases (this is connected to reducing the number of drawsubset calls)

I let others to answer the other points, as I'm still looking for the best solution myself :)

kp
------------------------------------------------------------Neo, the Matrix should be 16-byte aligned for better performance!
2 :
First of all, don't try to batch them all in to one buffer, instead use own buffers for landscape, trees, plants, and so on. When you are building a single buffer for lots of stuff you should try to look for differences, all those that are similar to each other usually can be batched (for example uses exactly same material).

Now about the frustum, let's take an example about landscape, you have the it in one buffer now, how are you about to do visibility test to it? Well I can see a few solutions there :

1) Do triangle based visibility checks (slow, even if using higher test levels first), basically just ran trhough landscape triangles and then all tris that are visible : add to buffer.

2) Do object based visibility checks (fast, and can use : bounding sphere, box and cylinder), but this requires more buffers, one buffer per object. Now in this case you must split your landscape in blocks (for example 8x8), it can be a bit tricky. My favourite. :)

3 :
I described some optimizing tips at my homepage : Site

There is lots of tips for optimizing rendering speed, anyway, a small brief :
- Batch meshes
- Use mesh lods
- Optimize mesh data by using indexed strips or lists


Sincerely,Arto RuotsalainenDawn Bringer 3D - Tips & Tricks

Don't mix your CD/physics stuff too much with the rendering stuff. Collision detection can be done with low resolution models or even mathematical primitives such as spheres, boxes (AABB/OOBB), cylinders.

- If you need to read from VB you might consider rethinking your algorithm so that you don't need to read from VB.

- Use a spatial partitioning tree such as octree/quadtree/portas for visibility culling.

- Pack stuff in one large texture :) to reduce texture changes. One large texture is better than 4 small ones if it is needed often.

- My artists don't complain about 1 material per mesh. A material can contain several textures though.

- Minimize vertex size. I use several vertex sizes depending on the need. For example, a terrain vertex can be fit in 8 bytes. On the other hand, too many vertex formats is inefficient too.

- Batching is good, nowadays you can also use geometry instancing for an object which appears in the scene many times.
4- I`m not an expert but... For outdoor you could use BSP or Octree to hold all your objects there and check collisions only in nodes as separate spaces. Also your objects should have bounding volumes (your boxes are ok i think) and after you chceck that this volumes intersects you should go to next level - each object should be also a tree (bsp is best i think) of bounding volumes containing some parts of this object (hand, leg etc.). You should test this trees nodes intersection. You can get some thing like O(nlogn) if you do this right. On gamasutra there are some exaples of this approach I think. Hope this helps a bit.
About vertex size :
Only use one kind of vertex, for example position, normal & texture coordinate. Even better, use vertex structure that is as big as 3d cards cell size (one vertex per cell), this is called 'padding'. Then cells won't share different vertices.
Sincerely,Arto RuotsalainenDawn Bringer 3D - Tips & Tricks
Quote:]Original post by Arex

- Batch meshes


Theoretically, how do you do that?
lets say i have 10 Sam missiles,10 enemy jets which each launches a guided missile toward you , that what you are facing at certain stage at the current level you are at so after passing those you will face another kind(amount) of enemies
so in sum there are lots of objects waiting to be used against you.
What do you do to deal with such case?
Is there a better way than calling drawprimitives or drawsubsets for each object?
Quote:Original post by kovacsp
-use texture atlases (this is connected to reducing the number of drawsubset calls)


sorry,i didnt get that :-o
can you explain that please :-)

Quote:Original post by Demus79
a- Minimize vertex size. I use several vertex sizes depending on the need. For example, a terrain vertex can be fit in 8 bytes. On the other hand, too many vertex formats is inefficient too.

b- Batching is good, nowadays you can also use geometry instancing for an object which appears in the scene many times.


a- how to control vertex size?
is it at design mode or with code??
i remember i got a model from the net and it was 16bit of size
when i rendered it, it came out so ugly so i fixed that by reducing the vertex
count amount in the mesh loading class...it worked for me but i don’t think its the right way to do it

b-again can you please explain what is the best way of batching in more some details please??
Quote:Original post by katkiller
Quote:]Original post by Arex

- Batch meshes


Theoretically, how do you do that?
lets say i have 10 Sam missiles,10 enemy jets which each launches a guided missile toward you , that what you are facing at certain stage at the current level you are at so after passing those you will face another kind(amount) of enemies
so in sum there are lots of objects waiting to be used against you.
What do you do to deal with such case?
Is there a better way than calling drawprimitives or drawsubsets for each object?

Batch = one DrawPrimitive call

I suggest that you do batching for :
- static objects (for example levels)
- meshes that have the same object (for example for car windows, if they use same material)

Newer cards supports instancing, it basically means that you are able to draw multiple objects (same mesh, for example 10000 trees, but each of them can have different matrix, color, etc.) with one call.


Sincerely,Arto RuotsalainenDawn Bringer 3D - Tips & Tricks

This topic is closed to new replies.

Advertisement