Sign in to follow this  
intyuh

Cosine weighted mapping explanations

Recommended Posts

Hi,

 

I'm currently working with some algorithmes that required sampling a sphere using various mapping distributions. I'm using a Hammersley sequence to do so, which gives me 2 values in the [0, 1] range, and then I use those values to convert to a spherical coordinate, and finally convert to a cartesian coordinate. My source is this page : http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html

Now what I'm having trouble with is the mapping from the hammersley values to spherical. In the linked page, there are 2 mappings : uniform and cosinus. I perfectly understand the math behind the uniform mapping (e.g. I can find the equation to go from hammersley to cartesian on a piece of paper) but I'm totally lost when I look at the cosine weighted mapping.

I can't understand the signification of the square root, and where does it come from. And I can't find any explanation on the web has to how to obtain this equation. I kind of understand the principle of the cosine weighted mapping, but I can't take a piece of paper and write the equations to go from hammersley to the final cartesian coordinate using this mapping.

 

Is there anyone here that knows where does this square root comes from and cares explaning it to me ?

 

Thanks in advance for any help !

Share this post


Link to post
Share on other sites

Ok, first post in many years, and I managed to finally find the answer minutes after asking the question (I've been trying to find it for 1 whole day before that) and it's so simple I'm a bit ashamed ^^'

Anyway, if anyone stumble onto this post with the same question, here is a quick explanation.

    ^
    |     
1-u |------/
    |     /
    |    /
    |   / H
    |o /
    | /
    |/___________>

Forgive my poor ascii art, but it's easier to understand this way ^^'
Here, o is the theta angle. Since we're sampling on a unit sphere, H is always of length 1. This leads to cos(o) = 1-u for the uniform mapping, all good.

Now for the cosine weighted one, H is no longer of length 1 (that's what I had wrong) : its length is what's weighted by the cosine ! So in fact : |H| = cos(o)
And now, we have the following : cos(o) = (1-u) / |H| = (1-u) / cos(o)
And this leads to cos(o) = sqrt(1-u)

One day to come up with that ... I feel a bit dumb, but still glad to finally understand this completely ^^'

Edited by intyuh

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this