From: Brian P. <br...@va...> - 2001-06-11 22:04:34
|
Rob Hynes wrote: > > Hi, > > For a while I've been having problems with software rendering of triangle > strips arranged into rings. The problem is that if the grid is too fine, > or the object too distant, or the window too small then parts or all of > the strip are invisible. It appears as either a hole in an object where > the grid is finest, or as a speckled pattern. Background objects can be > seen through the gaps. It seems to depend on the size of the triangles in > relation to the pixel size - changing the window size will change the > effect even if no changes are made to the object definition. The problem > only occurs with software rendering, in 16 or 32 bit colour depth, eg with > the make linux target. Using the Glide driver on a Voodoo3 card (make > linux-glide) I get the problem in windowed mode, but it goes away in > fullscreen mode with no modification to the code. I have tried enabling > and disabling depth testing, back face culling, double buffering and > dithering and none of these make any difference. A program that produces > the problem is attached below. It should produce a white circle with a > small hole in the middle. With software rendering a ring of black > speckles also appears around the central hole. The size of the ring > depends on the window resolution. There may be some crucial setting I've > missed or maybe this could be a software rendering bug? Any suggestions > would be welcome. Rendering very tiny triangles is actually a tricky problem because of accuracy problems in the arithmetic. Other people have had problems with this in the past. Usually, tweaking the code in s_tritemp.h which computes the triangle area and thresholds it has minimized the problem, if not eliminated it. I've been tinkering with your test program and Mesa's triangle rasterizer for a couple hours now. It looks like the only solution will involve snapping the triangle x/y vertices to some integral subpixel position and adjusting the threshold for processing tiny triangles. I've tried to avoid doing this in the past because of the performance hit. However, I think it can be done without too much of a penalty. When I've got something for you to test I'll let you know. -Brian |