[Bf-cycles] build with OSL support

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Nov 11 19:43:58 CET 2011


Hi,

On Fri, Nov 11, 2011 at 5:47 PM, storm <kartochka22 at yandex.ru> wrote:
> Eval have no relation with sampling. It used for absolutely different
> events. Sampling generate primary integrator event, "What happened with
> current photon (or importance particle in the case of backtrace) package
> during another timeslice". Eval say "If you fire photon package in that
> direction, it will be attenuated by that value because of some surface
> property". In the case of ideal perfect importance sampling they MUST
> have different values. Because PDF shape control density of rays, not
> value of PDF. If thay have same values , we get brighter image in normal
> direction in the case of diffuse material.
>
> And trick with cos(theta) is the only reason that we need non uniform
> sampling at all in diffuse sampler.

We must be using different definitions here?

What I mean is, if you look at how kernel_path.h and how eval and pdf
affect the throughput, it gets multiplied with eval/pdf, which is 1
here. So there's no extra factors influencing the throughput, which
must mean either the sampling perfectly matches the BSDF already, or
there's a bug in the current code?

> __device_inline void sample_cos_hemisphere(const float3 N,
>        float randu, float randv, float3 *omega_in, float *pdf)
> {
>        // Default closure BSDF implementation: uniformly sample
>        // cosine-weighted hemisphere above the point.
>        to_unit_disk(&randu, &randv);
>        float costheta = sqrtf(max(1.0f - randu * randu - randv * randv,
> 0.0f));
>        float3 T, B;
>        make_orthonormals(N, &T, &B);
>        *omega_in = randu * T + randv * B + costheta * N;
>        *pdf = costheta *M_1_PI_F;
> }
>
> It generate UNIFORM point on hemisphere "to_unit_disk", LATER calculate
> cosinus (of uniform point ), linearly transform to respect input vector,
> and asjust pdf. That called uniform sampling by definition.

>From what I understand, to_unit_disk generates a uniform point in a
disk/circle. If you project that up onto a hemisphere, it gives cosine
weighted samples. This code is more complicated than it could be, but
as far as I can see that's what it is doing.

Brecht.


More information about the Bf-cycles mailing list