PDA

View Full Version : BSP-tree optimization


mister3d
02-03-2011, 09:44 PM
Does it affect only geometry?

Bitter
02-04-2011, 06:18 AM
BSP controls how the renderer organizes triangles for intersection testing, traversal, etc. It can affect both speed performance and memory.

However, if you are referring to mental ray, recent versions have BSP2. It is a bounding volume hierarchy and does not need tuning. Just use that. :-)

mister3d
02-04-2011, 08:03 AM
BSP controls how the renderer organizes triangles for intersection testing, traversal, etc. It can affect both speed performance and memory.

I thought what it does is allocating the memory, i.e. where a lot of polygons, it gives more memory, so it can calculate them faster, placing into ram. Basically the portions of ram, as I thought. The bigger portions you feed to the renderer - the faster, but more memory consumed. Or, smaller portions, slower, but no need for swapping for virtual memory (if you have limited amount of RAM, or the scene is heavy).


However, if you are referring to mental ray, recent versions have BSP2. It is a bounding volume hierarchy and does not need tuning. Just use that. :-)

I currently use Vray. So I guess BSP affects the whole performance, as it kind of slices the scene into portions for rendering?

Bitter
02-04-2011, 10:29 PM
Memory usage and performance are tied together this way.

Think of it sort of like this:

You have a warehouse of fixed size holding boxes of socks. Your warehouse is your RAM and these boxes are the voxels that hold triangles (socks)

You are looking for a specific sock. You go to a shelf near where it should be and start opening boxes. If you have 50 socks in a box you have to sort through all 50 socks (intersection tests, etc) If the sock you want isn't there, you go to the next box. If you put about 10 socks in the box then this search is faster because you only have to look through 10 socks each time.

BUT, you always have the same total number of socks, say 2 million. If you put 10 in a box then you need a lot more boxes than if you put 50 per box. So you end up eating more of you warehouse space (RAM).

Let's say you have plenty of room to go so you add boxes. Well, that's fine but now you may have too many boxes and some of them are empty. But you still have to spend time opening them because you don't know if the sock you want is in there. This begins to get inefficient and your performance gains erode away. If your warehouse is too small then you have to shove maybe 100 to 300 socks in a box to save the room. You can now store all your socks, but searching will be slow.

So you have to balance how these are stored based on the size of your scene, how the distribution of geometry is, and RAM available versus speed.

Generally the depth of your BSP makes the most impact. The depth are the number of boxes available.

mister3d
02-05-2011, 10:56 AM
Thank you Bitter, this is a very good explanation. It's good you managed to explain it in simple words, and I especially liked the analogy with boxes of socks. :thumbsup:

CGTalk Moderation
02-05-2011, 10:56 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.