black holes


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:

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


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

Those links aren´t working.

this is weird… when you click on them, they don’t work, but after hitting enter in the browser’s url field, they do.

No they don’t, no matter how many times you hit enter in the address bar.

You have to copy and paste the url into a broswer. It seems to be a ‘feature’ of geocites websites perhaps to save bandwidth?

It does looks like a bug. Maybe a clamp or sign inversion ?

The third shot has some hefty texture aliasing. How, if at all, do you filter your bumpmaps?

texture filtering:




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?


and this is the fragment program:


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;


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

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 .

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?


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.

thx 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…

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.

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.


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

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

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).]