Lighting problem back

(L) [2006/03/09] [Pon] [Lighting problem] Wayback!

Hi all. I'm having a problem implementing lighting.  [SMILEY Embarassed] Can anyone tell me what is wrong? Everything is either black or fully lit, which shouldn't be the case.
(L) [2006/03/09] [Phantom] [Lighting problem] Wayback!

Well 'mul = Math.Max(0,mul)' will guarantee that mul does not exceed 0, right? Is that what you want?
_________________
--------------------------------------------------------------

Whatever
(L) [2006/03/09] [Pon] [Lighting problem] Wayback!

No, won't it ensure that mul won't go below 0?
(L) [2006/03/09] [tbp] [Lighting problem] Wayback!

Nope, that's equivalent to mul = abs(mul).


edit: Too late [SMILEY Smile]

Anyway, there's not many places where it could go wrong (and that's not within the posted code as far as i can grok C# that is).
(L) [2006/03/09] [Pon] [Lighting problem] Wayback!

Hmm... I shalt try manually checking for >0 values.


*Phone operator voice*


Please hold.



Your call is important to us...
(L) [2006/03/09] [Pon] [Lighting problem] Wayback!

OK, that didn't change a thing.


[IMG #1 ]


That is what it looks like if I don't normalise the light direction vector. If I DO normalise it, there are simply two pixels in the centre of the image, and nothing else.
[IMG #1]:Not scraped: https://web.archive.org/web/20061004031038im_/http://img130.imageshack.us/img130/9206/boris2jc.png
(L) [2006/03/09] [tbp] [Lighting problem] Wayback!

Then you have answered your own question.


Frankly, you can't expect us to debug 10 lines in an alien language for you; there's only basic vector ops in there, check them all.
(L) [2006/03/09] [craouette] [Lighting problem] Wayback!

I don't understand what you are doing:
(L) [2006/03/09] [craouette] [Lighting problem] Wayback!

oups, my fault...

except the fixe light, the problem may be latter on, when coverting from float to rgb for display ?
(L) [2006/03/10] [Pon] [Lighting problem] Wayback!

Ah, you were right craouette, I had been incorrectly casting my values while clamping to screen values.


Diffuse lighting now works perfectly [SMILEY Very Happy] (For infinite-intensity point-light sources anyway  [SMILEY Wink] )

back