<p>For metallic materials to look metallic, they should have some environment surrounding them for them to reflect. In the sphereflake image you posted, the metal spheres are reflecting the yellow ground and a blue sky, together with getting specular highlights from three light sources, and this is enough to give the impression of metal. The reflected rays are either hitting the other spheres, the ground plane, or if they miss (don't hit anything) they are assumed to hit the sky, and assigned the sky color.</p>
<p>So, providing some sort of colored sky is useful. For instance, you can map a texture onto the sky based on the direction the ray is heading. There are many free <a href="https://www.hdri-hub.com/free-hdri-environments-for-download" rel="noreferrer">environment maps</a> available on the web that can be used for this purpose. Set it up so that &quot;miss&quot; rays sample the environment map, and the detail in the texture will provide the cues your brain needs to perceive the material as metallic. This is also known as &quot;image-based lighting&quot; since the lighting environment is determined by an image rather than (or in addition to) specified light sources.</p>
<p>For a simpler version of this, you could create a 1D gradient or color ramp mapped from the top of the sky to the bottom (i.e. based on the ray's vertical angle). It won't be quite as effective as a full HDR environment map but will still work better than a single flat color.</p>

CC BY-SA 4.0
2021-12-24T22:04:58.420Z
I've decided to add a large metal plane behind the camera. It did make part of the sphere metallic.
RoyTron
CC BY-SA 4.0
2021-12-22T00:59:17.920Z
2021-12-22T00:59:17.920Z
Nathan Reed
<p>I implemented reflection on my ray tracer. I had very few objects in the scene, so the reflected rays would less likely intersect.  If most of the rays don't intersect, metallic objects would appear less metallic. What I tried to do was use the dot product of the direction from the reflected ray's origin to the light source and the reflected ray's direction. It doesn't look very metallic. It just makes the parts of the object closer to the specular highlight brighter. I was wondering what'd be a better way to deal with reflected rays that don't intersect.</p>
<p>This is what I got with rendering a silver sphere.<a href="https://i.sstatic.net/BkjLc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/BkjLc.png" alt="enter image description here" /></a></p>
<p>Here is an example of how a metallic surface should be handled.</p>
<p><a href="https://i.sstatic.net/YVic1.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YVic1.jpg" alt="enter image description here" /></a></p>

<raytracing>
What to do with reflected rays that don't intersect?
RoyTron
# What to do with reflected rays that don't intersect?

(Asked by: username_0 on 2021-12-21)

I implemented reflection on my ray tracer. I had very few objects in the scene, so the reflected rays would less likely intersect. If most of the rays don't intersect, metallic objects would appear less metallic. What I tried to do was use the dot product of the direction from the reflected ray's origin to the light source and the reflected ray's direction. It doesn't look very metallic. It just makes the parts of the object closer to the specular highlight brighter. I was wondering what'd be a better way to deal with reflected rays that don't intersect.

This is what I got with rendering a silver sphere.[![enter image description here](https://i.sstatic.net/BkjLc.png)](https://i.sstatic.net/BkjLc.png)

Here is an example of how a metallic surface should be handled.

[![enter image description here](https://i.sstatic.net/YVic1.jpg)](https://i.sstatic.net/YVic1.jpg)

**Tags:** raytracing


---

## 1 answers

### Answer by username_1 on 2021-12-22. Score: 6

For metallic materials to look metallic, they should have some environment surrounding them for them to reflect. In the sphereflake image you posted, the metal spheres are reflecting the yellow ground and a blue sky, together with getting specular highlights from three light sources, and this is enough to give the impression of metal. The reflected rays are either hitting the other spheres, the ground plane, or if they miss (don't hit anything) they are assumed to hit the sky, and assigned the sky color.

So, providing some sort of colored sky is useful. For instance, you can map a texture onto the sky based on the direction the ray is heading. There are many free [environment maps](https://www.hdri-hub.com/free-hdri-environments-for-download) available on the web that can be used for this purpose. Set it up so that "miss" rays sample the environment map, and the detail in the texture will provide the cues your brain needs to perceive the material as metallic. This is also known as "image-based lighting" since the lighting environment is determined by an image rather than (or in addition to) specified light sources.

For a simpler version of this, you could create a 1D gradient or color ramp mapped from the top of the sky to the bottom (i.e. based on the ray's vertical angle). It won't be quite as effective as a full HDR environment map but will still work better than a single flat color.

> **Comments:**
> **username_0**: I've decided to add a large metal plane behind the camera. It did make part of the sphere metallic.  

---

