Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Am I rendering BSP trees incorrectly?

I have a BSP tree loaded into memory. I first find out what leaf I am in. Next, I decode the PVS. Then, I run through each region in that PVS and see if it lies within my frustum.

I have been told that this is the incorrect way to render and that I should actually be doing a back to front rendering by traversing the BSP tree. How exactly do I do this? I have seen a number of different methods of doing this, that's why I ask.

For instance, the Quake 3 BSP rendering says: Traverse the BSP to determine in which leaf the camera is positioned. Retrieve and decompress the PVS for this leaf, iterate through PVS and mark leaves in the BSP. Traverse the BSP near to far If a Node is not marked, skip it. Test the Node Boundary Box against the Camera Frustrum. Add the current leaf to the rendition list

Is this still the standard way it is done today or at least for simpler games.

like image 952
user1151255 Avatar asked Nov 13 '22 11:11

user1151255


1 Answers

As OrgnlDave said:

When you draw a primitive, the pixels placed in front of the z-buffer will be paint and the program shader will be executed. But if the pixel is behind the scene then the pixels is rejected. There is no obligation to made such of drawing, front to back, but the gain in performance is worst it.

However if you using blend object you will need to draw this one after every solid object and do it from back to front. Because you need to blend the color with the object placed just after.

like image 191
AxFab Avatar answered Nov 15 '22 23:11

AxFab