PDA

View Full Version : black holes



JanHH
02-26-2004, 09:25 AM
Hello,

I added bump mapping to my terrain engine and it works and looks fine, but there are pixels appearing that are entirely black.. like little black spots on the surface. I am sure that they are there where the terrain is in fact darkest (due to the bump mapping), but I think it is a little abrupt, and looks bad when moving around, even more with aniso filtering. Do you understand what I mean? You can see the effect on these screenshots:
http://de.geocities.com/westphj2003/black1.jpg http://de.geocities.com/westphj2003/black2.jpg http://de.geocities.com/westphj2003/black3.jpg

Another person working on this project says that he thinks this could even be a bug.. does anyone of you have an idea?

Jan

[This message has been edited by JanHH (edited 02-26-2004).]

Jan
02-26-2004, 09:40 AM
Those links aren´t working.

JanHH
02-26-2004, 09:41 AM
this is weird.. when you click on them, they don't work, but after hitting enter in the browser's url field, they do.

KuriousOrange
02-26-2004, 11:37 PM
No they don't, no matter how many times you hit enter in the address bar.

Adrian
02-26-2004, 11:44 PM
You have to copy and paste the url into a broswer. It seems to be a 'feature' of geocites websites perhaps to save bandwidth?

ZbuffeR
02-27-2004, 12:40 AM
It does looks like a bug. Maybe a clamp or sign inversion ?

zeckensack
02-27-2004, 01:00 AM
The third shot has some hefty texture aliasing. How, if at all, do you filter your bumpmaps?

JanHH
02-27-2004, 02:46 AM
texture filtering:

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0);

glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);

Maybe the normal maps are to bumpy? So at least you agree with me that there seems to be something wrong and this is not how it should be?

Jan

JanHH
02-27-2004, 06:26 AM
and this is the fragment program:

!!FP1.0

TEX H0, f[TEX0], TEX0, 2D; # texel from colormap

TEX H1, f[TEX5], TEX5, 2D; # texe from normal map
MAD H1, H1, 2.0, -1.0;

TEX H2, f[TEX2], TEX4, CUBE; # texel from normalization cube map for diffuse
MAD H2, H2, 2.0, -1.0;

DP3 H3, H1, H2;
MUL H4, H3, H0;

TEX H5, f[TEX3], TEX4, CUBE; # texel from normalization cube map für specular
MAD H5, H5, 2.0, -1.0;
DP3 H5, H1, H5;
POW H5, H5.x, f[TEX7].x; # f[TEX7]: specular exponent

TEX H6, f[TEX5], TEX7, 2D; # TEX7: spec map
MAD H5, H6, H5, H4;

MAD H5, H0, p[0], H5; # p0: ambient light

MOV o[COLH], H5;

END

I think this is quite ordinary.. if you see anything strange about it, please let me know

JanHH
02-27-2004, 08:11 PM
I guess the problem comes from the specular highlights. I found out that when changing the vertex program so that the specular highlights get entirely wrong, the whole scene gets totally dark. this seems strange to me as I always thought of the specular part simply ti be ADDED to the diffuse lighting, so that it could under no circumstances make anything DARKER, only brighter. But this seems to be the case here.

And this can only be if the dot product between the normalized half vector and the normal vector coming from the normal map has a negative result. It's too late to be good in math but I think in general, this is possible, isn't it?

I think the specular highlights are wrong anyway as they get brightest when looking perpendicular down to the ground, no matter where the light comes from http://www.opengl.org/discussion_boards/ubb/wink.gif.

So I guess a combination between the effect of having a negative result of the dot3 operation together with broken specular highlights are the reason for the black pixels.

Do you think that this sounds reasonable?

Jan

Descenterace
02-28-2004, 12:49 PM
Sounds about right. I had a fault in one of my more complex DX9 shaders (which had more bells and whistles than the average Microsoft release) which I eventually traced to an out-of-bounds result.

Try clamping the Specular component to [0,1]. If it's negative, it's cast on a backfacing and should be 0. Actually, you should clamp the dot product itself to [0,1] because Diffuse values are subject to the same problem.

JanHH
02-28-2004, 05:56 PM
thx http://www.opengl.org/discussion_boards/ubb/smile.gif I already fixed that to a certain extent, it looks better but still isn't right.. somehow I can't get the specular highlights working the way they should be.. somehow I can't get the half vector to be computed correctly. But I am working on it..

Christian Schüler
02-29-2004, 11:10 AM
This comes as no surprise.

If you click on link, the browser sends the information from which URL you are coming.

If you enter an URL on the address bar, no such information is sent to the destination site.

JanHH
02-29-2004, 04:04 PM
no it's different (and very strange).

when I upload the pics using linux, it is like in this case, but when I upload them using windows, just clicking them works.

Jan

[This message has been edited by JanHH (edited 02-29-2004).]

[This message has been edited by JanHH (edited 02-29-2004).]

V-man
02-29-2004, 09:05 PM
You might want to make use of saturation, otherwise you get negative values ad that might give dark spots.

DP3 H3, H1, H2; should be
DP3_SAT H3, H1, H2;

DP3 H5, H1, H5; should be
DP3_SAT H5, H1, H5;

for the POW function, you may have to fix it by
doing a multiply after the POW

DP3_SAT H5, H1, H5;
SGT H10, H5, Zero;
POW H5.x, H5.x, f[TEX7].x; # f[TEX7]:
MUL H5.x, H5.x, H10;

I think that is all.

[This message has been edited by V-man (edited 02-29-2004).]

JanHH
03-01-2004, 07:58 AM
thanks