ssloy / tinyrenderer

A brief computer graphics / rendering course
https://github.com/ssloy/tinyrenderer/wiki
Other
20.38k stars 1.97k forks source link

Why I am getting a woman version head? #95

Closed qhanson closed 2 years ago

qhanson commented 2 years ago

As shown in this image, I finished wiki 4 using barycentric rather than line sweeping. Then I suddenly find that the output is different from the tutorial. output

qhanson commented 2 years ago

wow, I find it is related to the initialization of the zbuffer. for(int i = 0; i <width*height; ++i ) zbuffer[i] = -std::numeric_limits<float>::max(); vs for(int i = 0; i <width*height; ++i ) zbuffer[i] = std::numeric_limits<float>::min(); this version gives your the woman version...