<p>Consider a monochrome ball. The colours of the pixels is a function of the point height, the light intensity, the light angle, and the surface material (reflection).</p>
<p><a href="https://i.sstatic.net/mn7tk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mn7tk.png" alt="enter image description here" /></a></p>
<p>What is the simplest formula defining the resulting gradient?</p>
<p>Note that my question is not about raytracing, as we assume a simple object with no inner shadow/reflection. I am just curious what is the simplest relation between the pixel colour and the four parameters (of if there are more).</p>
<p>For every point, we have the coordinate <code>(x,y,z)</code> and the RGB colour of the material (left image). How can we calculate the appearance colour (the right image) in a very basic form?</p>

CC BY-SA 4.0
2022-02-21T11:05:24.680Z
to calculate the light intensity like the right part of your image, you would need the normal vector of you surface. In case of a simple sphere, your normal vector is the normalized position vector. What you are looking for is called Phong shading. Usually it is the sum of 3 different calculations. 1:Ambient light. the whole surface adds a specified color value, 2:Diffuse light. Usually it is the cosine of the angle between light direction and normal vector. 3:Specular light.See Link: https://www.mathematik.uni-marburg.de/~thormae/lectures/graphics1/code/WebGLShaderLightMat/ShaderLightMat.html
Thomas
CC BY-SA 4.0
2022-02-21T12:06:19.767Z
@Thomas wow, that's brilliant. I never thought of the normal vector at each point. The ambient light is the starting colour (given in the 2D image). Since the diffuse light is calculated by the cosine of the angle between the light direction and the normal vector, we can even calculate the shade on the other side of the sphere without raytracing.
Googlebot
CC BY-SA 4.0
2022-02-21T14:45:21.587Z
The ambient light is the starting color usually with less brightness! The ambient light usually is fake. It is added to the model, so that dark spots (shadow regions) are not totally black.
Thomas
CC BY-SA 4.0
2022-02-22T14:38:43.460Z
We call this formula "N dot L".  That's pretty simple.  The dot product of the surface normal vector (N) and the light vector (L).  If both are normalized, results in the cosine of the angle between the vectors.
Wyck
<3d><mathematics><lighting><perspective><gradient>
physics/math of lighting gradient of a 3D object
Googlebot
# physics/math of lighting gradient of a 3D object

(Asked by: username_0 on 2022-02-21)

Consider a monochrome ball. The colours of the pixels is a function of the point height, the light intensity, the light angle, and the surface material (reflection).

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

What is the simplest formula defining the resulting gradient?

Note that my question is not about raytracing, as we assume a simple object with no inner shadow/reflection. I am just curious what is the simplest relation between the pixel colour and the four parameters (of if there are more).

For every point, we have the coordinate `(x,y,z)` and the RGB colour of the material (left image). How can we calculate the appearance colour (the right image) in a very basic form?

**Tags:** 3d, mathematics, lighting, perspective, gradient

> **Comments:**
> **username_1**: to calculate the light intensity like the right part of your image, you would need the normal vector of you surface. In case of a simple sphere, your normal vector is the normalized position vector. What you are looking for is called Phong shading. Usually it is the sum of 3 different calculations. 1:Ambient light. the whole surface adds a specified color value, 2:Diffuse light. Usually it is the cosine of the angle between light direction and normal vector. 3:Specular light.See Link: https://www.mathematik.uni-marburg.de/~thormae/lectures/graphics1/code/WebGLShaderLightMat/ShaderLightMat.html  
> **username_0**: @username_1 wow, that's brilliant. I never thought of the normal vector at each point. The ambient light is the starting colour (given in the 2D image). Since the diffuse light is calculated by the cosine of the angle between the light direction and the normal vector, we can even calculate the shade on the other side of the sphere without raytracing.  
> **username_1**: The ambient light is the starting color usually with less brightness! The ambient light usually is fake. It is added to the model, so that dark spots (shadow regions) are not totally black.  
> **username_2**: We call this formula "N dot L".  That's pretty simple.  The dot product of the surface normal vector (N) and the light vector (L).  If both are normalized, results in the cosine of the angle between the vectors.  

---

## 0 answers

