## Phong Illumination and Specular highlights problem...

### Phong Illumination and Specular highlights problem...

[snip]

Quote:>  I've tried inverting normals, going through my calculations etc.  I have
>no idea what's going on.  I was hoping that maybe someone else had seen a
>problem like this before (black highlights etc).  I've rewritten the
>routines several times... and I keep coming back to black highlights, and
>fully lit surfaces when ambient and diffuse equal 0.0, specular is set to
>0.8, the light is a grey light- intensity on r,g & b of 0.8, n set to
>8.0, etc.  No luck.  Anyone seen anything like this?

It sounds like something is overflowing.  Are all of your vectors
normalized?
if R.V > 1.0, then you will get larger highlights for larger exponents.
Also, if your conversion to an integer colorspace overflows, you could get
those black anomalies.

- Mike

### Phong Illumination and Specular highlights problem...

>[snip]
>>  I've tried inverting normals, going through my calculations etc.  I have
>>no idea what's going on.  I was hoping that maybe someone else had seen a
>>problem like this before (black highlights etc).  I've rewritten the
>>routines several times... and I keep coming back to black highlights, and
>>fully lit surfaces when ambient and diffuse equal 0.0, specular is set to
>>0.8, the light is a grey light- intensity on r,g & b of 0.8, n set to
>>8.0, etc.  No luck.  Anyone seen anything like this?

>It sounds like something is overflowing.  Are all of your vectors
>normalized?

Yes.  V, L, R, and N are all normalized.  I've check my normalization
code- it's correct.

Quote:>if R.V > 1.0, then you will get larger highlights for larger exponents.

The wierd thing is my R.V is less than zero, around -0.995448 (it move
around of course for the different pixels, but it's always around -0.99)

Inverting R.V doesn't do anything either....  the highlight is still
black, and the surface remains lit even with ambient and diffuse light set
to 0.0....

If I set n to an odd number then everything goes black (because the
negative R.V creates a color below 0.0), on an even the face is lit with
the black highlight....

Quote:>Also, if your conversion to an integer colorspace overflows, you could get
>those black anomalies.

Hmmm, I already have code to cap intensities over 1.0 of intensity so
that the highest value is always 1.0 (same if the intensity is below 0.0,
cap it at 0.0).  Neither of these cases are occuring....

-Daniel-

--

"Evil comes in many forms, be it a man-eating cow or Joseph Stalin."
-THE TICK

### Phong Illumination and Specular highlights problem...

G'Day,

I'm implementing the phong illumination model for a bump mapped
triangle.  However I've run into a few problems with getting the specular
highlight to appear.

The basic setup is a simple triangle, when doing a scan line fill I
apply the bump mapping routine to perturb the normals of each point/pixel,
and then apply the phong illumination model,  I feed it my current x,y
coord's so I can calculate the View and Lighting vectors (yes I know this
will result in skewed lighting and highlights- that's okay for what I'm
doing).  However what I get is a fully lit surface, with a black
highlight.  Ambient and Diffuse are set to zero, yet the entire surface is
lit.  Not only that but the n value used for the ks*(R.V)^n [. = dot
product, ^n = power of n] portion of the phong model, gives really strange
results. The higher n the larger the highlight, the lower the smaller- the
exact opposite of what I expect to see.

I've tried inverting normals, going through my calculations etc.  I have
no idea what's going on.  I was hoping that maybe someone else had seen a
problem like this before (black highlights etc).  I've rewritten the
routines several times... and I keep coming back to black highlights, and
fully lit surfaces when ambient and diffuse equal 0.0, specular is set to
0.8, the light is a grey light- intensity on r,g & b of 0.8, n set to
8.0, etc.  No luck.  Anyone seen anything like this?

-Daniel-

--

"Evil comes in many forms, be it a man-eating cow or Joseph Stalin."
-THE TICK

### Phong Illumination and Specular highlights problem...

I bet this isn't your problem, but just in case...

Are you somewhere treating 256 as "brightest" and so getting wrap around to
0? Try 255.