Wednesday, February 13, 2013

Killing bugs!


I've been having small pixel errors in the shader while converting colors, and this piece of code fixed it finally, took me a few weeks to find this bug, still not quite sure why my values went over the limits but the commented code didn't do it before.

h += 360 * (-floor(h / 360.0));    // convert to absolute 0 to 360 degrees
//if( h < 0 ) {
//    h += 360;
//}
//if (h > 360) {
//    h -= 360;   
//}


pretty happy that I was able to find the issue and fix it in 10 minutes while testing the shader editor, I didn't see that bug until I used the real time capabilities to get instant feedback, trying to do the same in Visual Studio and XNA directly in HLSL is very complicated since I am not an expert in shaders yet and takes forever to see something on-screen.

No comments:

Post a Comment