PDA

View Full Version : cube env mapping / spheremapping hardware bug in ATI-Radeon(VE) Cards?



herc
06-20-2002, 02:18 PM
dear opengl-devlprs,
im currently writing a tetris game and played around with reflection mapping a little. with the gforce 256 ddr graphics card at my workplace everyting is fine, but with my radeon ve from ati there i get strange seams on my tetris-blocks:
http://www.videofiles.de/aknet/tetris/beta/gravytris_cubemapped_lighted.jpg

if i turn off lighting, everything is fine again.
http://www.videofiles.de/aknet/tetris/beta/gravytris_cubemapped_no_light.jpg

is this a programming bug of mine ? or bad opengl drivers (i've installed latest release version)? any idea? another thing: my skybox has black seems, but again only on my ati-card. and if you look at the playfield border - the cube reflection map has white seams - strange ...
on nvidia - no seams at all....

NitroGL
06-20-2002, 03:19 PM
Originally posted by herc:
dear opengl-devlprs,
im currently writing a tetris game and played around with reflection mapping a little. with the gforce 256 ddr graphics card at my workplace everyting is fine, but with my radeon ve from ati there i get strange seams on my tetris-blocks:
http://www.videofiles.de/aknet/tetris/beta/gravytris_cubemapped_lighted.jpg

if i turn off lighting, everything is fine again.
http://www.videofiles.de/aknet/tetris/beta/gravytris_cubemapped_no_light.jpg

is this a programming bug of mine ? or bad opengl drivers (i've installed latest release version)? any idea? another thing: my skybox has black seems, but again only on my ati-card. and if you look at the playfield border - the cube reflection map has white seams - strange ...
on nvidia - no seams at all....

The GeForce 1 and 2 have a hardware bug that causes GL_CLAMP to act like GL_CLAMP_TO_EDGE_EXT. Change your GL_CLAMP to GL_CLAMP_TO_EDGE_EXT, that should fix your problem.

fenris
06-20-2002, 03:22 PM
Those seams are the texture border, which is black by default. I assume you are using GL_CLAMP on S, T and R. GL_CLAMP is implemented wrong in nvidia's drivers, and correctly in ATI's. Try using GL_CLAMP_TO_EDGE_EXT. This will avoid the blending of the texture border.

jwatte
06-20-2002, 06:11 PM
To be specific, the GeForce 1 and 2 treat GL_CLAMP as GL_CLAMP_TO_EDGE, whereas GeForce 3+ implements each mode correctly. I'm not aware of any actual useful use of GL_CLAMP so this isn't really all that bad a bug, except it keeps masking problems like these for people who only test on one or a few cards.

zed
06-20-2002, 08:24 PM
carmack - When I have a
problem on an Nvidia, I assume that it is my fault. With anyone else's
drivers, I assume it is their fault

(oh no i hear matt coming)
http://www.opengl.org/discussion_boards/ubb/smile.gif

Nutty
06-20-2002, 11:22 PM
jwatte, I'm pretty sure GF3 and GF4 treats GL_CLAMP as GL_CLAMP_TO_EDGE also. It does on my gf4 anyway. I believe you need to implement a registry key in order for it to work correctly.

Nutty

herc
06-21-2002, 12:18 AM
ok, thanks! the CLAMP Extension works fine!
the other problem with wrong reflections on my ati card remains, while those are not on the gforce.
http://www.videofiles.de/aknet/tetris/beta/wrong_reflections_on_tile.jpg

but i first check my code, because this happens only with my hand-coded beveled blocks. with glu-sphere or a simple cube it does not exist. maybe it is important to always define the quads clockwise / counterclockwise ? the normals seems to be correct, because when i switch off cubemapping/spheremapping, lighting is correct.
http://www.videofiles.de/aknet/tetris/beta/scrnshot1.jpg

besides - cubemapping is SO SLOW on my ati ve - seems like it is done in software ;-)
(or is it the ripped T&L - unit that causes perfomance break in ?)

anyway- thanks for the seams - solution !

dorbie
06-21-2002, 12:29 AM
I have a theory, do you have two sided lighting and no face culling?

Try turning on back face culling, make sure two sided lighting is off and this will make sure your raw face normals and polygon winding are doing the right thing here. Obviously you may have to tweak your rendering code.

It may be that you look OK with two sided lighting but when you cube map one implementation is not switching the normal for the cube map texturing. The thing is to make sure that the simple illuminated version is working under the simplest of conditions, then you can enable cube mapping and hopefully it'll be consistent.

One of the implementations may be incorrect or the spec may be unclear w.r.t. cube mapping + two sided lighting.

It's just a theory, I'd be interested to hear back about your results.

[This message has been edited by dorbie (edited 06-21-2002).]

herc
06-21-2002, 02:34 AM
i have backface culling enabled by default, because without one gets artifacts with transparent objects.
with lighting - i have switched everything on and off - no change at all. and lighting without cubemapping is ok with single and double sided lighting. besides - i checked again simple cube-tiles with cubemapping - there is the bug too, not as mentioned earlier from me. and for the simple cube there is not much to make wrong with normals ;-)

i think itīs simply a bug in software implementation (i assume software because of only 7 fps on athlon 500) of cubemapping. im sure that this error does not exists on better radeon cards with t&l unit. anyway - tonight i will try to twiddle a little my "beveled - block" code.

here my lighting code:
if(options.gl_lighting)
{
//from example prog glpuzzle www.fltk.org (http://www.fltk.org)
float lmodel_ambient[] = {0.0, 0.0, 0.0, 0.0};
float lmodel_twoside[] = {GL_FALSE};
float lmodel_local[] = {GL_FALSE};

float light0_ambient[] = {0.1, 0.1, 0.1, 1.0};
float light0_diffuse[] = {1.0, 1.0, 1.0, 0.0};
float light0_position[] = {-20, 50, 100, 0}; // lit from up
float light0_specular[] = {0.0, 0.0, 0.0, 0.0};


float bevel_mat_ambient[] = {0.0, 0.0, 0.0, 1.0};
float bevel_mat_shininess[] = {40.0};
float bevel_mat_specular[] = {0.0, 0.0, 0.0, 0.0};
float bevel_mat_diffuse[] = {1.0, 0.0, 0.0, 0.0};



glLightfv(GL_LIGHT0, GL_AMBIENT, light0_ambient);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_diffuse);
glLightfv(GL_LIGHT0, GL_SPECULAR, light0_specular);
glLightfv(GL_LIGHT0, GL_POSITION, light0_position);
glEnable(GL_LIGHT0);


glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, lmodel_local);
glLightModelfv(GL_LIGHT_MODEL_TWO_SIDE, lmodel_twoside);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);



glMaterialfv(GL_FRONT, GL_AMBIENT, bevel_mat_ambient);
glMaterialfv(GL_FRONT, GL_SHININESS, bevel_mat_shininess);
glMaterialfv(GL_FRONT, GL_SPECULAR, bevel_mat_specular);
glMaterialfv(GL_FRONT, GL_DIFFUSE, bevel_mat_diffuse);

//glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
glColorMaterial(GL_FRONT, GL_DIFFUSE);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
}

dorbie
06-21-2002, 03:07 AM
What's your glShadeModel?

This being flat might be the kind of thing that shows a driver issue, again this is a bit of a stretch.

[This message has been edited by dorbie (edited 06-21-2002).]