<p>It’s a “naive” Monte Carlo sampler so it’s too dumb to send rays toward lights— it shotguns.   But the light is just a hemisphere (like a cloudy day) so you don’t get punished with too much noise.   Cloudy days look pretty good in real life.   But if you try to add a small light it will work but get very very noisy.   The third book in that series uses one method to address this (basically sending more rate where lights are rather than shadow rays per se)</p>

CC BY-SA 4.0
2018-06-10T16:13:34.033Z
2018-06-10T16:13:34.033Z
Peter Shirley
<p>I have not read the links but you remember that in the classical ray tracing ,namely Whitted rayTracing,  a single ray is traced from viewpoint to each pixel and alone if a complete diffusive surface is intercepted  the reflected ray (secundary ray) isn't calculated. Practically the contribution of indirect illumination on the specular diffusive surface is multiplied for $K_s$ i.e. the specularity coefficient of material and if diffusive coefficient $K_d$ is very hight $K_s$ will be very low and thus the reflective ray in that point isn't traced thus there will be a threashold to stop recursion. Furthermore the recursion tree is a binary tree because is launched between secundary ray the rifraction ray also.</p>

<p>In this method there is   subsampling namely aliasing: in the real case more that a ray determines the color of a pixel and in Witthed is like to use a sample(a single ray) for each pixel. Thus we can launch more that a ray for each pixel but not one ray for each equally divided space of the pixel (otherwise supersampling namely aliasing to a bigger frequency) but the rays are sent  in a stochastic way like this they will hit the areas where the color variation is higher (these areas cause aliasing). The Witthed ray Tracing here is rephrased following Kajiha equation of rendering that bring to solve an integral of the BRDF with Montecarlo method choising with importance the samples to estimate the integral using the BRDF or its estime like a probability distribution. 
Following these sthocatic approaches there are distributed ray tracing and path ray tracing for instance. </p>

CC BY-SA 4.0
2018-06-14T23:12:34.117Z
2018-06-14T23:12:34.117Z
Nick
<p>I was going through the <a href="http://in1weekend.blogspot.com/2016/01/ray-tracing-in-one-weekend.html" rel="nofollow noreferrer">raytracer in a weekend</a> book by Peter Shirley and the subsequent book <a href="http://in1weekend.blogspot.com/2016/01/ray-tracing-second-weekend.html" rel="nofollow noreferrer">raytracing the next week</a> and I couldn't make out what was the illumination model that was being used here.</p>

<p>all the previous raytracing samples that I have come across use the Phong shading model in which</p>

<ul>
<li>For a diffuse surface, a shadow ray is generated towards all the light sources and the final color is calculated based on the diffuse color and the non-occluded light intensities</li>
<li>For reflective materials and dielectrics, reflective and refractive rays are generated which are then recursively projected into the scene</li>
</ul>

<p>The method used in the book (very briefly) is as follows (Please do correct me if my understanding is wrong in any way)</p>

<ul>
<li>For diffuse objects, a ray is traced recursively in a random direction biased towards the normal at the hitpoint and the color from the resulting ray is multiplied with the current object's albedo to give the final color</li>
<li>For reflective and dielectrics, rays are cast using the law of reflection and the Snell's law respectively. </li>
<li>Lights also scatter rays and also add their emitted parts.</li>
</ul>

<p>The major differences I see in this approach are</p>

<ul>
<li>We do not directly sample the light sources.</li>
<li>Diffuse items also reflect rays (for inter-diffuse reflections)</li>
</ul>

<p>What exactly is the illumination model used in this approach? and why does this approach seem so simple and yet produces pretty good results?</p>

<p>Sorry if I missed something, I am relatively new to raytracing</p>

CC BY-SA 4.0
2018-06-10T13:45:17.733Z
Seems to me he is is simulating global Illumination, which is basically indirect lightning due to light coming at surface after being reflected from other surfaces. So yeah, we don't just shoot rays from intersection point (IP) to light directly, instead we shoot random rays from IP in order to simulate that indirect lighting coming from different surfaces.
gallickgunner
CC BY-SA 4.0
2018-06-13T08:31:33.887Z
These are two different illumination model: Local vs Global illumination. Global illumination considers all the light paths and its interaction with surfaces. A diffuse surface for example does not only receive light from a light source but scatters light in multiple direction around its local hemisphere which needs to be recursively traced. The later approach is very costly and needs statistical approach(monte carlo integration) to solve.
ali
<raytracing>
Illumination model used in the "Raytracer in a weekend" series
B0rn2C0de
# Illumination model used in the "Raytracer in a weekend" series

