24

In order to understand Russian Roulette, let's look at a very basic backward path tracer: void RenderPixel(uint x, uint y, UniformSampler *sampler) { Ray ray = m_scene->Camera.CalculateRayFromPixel(x, y, sampler); float3 color(0.0f); float3 throughput(1.0f); // Bounce the ray around the scene for (uint bounces = 0; bounces < 10; +...


17

There are multiple areas in path tracing that can be importance sampled. In addition, each of those areas can also use Multiple Importance Sampling, first proposed in Veach and Guibas's 1995 paper. To better explain, let's look at a backwards path tracer: void RenderPixel(uint x, uint y, UniformSampler *sampler) { Ray ray = m_scene->Camera->...


13

I am posting this for anyone wondering about the confusion between the terms $\frac{1}{\pi}$ and $\frac{1}{4}$. The term $\frac{1}{\pi}$ is an error from the original Cook-Torrance reference. In fact, the whole term $\frac{1}{4(n \cdot \omega_i)}$ comes from the Jacobian of the transformation from reflected solid angle to normal solid angle. According to ...


12

According to this paper, the $\frac{1}{\pi}$ in your $f_r$ should be $\frac{1}{4}$: $$ f_r = \frac{DFG}{4(n\cdot w_i)(n \cdot w_o)}, $$ so you would end up with $$ \frac{\pi}{2}L_i(p,w_k)\left(\frac{DFG}{n\cdot w_o}\right). $$


12

The theoretical ideal antialiasing filter for discretely sampled data is a sinc filter, because it perfectly removes all frequencies higher than the Nyquist frequency, while leaving alone all the lower ones. So, to some extent, we can expect antialiasing filters that more closely resemble the sinc filter to produce better-quality images. The tent filter (...


12

This question is somewhat related to this one. As Alan has already said, following the actual light path through each layer leads to more physically accurate results. I will base my answer on a paper by Andrea Weidlich and Alexander Wilkie ("Arbitrarily Layered Micro-Facet Surfaces") that I have read and partially implemented. In the paper the authors ...


11

Without explicit light sampling, I'd expect very slow convergence. Any path that doesn't happen to hit the light source before being terminated will be useless (contributes zero). Since you have a small light source, the vast majority of paths will not hit it. It would be interesting to add some statistics to your tracer to see how many paths return zero vs ...


10

Generally speaking, path tracing removes a number of assumptions that ray tracing makes. Ray tracing usually assumes that there is no indirect lighting (or that indirect lighting can be approximated by a constant function), because handling indirect lighting would require casting many additional rays whenever you shade an intersection point. Ray tracing ...


9

The Russian roulette technique itself is a way of terminating paths without introducing systemic bias. The principle is fairly straightforward: if at a particular vertex you have a 10% chance of arbitrarily replacing the energy with 0, and if you do that an infinite number of times, you will see 10% less energy. The energy boost just compensates for that. If ...


9

There is a great paper from 2006 on this topic, Filter Importance Sampling. They propose your method 2, study the properties, and come out generally in favor of it. They claim that this method gives smoother rendering results because it weights all samples that contribute to a pixel equally, thereby reducing variance in the final pixel values. This makes ...


9

The box.obj file has no vertex normals, and by default Mitsuba will generate smooth normals for OBJ files that don't specify their own normals. This creates the magnification effect: the box with smooth normals forms a convex lens! By adding this line to the box object in the scene file: <boolean name="faceNormals" value="true"/> I got results that ...


8

As mentioned in the comments, I would highly suggest starting with Full Volumetric Scattering. This is two fold: Since you are doing path tracing, adding volumetrics isn't super difficult. Fully understanding how full volumetric scattering works will be a great basis for understanding the estimations. In addition, it can provide great "references" to see if ...


7

First of all, a good reference for Monte Carlo path tracing in participating media is these course notes from Steve Marschner. The way I like to think about volume scattering is that a photon traveling through a medium has a certain probability per unit length of interacting (getting scattered or absorbed). As long as it doesn't interact, it just goes in a ...


7

Just to expand on some of the other answers, the proof that Russian Roulette does not give a biassed result is very simple. Suppose that you have some random variable $F$ which is the sum of several terms: $$F = F_1 + \cdots + F_N$$ Replace each term with: $$F'_i = \left\{ \begin{array}{ll} \frac{1}{p_i} F_i & \hbox{with probability } p_i \\ ...


7

Let us take one step back. When you do path tracing, you are doing a Monte Carlo integration. What does this mean? You try to solve $\int f(x)\mathrm{d}x$ by sampling. The Monte Carlo integration says for a sufficiently big $n$: $\frac{1}{n}\sum_{i=0}^n f(x_i) \rightarrow \int f(x)p(x) \mathrm{d}x$ If we instead sum $\frac{f(x_i)}{p(x_i)}$ we get $\frac{1}{...


7

Wenzel Jakob et al presented a framework for layered Materials at SIGGRAPH 2014. Section 6.2 explains importance sampling. If you prefer code over equations, the method is implemented in the Mitsuba renderer.


7

Assuming that you are familiar with the concept of BSDFs, the usual way of modelling rough dielectric surfaces (i.e. glass, water, plastics) is to use microfacet-based models like Microfacet Models for Refraction through Rough Surfaces. To make it work efficiently in a path tracer you will need a good sampling strategy, like Importance Sampling Microfacet-...


7

Overview Here is a short overview of the most used space representations, MLT variants and mutation strategies for these MLT variants. As you can see, there are quite some papers dating back to 2017 (e.g., three papers explore combining the Path Space and the Primary Sample Space by jumping back and forth between the two). Path Space (PS) representation, ...


6

When you perform regular Monte Carlo integration over a hemisphere using $N$ samples, each sample represents $\frac{2\pi}{N}$ steradians. So the Monte Carlo integration for Lambertian BRDF is: $$\frac{2\pi}{N}\sum_{i=1}^N\frac{\rho}{\pi}L_i*Cos\theta_i$$ For path tracing, you only take one sample per path segment, so because $N$=1, the above sum becomes: $...


6

TL;DR Yes, you can do it like that, you just have to divide the result by the probability of choosing the direction. Full Answer The topic of sampling in path tracers allowing materials with both reflection and refraction is actually a little bit more complex. Let's start with some background first. If you allow BSDFs - not just BRDFs - in your path ...


6

This is not a full answer, I would just like to share the knowledge I obtained by studying two of the papers mentioned in the question: Steerable Importance Sampling and Practical Product Importance Sampling for Direct Illumination. Steerable Importance Sampling In this paper they propose a method for sampling the product of the clamped cosine component ...


6

The problem lies mainly in CIE1931XYZ::tristimulusValues() function, where you normalize the resulting color to the luminance of your illuminant which causes that directly observed light source has luminance 1, but everything else is much darker. That is a nice thing to do if you just want to visualize colours of various reflectance spectra under a given ...


6

The problem appears to be unintentionally transparent surfaces Although the image is grainy, it is sufficiently clear to estimate that all of the darker regions are due to surfaces facing away from the light, rather than due to shadows cast onto surfaces facing towards the light. So it does seem that there is a problem, and the lack of shadows is not just ...


6

There are, and I am looking forward to seeing the specifics of other answers, but one way to deal with this is to not have the noise (or as much noise) in the source data to begin with. The noise is coming from the fact that there is high variance in the rendering - the number of samples you've taken haven't converged enough to the actual right answer of ...


6

I don't know if this is exactly what you're looking for. I work tangentially in the film and TV industry. I don't work for a studio, but I work on the software that studios use for their productions. It's software that any user could buy if they wanted to, but it has been used in feature films, television shows, commercials, music videos, and more. About ...


5

is it correct having such a big light? I don't see any problem with having a big area light. That said, it also depends on the scale of your scene. If the light is large compared to it, shadows will tend to be more diffuse, like under an overcast sky. shadows are missing.. [...] Can you help me understanding why? I haven't found any blatant mistake, but ...


5

Firstly, as @trichoplax correctly pointed out, your randomPoint function calculates a point in a cube, then uses rejection sampling to return all points that are inside a unit sphere. In order to return points on a sphere, you would need to change the greater than to an equals. That said, rejection sampling is very inefficient. A better way to sample a ...


5

Yes, this is to be expected. The difference between your two images is the difference between using and not using importance sampling. The first image shows noticeably more noise than the second. This is because instead of biasing the hemisphere samples towards the normal by using cosine weighting, the code instead samples uniformly over the hemisphere and ...


5

Most renderers allow you to set a flag on an object to make shadow rays ignore it (so it won't cast shadows). You could set this flag on your glazing. That said, it's not unusual to make it so that refraction is disabled on shadow rays: that is, if they would be transmitted by an object, a child ray is traced in the same direction, ignoring any refraction ...


5

First of all, you can get caustics just by Path Tracing. Caustics isn't a difficult phenomenon in computer graphics. Almost any global illumination algorithm can render it. It's just a matter of the converging speed. While (naive) Path Tracing can render caustics, it takes a long time to clean the rendered image due to how the algorithm works. Photon ...


Only top voted, non community-wiki answers of a minimum length are eligible