Hello,

I've been playing for a few weeks with the WARP accelerator(s) engine of
the G400 (3D setup + 2D raster engine) on a KGI-enabled kernel. Up to now
I've postponed an actual drawing weirdness problem (because I had lower
level issues to tackle first ;-) but now I'm adressing it and... well...
I'd like to share my experiments and take advantage of the experience of
those reading the lists because I don't really understand {what,if there}
is the problem.

My usual test program draws a few thousand random Gouraud shaded triangles
on a 1024x768 16bpp framebuffer (5:6:5), using a 16bpp Z-buffer. Each
triangle is defined by 3 vertices which are defined using the
(Matrox-related) structs shown at the end of this mail. The WARP program
(aka pipe) I use is a TGZ one, so specular, fog, and alpha color
parameters theoretically have no effect on the drawing.

Triangles get drawn correctly wrt x,y positions on the screen. However,
The actual shading of the triangles is very "strange". I usually get a
*striped* rainbow color-gradient on all triangles. Changing the color of
the vertices influences the "shading", setting textures also affects the
colors (but textures do not really show up yet). However, overall, it
seems to me that the triangle drawing is wrong. (I expected to have a
smooth transition on the triangle surface, not a striped result - but I'm
not sure of what the drawing should be.)

I am not very familiar with Gouraud shading, nor with the potential
artifacts of this algorithm. (My test program more or less generates the
vertices parameters randomly - so I guess it may really use the Gouraud
algo. the ill way.) Initially, I thought it was a problem due to hardware
setup (this is still a possibility and I'm pursuing efforts to check the
driver) but well, maybe it is something else.

Does someone with experience debugging (hw-accelerated) 3D rendering can
give me advice here? Are there situations where Gouraud shaded triangles
renders to rainbow stripes? Or is it just the driver which is buggy (<me>
very stupid sometimes :-).

<teapot wanted>
 I'd also really like to (re)use some "classical" 3D test programs and the
associated tesselated 3D models in order to check the actual rendering of
the G400. (If possible with reference output for various rendering
parameters: with/without specular, with/without alpha, with/without
textures, etc. And minimal "porting" work to reuse the code - ideally only
the draw_triangle() function should need porting. :-) Do you know were I
can find some?
 </teapot wanted>


Rodolphe


* Vertex data struct definition:

typedef float mga_vertex_float_t;

typedef struct mga_vertex_color_s {
  kgi_u8_t blue, green, red, alpha;
} mga_vertex_color_t;

typedef struct mga_vertex_s {
  mga_vertex_float_t x; /* screen coordinates */
  mga_vertex_float_t y;
  mga_vertex_float_t z; /* Z buffer depth, in 0.0 - 1.0 */
  mga_vertex_float_t rhw; /* 1/w (reciprocal of homogeneous w) */
  mga_vertex_color_t color; /* vertex color */
  mga_vertex_color_t specular; /* specular component. Alpha is fog factor
*/
  mga_vertex_float_t tu0; /* texture coordinate stage 0 */
  mga_vertex_float_t tv0;
} mga_vertex_t;



Reply via email to