Skip to main content
added 131 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36

WithNote the images might look a whole lot different but that's cause I implemented Tonemapping + Gamma Correction in the meantime :) With MIS 700spp enter image description here

Without MIS 700spp enter image description here

With MIS enter image description here

Without MIS enter image description here

Note the images might look a whole lot different but that's cause I implemented Tonemapping + Gamma Correction in the meantime :) With MIS 700spp enter image description here

Without MIS 700spp enter image description here

added 278 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36

--Found a mistake. I was using the direct lighting equation when calculating the brdf sample. (multiplying by $\cos(\theta^{\prime})$ and dividing by $r^2$). Removed it since we initially sampled through BSDF which is integral over solid angle not area. The image got a little brighter. Still don't know if MIS is working as intendedFound a mistake. I was using the direct lighting equation when calculating the brdf sample. (multiplying by $\cos(\theta^{\prime})$ and dividing by $r^2$). Removed it since we initially sampled through BSDF which is integral over solid angle not area. The image got a little brighter. Still don't know if MIS is working as intended. See answer.

After that I come to BRDF sampling. I again sample through either Phong/Cosine based on what I did earlier during light sample calculation. If the sampled ray doesn't hit any light source or not the same one. I set the $brdf\_sample$ to zero. If it hits, I set the $light\_pdf$ to same value as before. Calculate the weights like mentioned above and calculate brdf sample using the original equation (integral over solid angle).

EDIT5:- After lightxbulb suggestions, I think the problem has resolved.

With MIS enter image description here

Without MIS enter image description here

--Found a mistake. I was using the direct lighting equation when calculating the brdf sample. (multiplying by $\cos(\theta^{\prime})$ and dividing by $r^2$). Removed it since we initially sampled through BSDF which is integral over solid angle not area. The image got a little brighter. Still don't know if MIS is working as intended.

After that I come to BRDF sampling. I again sample through either Phong/Cosine based on what I did earlier during light sample calculation. If the sampled ray doesn't hit any light source or not the same one. I set the $brdf\_sample$ to zero. If it hits, I set the $light\_pdf$ to same value as before. Calculate the weights like mentioned above and calculate brdf sample using the original equation (integral over solid angle).

--Found a mistake. I was using the direct lighting equation when calculating the brdf sample. (multiplying by $\cos(\theta^{\prime})$ and dividing by $r^2$). Removed it since we initially sampled through BSDF which is integral over solid angle not area. The image got a little brighter. Still don't know if MIS is working as intended. See answer.

After that I come to BRDF sampling. I again sample through either Phong/Cosine based on what I did earlier during light sample calculation. If the sampled ray doesn't hit any light source or not the same one. I set the $brdf\_sample$ to zero. If it hits, I set the $light\_pdf$ to same value as before. Calculate the weights like mentioned above and calculate brdf sample using the original equation (integral over solid angle).

EDIT5:- After lightxbulb suggestions, I think the problem has resolved.

With MIS enter image description here

Without MIS enter image description here

added 1328 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36

EDIT4:- Here's an overview of what I'm doing now.

First I choose a single light source out of multiple using simple heuristic scheme like the distance, intensity, area and the cosine falloff angles. I appropriately set the weights for the light like this

$light\_pdf = weight/area$

where weight is in range 0-1.

Next I trace the ray to see if light source is visible. If it is I calculate the $light\_sample$ using the direct lighting equation (integral over Area).

Then I calculate the BRDF PDF for this given ray. However I use Lafortune's algorithm for it. If a random number falls under the specular color I sample through the modfied Phong PDF else through Cosine.

The weights are computed using power heuristic, $ weight = light\_pdf^2/(light\_pdf^2+brdf\_pdf^2)$

The MIS estimator is then calculated as

$light\_sample = light\_sample * weight/light\_pdf$

After that I come to BRDF sampling. I again sample through either Phong/Cosine based on what I did earlier during light sample calculation. If the sampled ray doesn't hit any light source or not the same one. I set the $brdf\_sample$ to zero. If it hits, I set the $light\_pdf$ to same value as before. Calculate the weights like mentioned above and calculate brdf sample using the original equation (integral over solid angle).

EDIT4:- Here's an overview of what I'm doing now.

First I choose a single light source out of multiple using simple heuristic scheme like the distance, intensity, area and the cosine falloff angles. I appropriately set the weights for the light like this

$light\_pdf = weight/area$

where weight is in range 0-1.

Next I trace the ray to see if light source is visible. If it is I calculate the $light\_sample$ using the direct lighting equation (integral over Area).

Then I calculate the BRDF PDF for this given ray. However I use Lafortune's algorithm for it. If a random number falls under the specular color I sample through the modfied Phong PDF else through Cosine.

The weights are computed using power heuristic, $ weight = light\_pdf^2/(light\_pdf^2+brdf\_pdf^2)$

The MIS estimator is then calculated as

$light\_sample = light\_sample * weight/light\_pdf$

After that I come to BRDF sampling. I again sample through either Phong/Cosine based on what I did earlier during light sample calculation. If the sampled ray doesn't hit any light source or not the same one. I set the $brdf\_sample$ to zero. If it hits, I set the $light\_pdf$ to same value as before. Calculate the weights like mentioned above and calculate brdf sample using the original equation (integral over solid angle).

added 196 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
added 17 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
added 168 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
deleted 9 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
Bumped by Community user
added 9 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
deleted 9 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
added 364 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
deleted 404 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
deleted 1 character in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
added 348 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
added 69 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
added 59 characters in body
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading
Source Link
gallickgunner
  • 2.6k
  • 1
  • 14
  • 36
Loading