Smooth Shading with bidirectional path tracing?

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Smooth Shading with bidirectional path tracing?
Hi folks,
I am having trouble producing smooth shading with bidirectional path tracing(BDPT).
I am using per vertex normal, and smooth shading can be achieved with path tracing or direct lighting. However, BDPT always results in faceted looking results such as the one below.
Notice that even the caustics, which is most sampled with light tracing, are faceted.
I spent some time debugging and found that this faceted look was the result of the sampling technique that connects light samples directly to the camera.
I really don't know how to fix this, since these samples are sampled from light source, and they depend only on the geometry, not normal.
The following is a pure light tracing image. All samples are traced from the light source and then projected to camera. All meshes in the above image uses pervertex normal.
But it confuses me that mitsuba seems to be free from this artifact.
Any clue?
I am having trouble producing smooth shading with bidirectional path tracing(BDPT).
I am using per vertex normal, and smooth shading can be achieved with path tracing or direct lighting. However, BDPT always results in faceted looking results such as the one below.
Notice that even the caustics, which is most sampled with light tracing, are faceted.
I spent some time debugging and found that this faceted look was the result of the sampling technique that connects light samples directly to the camera.
I really don't know how to fix this, since these samples are sampled from light source, and they depend only on the geometry, not normal.
The following is a pure light tracing image. All samples are traced from the light source and then projected to camera. All meshes in the above image uses pervertex normal.
But it confuses me that mitsuba seems to be free from this artifact.
Any clue?
Re: Smooth Shading with bidirectional path tracing?
Veach's thesis discusses issues with bidirectional methods and smoothed normals, have you seen that...?

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Smooth Shading with bidirectional path tracing?
Actually I haven't. Would you mind telling me which chapter in which he talks about that?beason wrote:Veach's thesis discusses issues with bidirectional methods and smoothed normals, have you seen that...?

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Smooth Shading with bidirectional path tracing?
I found it. It's in section 5.3.
I haven't read the details, if anybody knows what's happening please explain it here too so that we can all learn.
I will read it first.
What a great thesis, always can learn new things from it. No wonder he won the Oscar...
I haven't read the details, if anybody knows what's happening please explain it here too so that we can all learn.
I will read it first.
What a great thesis, always can learn new things from it. No wonder he won the Oscar...
Re: Smooth Shading with bidirectional path tracing?
The problem is presented in section 3.7.5: normal interpolation makes your BSDF no symmetrical and you have to use adjoint BSDF to solve the problem as explained in section 5.3. All the chapter 5 is dedicated to the cause and the solution of this problem.shiqiu1105 wrote:I found it. It's in section 5.3.
I haven't read the details, if anybody knows what's happening please explain it here too so that we can all learn.
I will read it first.
What a great thesis, always can learn new things from it. No wonder he won the Oscar...

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Smooth Shading with bidirectional path tracing?
I read the section and whipped up a quick fix in my BDPT implementation where light vertices are connected explicitly to the sensor. And this fixed the faceted looks. However I am more confused about the problem in general. I tried to use this adjoint BSDF for all light path (not only when connecting to the sensor, but also when connecting with camera path), but obvious error would occur.Dade wrote:The problem is presented in section 3.7.5: normal interpolation makes your BSDF no symmetrical and you have to use adjoint BSDF to solve the problem as explained in section 5.3. All the chapter 5 is dedicated to the cause and the solution of this problem.shiqiu1105 wrote:I found it. It's in section 5.3.
I haven't read the details, if anybody knows what's happening please explain it here too so that we can all learn.
I will read it first.
What a great thesis, always can learn new things from it. No wonder he won the Oscar...
And I don't see pbrt mentioning this in its implementation of MLT or photon mapping. I did see Mitsuba implemented this, in the PathVertex::sampleNext() function, however its implementation it's quite tricky to follow and I failed to match it with Veach's thesis.
I think this shading normal problem really makes the light transport framework more messed up. If only there is a good illustration on how to do it correctly.

 Posts: 138
 Joined: Sun May 27, 2012 4:42 pm
Re: Smooth Shading with bidirectional path tracing?
Additionally, Veach says when tracing importance from the light source, local bsdf sampling should happen based on the cosine term of the geometry normal.
I took a quick glance at the mitsuba source code, and it looks to me that it's always sampling based on shading normal too.
I took a quick glance at the mitsuba source code, and it looks to me that it's always sampling based on shading normal too.

 Posts: 75
 Joined: Sun Aug 19, 2012 3:24 pm
 Contact:
Re: Smooth Shading with bidirectional path tracing?
Hi.
I have implemented the correction of nonsymmetrical BSDF problem due to shading normal.
First, sampling a direction not according to a geometry normal when we focus on adjoint BSDF is not problem for convergence.
(as long as we can sample all directions wherever a BSDF value is not zero)
You have to consider a correction factor for all vertices related to lightpath.
In BPT, one considers a case where a path is constructed by more lightpath sampling.
So, in case you determine Russian roulette probability by using MC throughput (fs * cos / pdf), you have to take adjoint correction into consideration.
As you think, this makes the algorithm messy, but I think it is inevitable because shading normal doesn't have a physical basis.
Furthermore, adjoint correction factor (dot(wo, Ns) * dot(wi, Ng)) / (dot(wo, Ng) * dot(wi, Ns)) has singularity, so you need to also take care of this.
What you have to pay attention to is the order of the numerator and denominator of the factor.
* When you implement the BPT algorithm based on PBRT, you should disable texture filtering used by a ray traced from a camera, because it makes BSDF nonsymmetric.
I have implemented the correction of nonsymmetrical BSDF problem due to shading normal.
First, sampling a direction not according to a geometry normal when we focus on adjoint BSDF is not problem for convergence.
(as long as we can sample all directions wherever a BSDF value is not zero)
You have to consider a correction factor for all vertices related to lightpath.
In BPT, one considers a case where a path is constructed by more lightpath sampling.
So, in case you determine Russian roulette probability by using MC throughput (fs * cos / pdf), you have to take adjoint correction into consideration.
As you think, this makes the algorithm messy, but I think it is inevitable because shading normal doesn't have a physical basis.
Furthermore, adjoint correction factor (dot(wo, Ns) * dot(wi, Ng)) / (dot(wo, Ng) * dot(wi, Ns)) has singularity, so you need to also take care of this.
What you have to pay attention to is the order of the numerator and denominator of the factor.
* When you implement the BPT algorithm based on PBRT, you should disable texture filtering used by a ray traced from a camera, because it makes BSDF nonsymmetric.