Numpty specular question

Well, I say numpy, but maybe I am being too hard on myself. I’m interested after finding what I think is a bug in someone’s shader to find out if it is or not!

In phong lighting model, what is the expected result if low shininess, high ish Ks and looking from the back side of the object so the light source is occluded?

There was some fishy looking stuff (to me at least) which was blatting out the specular by an occlusion term derived from the phong diffuse term. This created hard edges with low specular glossiness values as for some reason the highlight overlapped the cutoff. I have a suspicion there may be some more bugs in the eye vector maths, so maybe this was a bug obfuscating a different bug, but I mainly wanted to see what people’s expectations would be.

If I multiply the specular term by the diffuse term it does remove any specular in the form shadow of the object, which somehow feels right, but I have not seen this in the math before, admittedly not having had much to do with shadows in the past.

Anyway, a loose ball out there to see if anyone wants to correct me or discuss.

Sounds broke! But it’s hard to tell without seeing :slight_smile:

There are some great slides by Naty Hoffman on shading models here which might help.

In particular, does the problem you have look anything like slide 13 of this presentation?

Hope that helps :slight_smile:

Excellent slides, thanks Stefan! This should clear everything up perfectly. Yes the fishy bit of code was this conditional part, removing specular in the unlit side with a boolean value which made some bad artifacts apparent.

Filing under very useful, that pdf. :smiley: