# Why specular reflection portion changes when we move in different direction?

We know that in Specular reflection rays reflected off surface at inverse angle;so camera position matters;creates bright highlights.

I have taken one image where specular reflection is seen(Here angle between surface normal and incident light is small) : But when we move right(from my last photo taking place) I see the below image where previous specular portion has moved to right w. r. t fixed marker: My question is why specular reflection portion is changing it's position while object and light source is remain at same place? Where I have mistaken to understand specular reflection?

N. B. -when light incident on specular portion with some angle in first image, but when I move the angle of incident is same with first image angle in different places of surface like second image. That's why see specular reflection.But my question is how this angle of light incident is same in the second case inspite of light sources and object is fixed.

• You started your question by saying that you understand "camera position matters" ...and then you're asking why camera position matters? Try editing your question to explain in more detail how you think specular reflection works, what you think it means for camera position to matter, and how that in any way contradicts the bright specular highlight moving as the camera position moves. Keep in mind though, this is NOT a question about game development. This is a question about optics, as your example demonstrates that this happens in real life, not just in games. Dec 15, 2021 at 15:34
• I'm also not sure this question belongs here. But I'm also worried you are going to post it in a lot of sites. My intuition is that this is physics. But also, based on your recent question, I supuse you don't want a heavy physics explanation, and that you are more interested in understand how to render something like this, but that isn't what you are asking either. Dec 15, 2021 at 15:43
• @Theraot you just tell me when light incident on specular portion with some angle in first image, but when I move angle of incident is same with first image angle in different places of surface like second image. But my question how this angle of light incident is same inspite of light sources and object is fixed. Dec 15, 2021 at 16:02
• @Theraot you tell where I ask this this question and you will answer there. And I delete this question. Dec 15, 2021 at 16:20
• This question would be welcome here if you can edit it to describe it in terms of a game you are working on. Are you working on implementing specular reflection in a game of your own, and need help understanding the formulas? If so, that should be what you show in your question here. Dec 15, 2021 at 17:44

The specular highlight (labelled "specular" on the pictures you provided) is an specular reflection of the light source. It happens where the rays from the light source are reflected directly - with little or not scattering - into the camera.

For reflection, how light is scattered depends on:

• The material. In particular, how rough or smooth the surface is.
• The angle with the normal of the surface, respect to the position of the light and the camera.

Which means that whether or not a point is part of the specular highlight depends on:

• The normal of the surface on the point.
• How rough or smooth the surface is on the point.
• The direction to the light source from the point.
• The direction to the camera from the point.

Let us come up with some names.

Let us say we are considering a point P which is on the surface of the object. And we would do this for every visible point, but we are going to consider one point at a time.

And let us say the normal at the point P is n. I'll be assuming that n is a unit vector (a vector of length 1).

Let us say the light source is at position S. And the camera is at position C.

So the position of the light source relative to the point is S - P. And thus the direction of the light from the point is:

l = normalize(S - P)


Which is equivalent to:

l = (S - P) * 1/length(S - P)


Where * denotes scalar product. So we are scaling the vector S - P by the inverse of its length. Which gives us a unit vector in the same direction.

Similarly, the position of the camera relative to the point is C - P. So the direction of the camera from the point is:

v = normalize(C - P)


Which is equivalent to:

v = (C - P) * 1/length(C - P)


By the way, length (a.k.a norm, which is also represented with vertical bars |) would be the Pythagoras' theorem. It extends naturally to 3D like this: length = sqrt(x*x + y*y + z*z), where sqrt is the square root.

Now, the question is how close direction to the camera from the point compared to the ideal reflection direction. And whether or not it is close enough to be an specular highlight. This picture is taken from the article: Warp3D Nova: 3D Lighting - Part 1 by Hans de Ruiter.

We can compute the ideal reflection direction r starting with the direction to the light l, and the normal n. Such that the incident angle (the angle between l and n) and the reflection angle (the angle between r and n) are equal.

With the formula for vector reflection (under the assumption that n and l are unit vector) we have:

r = n * 2(l·n) - l


Where · denotes dot product.

