What are the suggested strategies for debugging a graphics program's code?

What are the suggested strategies for debugging a graphics program's code?



1. Scientific Method - Create an image using the program and observe what is wrong with it. Then form a hypothesis about the cause and test it.

2. Images as Coded Debugging Output - Use the output image. If you want to know the value of some variable for part of a computation that runs for every pixel, you can just modify your program to copy that value directly to the output image and skip the rest of the calculations that would normally be done.

3. Using a Debugger - Set a "Trap" for the bug. First make sure your program is deterministic-run it in a single thread and make sure that all random numbers are computed from fixed seeds. Then find out which pixel or triangle is exhibiting the bug and add a statement before the code you suspect is incorrect that will be executed only for the suspect case. If you set a break point on the print statement, you can drop into the debugger just before the pixel you're interested in is computed.

4. Data Visualization for Debugging - Make good plots and illustrations for yourself to understand what the data means. For instance, in a ray tracer you might write code to visualize ray trees so you can see what paths contributed to a pixel, or in an image resampling routine you might make plots that show all the points where samples are being taken from the input.

Popular posts from this blog

Is rotation necessary in PCA? If yes, Why? What will happen if you don't rotate the components?

After analyzing the model, your manager has informed that your regression model is suffering from multicollinearity. How would you check if he's true? Without losing any information, can you still build a better model?

What does Latency mean?