Occlusion as parameter of indicectdiffuse()

Help
2004-10-12
2013-04-25
  • Aron Gombas
    Aron Gombas
    2004-10-12

    Hi!

    It seems that while...

    surface occ1 ()
    {
        N = normalize(N);
        I = normalize(I);
        normal Nf = faceforward(N, I);

        float ambientOcclusion = occlusion(P, Nf, 32);

        Ci = Cs*(1.0 - ambientOcclusion)*Os;
        Oi = Os; 
    }

    ...returns the correct value, "indirectdiffuse()" always returns zero for ambientOcclusion:

    surface occ2 ()
    {
        N = normalize(N);
        I = normalize(I);
        normal Nf = faceforward(N, I);

        float ambientOcclusion;
        color dummy = indirectdiffuse(P, Nf, 32, "occlusion", ambientOcclusion);
    printf("occ: %f\n", ambientOcclusion);

        Ci = Cs*(1.0 - ambientOcclusion)*Os;
        Oi = Os; 
    }

    Q1: I guess these should be equivalent?!
    Q2: I never get any dark spots to the plane, why?

    I created a tiny RIB-file to play with this:
    www.demoscene.hu/~aron/occ.zip

    Aron