Tag Info

New answers tagged

1

I believe it's because you're using the Bresenham line drawing, which swaps the start/end points sometimes. See the calls to Swap(). I'd suggest instead using linear interpolation for line drawing, which would look something like this (untested): double lerp(double begin, double end, double t) { return begin + (end-begin) * t; } private ...


4

Your main issue is that you need to fix your normals. If you want to calculate smooth normals correctly please check my answers here and here. Also make sure that your normals are normalized. Your second issue is your attenuation values, I often get better results with one attenuation type. So try to use one type of attenuation and try to modify its value ...


2

That simple lighting does not know anything about other objects in scene, nor shadows they cast. It just does the lighting knowing the light position and surface normal (and eye position for specular). That's it. No occlusion info, no light refraction, no reflection, no anything, just lighting. If you need object shadows, there are separate techniques for ...


1

I'm not sure, but you probably should move code that sets color of light to update frame. As I understand you initialize light color only once at start of program, but it needs to be updated each frame, in accordance with this question.


2

The normals facing away from the camera are shaded black in your setup. Add more lights into the scene that are shining on parts you want lit up, or set up the lighting with a brighter minimum brightness.


1

This should be a comment but I cant make them :(. Anyhow it looks like a normals problem with your model. If you look at the bottom flower in the first picture the lighting is wrong and it looks like the light is coming from behind and above the flower instead of in front it. Try to set the color of each pixel to the value of normal to see if the normals ...



Top 50 recent answers are included