PDA

View Full Version : BSP and creen dust



devdept
11-14-2009, 06:49 AM
Hi All,

Please give a look to the following picture:
http://www.devdept.com/bsp.png

Do you see the pixels of different color (lighter)?

This is the result of the BSP partitioning that need to split the scene for correct sorting.

Is there any trick to reduce this visual defect?

Thanks,

Alberto

yooyo
11-14-2009, 08:35 AM
Can you post same image with wireframe on top?

devdept
11-15-2009, 05:52 AM
As you expected there are many "T" vertices but it is difficult to avoid them with BSP.

http://www.devdept.com/bsp_wires.png

Thanks,

Alberto

Jan
11-15-2009, 06:03 AM
The problem is, that you loose precision when you split your polygons.

I think one solution would be to reuse the same vertex (on the GPU) for polygons that have been split. So if you split polygon A into B and C then B and C will share two vertices at their split-border. If you then render B and C, both should index the same vertex in the vertex-buffer array. Because when you use the exact same vertex then two adjacent polygons should not produce such missing pixels.

Jan.

PS: Well, T-vertices are of course a bigger problem. Hm, no idea right now.

devdept
11-15-2009, 06:13 AM
Hi Jan,

Unfortunately we are not using vertex-buffer array here but simply passing triangles with their own vertices.

By the way I am not sure that "T" vertices would render correctly even doing as you suggested.

What do you think?

Thanks,

Alberto

yooyo
11-15-2009, 02:19 PM
You must avoid T-junctions in geometry.


A
*
/ \
/ \
/ \
/ T \
B*----+----*D
\ | /
\ | /
\ | /
\|/
*
C


Here is 3 faces.. ABD, BCT, TCD. T lies between B and D. Due rasterization errors, when rasterizer process BD line in first triangle, mid point in line BD will not be exactly equal to vertex T. You have to split ABD in two faces using additional vertex T.
It is not too difficult to detect and remove T junctions..
http://www.flipcode.com/archives/Merging_Polygons_And_Sub-Pixel_Gaps.shtml
http://www.cs.miami.edu/~visser/home_page/CSC_329_files/BSPTrees.pdf

devdept
11-16-2009, 05:46 AM
Two really nice docs Yooyo, just printed and ready to be read bofore sleeping this evening!

Still skeptical on the speed of fixing T junctions BTW.

Thanks,

Alberto

yooyo
11-16-2009, 06:24 AM
Well.. dont remove them... do not generate them.

devdept
11-16-2009, 06:34 AM
Do you believe it can be faster avoiding to generate them?

We collect triangles (cloning them) within our scene from totally different objects. When we process the split for a triangle we can only know the owner, nothing else. This is the reason why I am so skeptical to find a reasonable fast approach.

BTW I still need to read carefully the docs you suggested.

Thanks,

Alberto