Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


intyuh

Member Since 20 Jan 2011
Offline Last Active Jul 31 2015 01:26 AM

Posts I've Made

In Topic: Cosine weighted mapping explanations

17 April 2015 - 04:12 AM

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 ^^'


In Topic: Bump Mapping

13 March 2012 - 10:09 AM

Hi,

If texture sampling is set to repeat, for instance, sampling (x, y) and (x + 1, y) will return the exact same value, whatever x and y. If texture sampling is set to clamp, you'll always get the border values, etc.
When re-constructing the normals, you need to sample a pixel's direct adjacent pixels. And the pixels' coordinates are separated by 1/texture(Width/Height)
I don't know if I'm being clear, but I don't really know how to explain it better in english and without drawing stuff :)

When you consider the pixel at varTexture0, when you add 1/512, if your texture is 512, then you will sample the neighbour pixel. Try to draw a sample 16x16 pixel texture on a piece of paper, with the upper left pixel being (0, 0) and the bottom right (1, 1), then see what happens when you increase a texture coordinate by 1/16 as opposed to increasing by 1.

Regards.

In Topic: Bump Mapping

09 March 2012 - 02:46 PM

Hi,

when sampling your bump texture, you might want to add/substract "1.0 / textureWidth" and "1.0 / textureHeight", instead of just "1.0" :)
(texture coordinates go from 0 to 1, so when you add 1 to your current coordinate, you'll sample a pixel "outside" your texture)

regards.

In Topic: Level of details for particle systems

04 January 2012 - 03:03 PM

Excellent idea ! Didn't think about that one, and it's probably the simplest to implement :) I would just need to accumulate delta time so that the speed of the particles, etc. won't slow down.

In Topic: My object isn't entirely drawn

13 September 2011 - 09:42 AM

This happens if I draw a cube or a cylinder. Please help me


Ok, I replied a bit to quickly, didn't see that you already disabled backface culling ^^'
If you post the piece of code which renders your models, I think it'll be easier for people to spot what might go wrong.

PARTNERS