1
0
mirror of https://github.com/ssloy/tinyraytracer.git synced 2025-09-03 02:53:17 +02:00

Updated Home (markdown)

Dmitry V. Sokolov
2019-01-21 00:57:35 +01:00
parent 65aedd55d4
commit 018b14cc20

@@ -136,8 +136,9 @@ The hardest part is over, and now our path is clear. If we know how to draw one
<img src="https://raw.githubusercontent.com/ssloy/tinyraytracer/c19c430151cb659372b4988876173b022164e371/out.jpg"/>
<h1>Stage 4: lighting</h1>
<h1>Step 4: lighting</h1>
The image is perfect in all aspects, except for the lack of light. Throughout the rest of the article we will talk about lighting. Let's add few point light sources:
```c++
struct Light {
Light(const Vec3f &p, const float &i) : position(p), intensity(i) {}
@@ -175,7 +176,7 @@ The dot product trick gives a good approximation of the illumination of matt sur
Check <a href="https://github.com/ssloy/tinyraytracer/commit/f5ec45c2541feb86b6a30cc3bb04917d60d13e9b">how few modifications</a> were necessary. In short, the brighter the light on the shiny surfaces, the less the angle between the view direction and the direction of <i>reflected</i> light.
This trickery with illumination of matt and shiny surfaces is known as <a href="https://en.wikipedia.org/wiki/Phong_reflection_modell">Phong reflection model</a>. The wiki has a fairly detailed description of this lighting model. It can be nice to read it side-by-side with the source code. Here is the key picture to understanding the magic:
This trickery with illumination of matt and shiny surfaces is known as <a href="https://en.wikipedia.org/wiki/Phong_reflection_model">Phong reflection model</a>. The wiki has a fairly detailed description of this lighting model. It can be nice to read it side-by-side with the source code. Here is the key picture to understanding the magic:
<img src="https://upload.wikimedia.org/wikipedia/commons/6/6b/Phong_components_version_4.png"/>
<h1>Step 6: shadows</h1>