Veach thesis - formula question

Practical and theoretical implementation discussion.
spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Veach thesis - formula question

Post by spectral » Mon Jul 16, 2012 7:18 am

That's right...

I don't remember the reason/solution, and you ? I remember I have see this in a physics course...

Anyway, maybe I'm wrong, but I have never see anybody taking account this rule... in a renderer !
Spectral
OMPF 2 global moderator

Igors
Posts: 17
Joined: Sat Jan 07, 2012 11:56 am

Re: Veach thesis - formula question

Post by Igors » Mon Jul 16, 2012 7:50 am

For solid angle defined by 4 normalized vectors (p0, p1, p2, p4 incoming from shading point) I've used

light_dir = (Func(p1, p0) + Func(p2, p1) + Func(p3, p2) + Func(p0, p3)) / 2;

where Func returns cross(vec0, vec1) * acos(vec0, vec1);

It's important to have direction (not scalar only), otherwise specular highlights are very juggy. It was several years ago and now I don't remember where I've found it ;-)

ingenious
Posts: 282
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

Re: Veach thesis - formula question

Post by ingenious » Mon Jul 16, 2012 8:19 am

What are you guys talking about? :? The formula is perfectly correct, as it applies to infinitesimally small (i.e. differential) solid angles. If you estimate your lighting integral with a finite number of samples, it'll always be an approximation, and not because of the G term. The G term does indeed introduce a singularity, but it is not an approximation - it is a result of converting the integration measure from solid angle to surface area.
Image Click here. You'll thank me later.

graphicsMan
Posts: 166
Joined: Mon Nov 28, 2011 7:28 pm

Re: Veach thesis - formula question

Post by graphicsMan » Mon Jul 16, 2012 12:57 pm

Wow, I was starting to wonder if physics had changed. I don't even understand what the light_dir direction is supposed to represent?

spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Veach thesis - formula question

Post by spectral » Mon Jul 16, 2012 1:13 pm

I don't understand too :-P

I don't remember where I have see this... but I have already see a document (about physics and not about rendering) that explain that G is an approximation when using very small distance... but I'm not sure it is applicable and related to mathematic. Maybe it is related to some specific light effects in some specific conditions. Will try to find where I have see this in the past.
Spectral
OMPF 2 global moderator

Igors
Posts: 17
Joined: Sat Jan 07, 2012 11:56 am

Re: Veach thesis - formula question

Post by Igors » Mon Jul 16, 2012 2:05 pm

ingenious wrote:What are you guys talking about? :? The formula is perfectly correct, as it applies to infinitesimally small (i.e. differential) solid angles.
But count of rays is very finite. For example an area light is a simple rectangle that should be sampled with 100 rays only. In this case the simplified formula would produce dark artifacts nearby the light.

spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Veach thesis - formula question

Post by spectral » Mon Jul 16, 2012 2:16 pm

Maybe because you divide by 0 !?
Spectral
OMPF 2 global moderator

ingenious
Posts: 282
Joined: Mon Nov 28, 2011 11:11 pm
Location: London, UK
Contact:

Re: Veach thesis - formula question

Post by ingenious » Mon Jul 16, 2012 2:23 pm

If you estimate direct illumination from an area light source via area sampling, what you will get nearby the light is high variance. This will be due to the singularity in the G term, and not because G is some sort of approximation! And this high variance will result in bright speckles, not darkening. Indeed, area integration is not a good strategy for close distances, hence combining it with solid angle integration with multiple importance sampling can result in a much better estimate. See Veach's MIS paper or dissertation. There is nothing more to this in the context of MC integration.

Now, if you want to actually estimate the solid angle that an object spans for fitering or other purposes, a one-sample approximation becomes arbitrarily wrong the closer the object is to the point of interest. And again, you can (Monte Carlo) integrate over the hemisphere to compute a better approximation of this solid angle. Enough with the hand-waving please :ugeek:
Image Click here. You'll thank me later.

spectral
Posts: 382
Joined: Wed Nov 30, 2011 2:27 pm
Contact:

Re: Veach thesis - formula question

Post by spectral » Tue Jul 17, 2012 11:43 am

Hi,

I'm still working on my "light tracing" kernel but since a week I got the following strange effect (see first image). I can't get rid of this problem !

I use the same code for my path tracer and my light tracer... path tracing seems good (using the same theory). The main difference is :

Path tracer
1) sample one vertex on the light
2) sample a camera-ray and trace => gives a camera-vertex

3) connect the camera-vertex with the light-vertex

4) continue the camera-vertex
5) Re-sample one vertex on the light
6) Go to step (3) (connection)
...

Light tracer
1) sample one vertex on the light
2) sample a camera-ray and trace => gives a camera-vertex

3) connect the camera-vertex with the light-vertex

4) continue the light-vertex
5) Re-sample a camera-ray and trace => gives a camera-vertex
6) Go to step (3) (connection)

Notice that:
1) I have (in theses images) path of length = 3 (4 vertices max)
2) I have no camera-vertex on the image plane
3) I have try with uniform sampling (for the diffuse shader), this way I don't introduce any "cos"... just constants. I have the same effect. So, it seems to me that I have a problem with my PDF or solid angle somewhere !!

So, if someone has an idea to debug this problem ?
test_lt.png
test_lt.png (157.85 KiB) Viewed 5111 times
test_pt.png
test_pt.png (144.17 KiB) Viewed 5111 times
Spectral
OMPF 2 global moderator

apaffy
Posts: 46
Joined: Thu Dec 01, 2011 11:00 pm
Location: UK
Contact:

Re: Veach thesis - formula question

Post by apaffy » Tue Jul 17, 2012 1:05 pm

Your light tracing algorithm looks a bit odd, I'd expect the dual of your path tracing algorithm. Making some minor changes to connect the eye and light vertices before the light subpath is extended (to make light sources directly visible), I'd expect something like this:

Light tracer:
1) sample one vertex on the camera (for pinhole camera this will always be the pinhole itself)
2) sample one vertex on the light

3) connect the camera-vertex with the light-vertex

4) continue the light-vertex (sample emission function if on light source, sample BSDF otherwise)
5) Go to step (3) (connection)

Post Reply