<p>I can't manage to produce a metallic looking sphere despite trying many things. I have the basics working, i.e shadows, refraction etc. but I'm not sure what combination of these will allow me to produce a metallic surface. I know that it should be reflective and retain it's color but how do I go about accomplishing that?
This is my spec and diffuse calc:
specular code = vec(1,1,1) * pow((std::max(0.f, dot(light, reflection))), spec)//white specular highlights</p>

<p>diffuse code =  vec diffuse = col*std::max(0.f, dot(normal, light));//col = object col</p>

<p>I test if the object that is hit is reflective and calculate the reflection ray, but how do I make it look metallic after producing the reflective image on the sphere?</p>

CC BY-SA 4.0
2020-03-29T20:20:44.113Z
Look up Cook-Torrance.
lightxbulb
CC BY-SA 4.0
2020-03-30T01:33:50.583Z
Note that how you render the image doesn't really affect whether the surface is metallic. A rasterizer is just as capable of getting a surface to appear metallic as a raytracer. It's all about the lighting model you employ.
Nicol Bolas
CC BY-SA 4.0
2020-03-30T05:52:15.937Z
won't the way the light interacts with the surface determine whether its metallic or not?
JerSci
CC BY-SA 4.0
2020-03-30T06:37:23.570Z
Could you post an image?
Simon F
CC BY-SA 4.0
2020-03-30T06:38:34.473Z
I'm not sure of what exactly
JerSci
CC BY-SA 4.0
2020-03-30T21:16:10.957Z
@JerSci: "*won't the way the light interacts with the surface determine whether its metallic or not?*" Sure, but how "light interacts with the surface" is governed by your lighting equation. And you can implement pretty much any lighting equation in a rasterizer.
Nicol Bolas
CC BY-SA 4.0
2020-03-31T15:32:02.410Z
A surface will look metallic if it is essentially perfectly reflective. So when you do the ray tracing, your object should take on the color of the background almost completely. If you add a picture of what you have, that would be very helpful.
jheindel
CC BY-SA 4.0
2020-03-31T15:36:23.893Z
@jheindel the problem with that is that my sphere completely disappears into the background because it's completely reflective. Say I have a blue background and a red sphere in the scene, I wont be able to see the red sphere because its completely reflective and blends into the blue background
JerSci
CC BY-SA 4.0
2020-03-31T15:37:02.207Z
@jheindel just putting this up here because I dont think the tag worked
JerSci
<raytracing><c++>
How do I produce a metallic surface in ray tracing?
JerSci
# How do I produce a metallic surface in ray tracing?

(Asked by: username_0 on 2020-03-29)

I can't manage to produce a metallic looking sphere despite trying many things. I have the basics working, i.e shadows, refraction etc. but I'm not sure what combination of these will allow me to produce a metallic surface. I know that it should be reflective and retain it's color but how do I go about accomplishing that?
This is my spec and diffuse calc:
specular code = vec(1,1,1) \* pow((std::max(0.f, dot(light, reflection))), spec)//white specular highlights

diffuse code = vec diffuse = col\*std::max(0.f, dot(normal, light));//col = object col

I test if the object that is hit is reflective and calculate the reflection ray, but how do I make it look metallic after producing the reflective image on the sphere?

**Tags:** raytracing, c++

> **Comments:**
> **username_1**: Look up Cook-Torrance.  
> **username_2**: Note that how you render the image doesn't really affect whether the surface is metallic. A rasterizer is just as capable of getting a surface to appear metallic as a raytracer. It's all about the lighting model you employ.  
> **username_0**: won't the way the light interacts with the surface determine whether its metallic or not?  
> **username_3**: Could you post an image?  
> **username_0**: I'm not sure of what exactly  
> **username_2**: @username_0: "*won't the way the light interacts with the surface determine whether its metallic or not?*" Sure, but how "light interacts with the surface" is governed by your lighting equation. And you can implement pretty much any lighting equation in a rasterizer.  
> **username_4**: A surface will look metallic if it is essentially perfectly reflective. So when you do the ray tracing, your object should take on the color of the background almost completely. If you add a picture of what you have, that would be very helpful.  
> **username_0**: @username_4 the problem with that is that my sphere completely disappears into the background because it's completely reflective. Say I have a blue background and a red sphere in the scene, I wont be able to see the red sphere because its completely reflective and blends into the blue background  
> **username_0**: @username_4 just putting this up here because I dont think the tag worked  

---

## 0 answers

