Random points on unit sphere in OSL

Did some tests to create a shader/function to pick points that are uniformly distributed over the surface of a unit sphere. There are quite a few methods to achieve this and a lot of research had been done in the previous century do achieve such a distribution without the need for goniometric functions like sinus etc. because calculating those functions was expensive.

So I implemented a few alternatives and the bottom line for now seems to be: don’t bother, go for the straight forward approach, at least not when using a CPU (instead of a GPU). Sinus and cosinus are fast enough on modern hardware to obviate the need to implement difficult algorithms.

Your mileage may vary of course, more details in this article (including source code).

cheers,

– Michel.