Noise with multi-threaded raytracer

Posted by herber88 on Stack Overflow See other posts from Stack Overflow or by herber88
Published on 2010-05-27T00:47:30Z Indexed on 2010/05/27 0:51 UTC
Read the original article Hit count: 203

This is my first multi-threaded implementation, so it's probably a beginners mistake. The threads handle the rendering of every second row of pixels (so all rendering is handled within each thread). The problem persists if the threads render the upper and lower parts of the screen respectively.

Both threads read from the same variables, can this cause any problems? From what I've understood only writing can cause concurrency problems...

Can calling the same functions cause any concurrency problems? And again, from what I've understood this shouldn't be a problem...

The only time both threads write to the same variable is when saving the calculated pixel color. This is stored in an array, but they never write to the same indices in that array. Can this cause a problem?

Multi-threaded rendered image (Spam prevention stops me from posting images directly..)

Ps. I use the exactly same implementation in both cases, the ONLY difference is a single vs. two threads created for the rendering.

© Stack Overflow or respective owner

Related posts about c++

Related posts about multithreading