# How to use Bidirectional path tracing on sky dome for rendering indoor

Is it possible to use bidirectional path tracing to render an indoor scene where the light source is skylight(no sun) coming through a window? I think I roughly know how this is done if the light source was the window rectangle itself acting as a diffuse source but cannot get my head around on how it would work if the source is skylight and the camera is in a room: Is it the window shape that needs to be sampled or the sky dome? Would the light sample point be picked from the whole sky dome, or just a visible bit from the window?

Thanks.

There are several strategies.

• You could sample the hemisphere (according to the local material's brdf) liek any other bounce, and pray that the light escapes to the sky (if the ray extends to infinity, sample the skybox in that direction)
• You could sample the entire skydome, using its luminance as a probability distribution function
• You can (as you stated) sample the only parts of the geometry that allows a ray to escape, should you know that there are some (could be windows if you know your are indoors, but if you don't, you'll have a hard time selecting where to send your rays)

All three methods have their uses. If you know you have windows (and you know them all) then sampling the window shape and extending the ray to the skydome should be quite efficient.

If you're not always indoors or don't know what is or isn't a window, then the other two methods are much more general. Since the sky provides quite directional light, it would make sense to sample according to skydome luminance.

I'm a fan of hybrid methods, so I'd let the brdf decide: If it is very narrow/specific (like specular of glossy) then sample according to brdf. If brdf is broad (diffuse) then use window sampling if indoor, or skydome luminosity sampling when outdoors.

• I have implemented the third method but thanks. It's a correct answer.
– ali
Jun 29, 2017 at 15:59