I decided to put this in B3D Programmming because it's very 3D and probably makes more sense here than in General.
I'm trying to work out a method of raycasting a hemisphere which has to be aligned to the normal of a surface. EG: if the surface normal is -1,0,0 then the hemisphere would extend to 0,1,0 and 0,-1,0 in a complete 360 arc on the x axis but only 180 degrees on the z axis. Ah heck, a picture's worth 1000 words, so here's a pic.

The red arrows point *at* the vertex, in the *direction* of the normal.
I want to cast rays out, only through that hemisphere and with a configurable, even distribution. In other words, I want to be able to specify the density of the raycasts so that I can do lots or few, depending on how accurate I want to be.
I'm just struggling with the maths to get the vector to cast, because it has to be relative to an arbitrary normal and then evenly within that hemisphere.
My gut tells me I should be using some kind of points on a sphere algorithm and then discaring half of the points by comparing to the surface normal somehow, but I'm not 100% sure if that's right or how go to about it.
I'm trying to work out a method of raycasting a hemisphere which has to be aligned to the normal of a surface. EG: if the surface normal is -1,0,0 then the hemisphere would extend to 0,1,0 and 0,-1,0 in a complete 360 arc on the x axis but only 180 degrees on the z axis. Ah heck, a picture's worth 1000 words, so here's a pic.

The red arrows point *at* the vertex, in the *direction* of the normal.
I want to cast rays out, only through that hemisphere and with a configurable, even distribution. In other words, I want to be able to specify the density of the raycasts so that I can do lots or few, depending on how accurate I want to be.
I'm just struggling with the maths to get the vector to cast, because it has to be relative to an arbitrary normal and then evenly within that hemisphere.
My gut tells me I should be using some kind of points on a sphere algorithm and then discaring half of the points by comparing to the surface normal somehow, but I'm not 100% sure if that's right or how go to about it.