Then we can ask what is the angle between r and v:

angle = angle_between(r·v)


Which we can compute using the inverse cosine function (acos) and the dot product (under the assumption that R and V are unit vectors).

angle = acos(r·v)


I have explained the relationship between cosine and the dot product on my answer to "When are oblique triangles used in game development?". You may also be interested in How to Work With Arbitrarily Oriented Vectors.

Finally there will be some max_angle which depends on how smooth the surface is. And the point is in the specular highlight if angle < max_angle.

Well, actually, that is a simplification. In reality, it is not that there is a max_angle. It is that the intensity of the reflection decays with the angle until we disregard it. And how fast the intensity decays with the angle depends on how smooth the surface is.

You can confirm in the photos in question that area near the specular highlight is also bright, just not as much. Varying roughness (from left to right, rough to smooth). This picture is taken from the article Physically Based Rendering in Filament.

This is because a rough surface does not reflect all the incoming rays in the same direction. Roughness here would be a representation of micro-imperfections in the surface. A systematic illustration of light scattering at a randomly micro rough surface. This picture is taken from the scientific article Matt Polyurethane Coating: Correlation of Surface Roughness on Measurement Length and Gloss.

Instead of simulating the micro-imperfections of the surface, we encode them as macro properties of the material (such as roughness) which characterize the behavior of the light reflecting on it. We need to consider how realistic we want to generate the pictures, and also how computationally expensive is it to do it. In particular in video games, where we have a limited time to generate each frame.

About the situation depicted in the photos in question is that for the position of the light, the position of the camera, and the position, orientation and geometry of the object. There might be some point or points that get a very intense specular reflection, and we call that a specular highlight.

And if we change any of those variables (the position of the light, the position of the camera, and the position, orientation and geometry of the object) the set of points that get that very intense specular reflection is going to be different.

Thus, translating or rotating the object changes what points have the specular highlight. And so does moving the camera, or moving the light source.

Let us consider the situation where only we moved the camera.

The object and the light source remain in the same place. Thus the angle of the incident light is the same for every point. However, in one position of the camera some points reflect into the camera at the ideal angle. And in the other position, some different set of points reflect the light into the camera at the ideal angle.

To put it in the terms defined above. If we don't move the object or the light source then for every point n and l remain the same, and thus r also remains the same. However, if we moved the camera then v would change. So, in one position of the camera some points have a very small angle between v and r. And in the other position, some different set of points have a very small angle between v and r. As a consequence we see the specular highlight in a different place.

• l = normalize(S - P) Which is equivalent to: l = (S - P) * 1/length(S - P), it's not understanding, what does normalize mean and how you got this formula? Dec 15, 2021 at 18:12
• @Ponting normalize is what I explain there. I'm making a unit vector with the same direction as another vector. We multiply a vector by a scalar, which scales (stretches or contracts) the vector. So, if we multiply a vector by 2, we get a vector in the same direction but twice as long. Now, if I have a vector of length X and I want to scale it down to length 1, I scale by a factor of 1/X. The formula comes from there. Btw, these are well known formulas. You should be able to find a version of them in any vector algebra book. And also on wikipedia and other sites. Dec 15, 2021 at 18:19
• "By the way, length (a.k.a norm, which is also represented with vertical bars |) "--- how length is norm? How to find length C-P or length S-P?you mean modulus of C-P? If C-P= ai +bj+ck, then modulus of C-P is sqrt a^2+b^2+c^2? Dec 15, 2021 at 18:34
• @Ponting the norm of a vector is the length of a vector. To be more precise, by length I mean the euclidean norm of the vector. This is the default, if somebody says "the norm of a vector" and don't specify a vector space or metric, it is the euclidean one. You compute it by the euclidean metric… Which is Pythagoras' theorem extended to the number of dimensions you need (3 for our purposes). Which reminds me, it is also sometimes called the magnitud of a vector. Same thing. And now you call it "modulus"? OK, one more name. Modulus makes me think of modular arithmetic, I'll avoid that name. Dec 15, 2021 at 18:43
• my above explanation is right? Dec 15, 2021 at 18:45