(Asked by: username_0 on 2018-06-10)

I was going through the [raytracer in a weekend](http://in1weekend.blogspot.com/2016/01/ray-tracing-in-one-weekend.html) book by username_3 and the subsequent book [raytracing the next week](http://in1weekend.blogspot.com/2016/01/ray-tracing-second-weekend.html) and I couldn't make out what was the illumination model that was being used here.

all the previous raytracing samples that I have come across use the Phong shading model in which

* For a diffuse surface, a shadow ray is generated towards all the light sources and the final color is calculated based on the diffuse color and the non-occluded light intensities
* For reflective materials and dielectrics, reflective and refractive rays are generated which are then recursively projected into the scene

The method used in the book (very briefly) is as follows (Please do correct me if my understanding is wrong in any way)

* For diffuse objects, a ray is traced recursively in a random direction biased towards the normal at the hitpoint and the color from the resulting ray is multiplied with the current object's albedo to give the final color
* For reflective and dielectrics, rays are cast using the law of reflection and the Snell's law respectively.
* Lights also scatter rays and also add their emitted parts.

The major differences I see in this approach are

* We do not directly sample the light sources.
* Diffuse items also reflect rays (for inter-diffuse reflections)

What exactly is the illumination model used in this approach? and why does this approach seem so simple and yet produces pretty good results?

Sorry if I missed something, I am relatively new to raytracing

**Tags:** raytracing

> **Comments:**
> **username_1**: Seems to me he is is simulating global Illumination, which is basically indirect lightning due to light coming at surface after being reflected from other surfaces. So yeah, we don't just shoot rays from intersection point (IP) to light directly, instead we shoot random rays from IP in order to simulate that indirect lighting coming from different surfaces.  
> **username_2**: These are two different illumination model: Local vs Global illumination. Global illumination considers all the light paths and its interaction with surfaces. A diffuse surface for example does not only receive light from a light source but scatters light in multiple direction around its local hemisphere which needs to be recursively traced. The later approach is very costly and needs statistical approach(monte carlo integration) to solve.  

---

## 2 answers

### Answer by username_3 on 2018-06-10. Score: 4 | Accepted answer

It’s a “naive” Monte Carlo sampler so it’s too dumb to send rays toward lights— it shotguns. But the light is just a hemisphere (like a cloudy day) so you don’t get punished with too much noise. Cloudy days look pretty good in real life. But if you try to add a small light it will work but get very very noisy. The third book in that series uses one method to address this (basically sending more rate where lights are rather than shadow rays per se)


---

### Answer by username_4 on 2018-06-14. Score: 1

I have not read the links but you remember that in the classical ray tracing ,namely Whitted rayTracing, a single ray is traced from viewpoint to each pixel and alone if a complete diffusive surface is intercepted the reflected ray (secundary ray) isn't calculated. Practically the contribution of indirect illumination on the specular diffusive surface is multiplied for $K\_s$ i.e. the specularity coefficient of material and if diffusive coefficient $K\_d$ is very hight $K\_s$ will be very low and thus the reflective ray in that point isn't traced thus there will be a threashold to stop recursion. Furthermore the recursion tree is a binary tree because is launched between secundary ray the rifraction ray also.

In this method there is subsampling namely aliasing: in the real case more that a ray determines the color of a pixel and in Witthed is like to use a sample(a single ray) for each pixel. Thus we can launch more that a ray for each pixel but not one ray for each equally divided space of the pixel (otherwise supersampling namely aliasing to a bigger frequency) but the rays are sent in a stochastic way like this they will hit the areas where the color variation is higher (these areas cause aliasing). The Witthed ray Tracing here is rephrased following Kajiha equation of rendering that bring to solve an integral of the BRDF with Montecarlo method choising with importance the samples to estimate the integral using the BRDF or its estime like a probability distribution.
Following these sthocatic approaches there are distributed ray tracing and path ray tracing for instance.


---

