POV-Ray : Newsgroups : povray.beta-test : Radiosity Status: Giving Up... : Re: Radiosity Status: Giving Up... Server Time
28 Jul 2024 20:25:04 EDT (-0400)
  Re: Radiosity Status: Giving Up...  
From: clipka
Date: 29 Dec 2008 17:30:01
Message: <web.49594f41cd9d1e75ab169ede0@news.povray.org>
Severi Salminen <sev### [at] NOTTHISsaunalahtifiinvalid> wrote:
> 1. Choose a random point on a disc. (You can do this quickly by first
> choosing a random point on square and then check if it is inside a circle).
> 2. Project it on a hemisphere.
>
> Voila! There you have a cosine weighted random point on a hemishpere. No
> need to do the cosine weighting anymore.

.... aside from the fact that what you describe *is* cosine weighting (unless
your approach would be wrong, that is) :)

Thinking about it (didn't check the math behind it yet), it's not all that bad:

- take two random numbers [-1..1] (well, ]-1..1] should do as well)
- compare sum of squares against 1.0
- repeat if necessary

doesn't sound too bad (however, performance should be compared with taking two
random numbers and transforming them to circle distribution using trigonometry
instead of the monte-carlo approach).

Projecting onto a sphere (I guess you're talking about a parallel projection
along the surface normal) just needs to take the sum of squares we already
have, subtract it from 1, and take the square root as additional co-ordinate.

So yes, that should do: A loop typically taking less than two iterations (the
most expensive part probably being the RNG) and a square root. Quite
inexpensive after all.

So it's definitely less expensive than going via a uniform distribution on a
sphere in any case. Don't know whether that can be achieved without
trigonometry, and at least it will involve a root somewhere as well - plus the
math to get either a cosine weighting or a cosine weighted distribution.


Thanks, this helped me a lot - mostly because it also provides a good basis of
how to properly do adaptive supersampling in a cosine-weighted world.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.