1

I am currently implementing a uniform sampling of a hemisphere.

Since my hemisphere is oriented around a specific vector N, whatever the sampling algorithm used (uniform/cosine weighted/stratified/...) I must either: 1) sample on the whole sphere and discard any sample outside my N-aligned hemisphere (rejection) or b) sample on the Y+ aligned hemisphere and bring the sampled vector to my N-aligned hemisphere by matrix multiplication.

This at least is all I have found on any resource I could find about the topic.

My question is pretty trivial: why can't I just sample on the Y+ hemisphere and flip the sampled vector if it doesn't lie inside my N-algned hemisphere?

I understand I am surely missing something obvious here because any book outlines only the two solutions above, but still, intuitively, I can't understand why flipping a sampled vector is "wrong", since it will then lie inside my hemisphere. Moreover, I obtain undistinguishable results by following either solutions or by flipping.

1 Answers1

0

You can certainly sample from the hemisphere with positive $y$ (or alternatively from the entire sphere) and invert the vector if it's not in your hemisphere.

Of course this works only because you're sampling uniformly. Since you also mention other distributions, I could imagine that the reason the texts you metnion don't do it this way is that they want a method that's more generally applicable.

joriki
  • 238,052
  • If the sampling is non-uniform then it seems to me methods 1 (rejection) and 2 (matrix multiplication) could already give different results. – David K Apr 15 '16 at 13:35
  • Thanks I wanted to be sure I was not overlooking something trivial – user815129 Apr 15 '16 at 13:56
  • @DavidK: Yes, I was just guessing in the dark. It depends on what distribution is desired. Those two could at least conceivably produce useful distributions, whereas inverting some of the vectors but not others seems unlikely to produce anything that one might want to sample from. – joriki Apr 15 '16 at 14:29