# Light Theory Questions

## Recommended Posts

maya18222    194
1. When rendering objects such as a shiny red ball in computer graphics. You generally calculate 2 terms and add them together. That is the Diffuse and Specular term. But if you have a super shiny red ball, with a sharp highlight. Doesnt that mean that its surface, is very smooth, and so it should exhibit a higher rate of specular reflection and very little diffuse reflection. That is the object should see little of its material colour, and should highly reflect its enviroment. Yet we seem to always calculate the diffuse in full, and the specular contribution dpending on the smoothness level, and add them together. That is how can a surface be a fully diffuse surface and a fully specular surface? If we find that the surface has a smooth surface, shouldnt the calculation use less of the "Diffuse reflection" term? yet that never seems to happen. 2. From my understanding, it is only diffuse reflection that absorbs colour from the ray that strikes, that is, it reflects a different coloured ray than the one that striked the surface, due to absorbtion. Where as specular reflection reflects the exact ray without any absorbtion, thus no colour change. But why is this? From all the diagrams you see, both specular and diffuse are cases of reflection, just with different incident angles depending on how smooth the surface is. Why is it that specular reflections dont absorb colour from the striking ray, yet diffuse reflection does? 3. If a surface is highly smooth, then specular reflection takes place and little absorbtion. Yet if a surface is fairly rough, then diffuse reflection takes place and more absorbtion, as shown below. So what does it mean for a surface to be, in the "middle"? In that its not rough but its not smooth? To model this, would you LERP between a fully specular reflection ray colour and a fully diffuse ray colour, depending on how smooth the surface is? 4. Why is it that surface and light descriptions also contain a specular colour parameter? Shouldnt the reflected ray colour be calcuated from the general light colour that the surface was struck with? why use a specular colour instead? 5. What causes a light ray to dimminish? From my understanding, it will dimminish as it is absorbed over multiple bounces within the enviroment. But if the enviroment was to contain infinitley smooth surfaces, does that mean the the light ray in thoery would be bouncing around indefinitely?

##### Share on other sites
Yann L    1802
Quote:
 Original post by maya182221. When rendering objects such as a shiny red ball in computer graphics. You generally calculate 2 terms and add them together. That is the Diffuse and Specular term. But if you have a super shiny red ball, with a sharp highlight. Doesnt that mean that its surface, is very smooth, and so it should exhibit a higher rate of specular reflection and very little diffuse reflection. That is the object should see little of its material colour, and should highly reflect its enviroment. Yet we seem to always calculate the diffuse in full, and the specular contribution dpending on the smoothness level, and add them together. That is how can a surface be a fully diffuse surface and a fully specular surface? If we find that the surface has a smooth surface, shouldnt the calculation use less of the "Diffuse reflection" term? yet that never seems to happen.

You are absolutely correct. The Phong/Blinn model is a very rough approximation of reality, and is not physically correct. A physically based, energy preserving shader will indeed function as you described. More specular reflectivity means less diffuse reflection. Energy conservation requires this. A chrome surface, for example, will have a very high amount of specular reflection, yet a very low amount of diffuse reflection. Both terms (assuming a non-transparent material) must add up to 1.

Quote:
 Original post by maya182222. From my understanding, it is only diffuse reflection that absorbs colour from the ray that strikes, that is, it reflects a different coloured ray than the one that striked the surface, due to absorbtion. Where as specular reflection reflects the exact ray without any absorbtion, thus no colour change. But why is this?

It isn't. This behaviour is again a very rough (and incorrect) approximation. In reality, it depends on the type of material. Basically, materials can be classified into three major classes: dielectrics, semi conductors and conductors. Light reacts differently when it strikes these materials. In general, dielectrics will not tint the specular reflection. Conductors, such as metals, will have a coloured specular reflection. Consider brass or gold for example. Semi-conductors are special, and are usually not found on macroscopic surfaces.

A physically based shader will take the material type into account when calculating the spectral reflection (ie. the intensity and colour of the reflected light).

Another thing to consider are layered materials. Almost all materials occurring in real life are layered to some extend. Consider a varnished wooden floor for example. The varnish is a clear, highly specular surface, while the wood underneath is a very diffuse one. The light first strikes the varnish layer, and specularily reflects back. The remaining light goes through to the wood and is partially absorbed and partially diffusely reflected. The amount of specular versus diffuse reflection in such a case is controlled by the Fresnel equations.

Plastic is another example. Plastic is composed of microscopic little dye bubbles embedded in a clear substrate. The light first hits this clear substrate before hitting the diffuse dye.

A lot of materials in reality are even more complex than that, and consist of several layers that interact. These can be approximated by sub-surface scattering shaders. Transparent or translucent materials extend this concept with introducing transmitted light and intra-material absorption. Also, some materials with very fine and regular surface elements may exhibit diffraction through light interference, which significantly changes the way specular reflection works (a CD or a hologram, for example).

Quote:
 Original post by maya182223. If a surface is highly smooth, then specular reflection takes place and little absorbtion. Yet if a surface is fairly rough, then diffuse reflection takes place and more absorbtion, as shown below. So what does it mean for a surface to be, in the "middle"? In that its not rough but its not smooth? To model this, would you LERP between a fully specular reflection ray colour and a fully diffuse ray colour, depending on how smooth the surface is?

A surface inbetween is often a layered or coated surface, as I explained above. In other cases, progressive blurring can be used. The rougher the surface, the more blur you apply to the reflection. For a fully diffuse surface, the blur would equal the radiance integral over the full hemisphere of 2pi steradians. That's the maximal possible 'diffuseness' in reality.

Quote:
 Original post by maya182224. Why is it that surface and light descriptions also contain a specular colour parameter? Shouldnt the reflected ray colour be calcuated from the general light colour that the surface was struck with? why use a specular colour instead?

Because these models are only rough approximations. Physically based models will not separate these colours. They will expose a general roughness term (often over glossiness, which will integrate/blur the incoming light), the diffuse colour, the IOR (to compute the Fresnel term) and the type of material (dielectric or metal).

Quote:
 Original post by maya182225. What causes a light ray to dimminish? From my understanding, it will dimminish as it is absorbed over multiple bounces within the enviroment. But if the enviroment was to contain infinitley smooth surfaces, does that mean the the light ray in thoery would be bouncing around indefinitely?

Correct, assuming we're in total vacuum (and ignoring certain quantum-mechanical effects).

##### Share on other sites
danong    125
I guess you have missed something important,
first of the very first,
the lighting simulation in DX or GL are all of artifact one,
which means is an approach to the real light phenomena in exchange of speed boosting in real-time rendering.

Specular or Diffusion,
is just a term for lighting properties.
Specular happens everywhere accompanied by diffusion,
as i said,

Light is penetrating, reflecting, refracting and even some are attenuating, disappearing without no reasons(YES it can be, where photon strikes another particle and either positron or electron are emitted). Such electron are then reflected or refracted into our eyes and before it reaches, there's another probability such that two particle, either positron or electron will again merge and become photons (light particle), so it appears nowhere.

So in real-world, all things combined to happen together,
it is just from macroscopic view that diffusion is distinct from specular and yet they are actually the same phenomena accompanied.

If you would like to know more,
dive into Quantum theory and you will understand.

##### Share on other sites
zurekx    167
I can really recommend you to write your own path tracer (or something similar). A path tracer is (to some degree I guess, I'm not into quantum theory) very realistic and you get a good feeling for everything you asked.

##### Share on other sites
Spynacker    106
You might also read about micro facette theorie which might explain your
problem considering diffuse vs specular reflection.
Remember that those equations like Phong/Blinn try to simulate the microscopic
behavoir of a surface by characterizing it macroscopic with some sort of
probabilities. They use numbers expressing the distribution of possible
reflecting microfacettes for your direction assuming a perfect surface.

Another point is, that almost every renderer works in rgb values rather than
true lightcolor by frequency.

Considering all I said before I would recommend you to read Christophe Schlick's
specifikation of his lightmodel. It is very modular thus easy to extend and has
capabilities for multi-layered surfaces, microfacette theory, anisotropy and many
more.

##### Share on other sites
maya18222    194
Thanks to Yann and others for their replies. This kind of thing really interests me, and so I have ordered the book Physically based Rendering. Are there any others you'd recommend?

Quote:
 I can really recommend you to write your own path tracer (or something similar). A path tracer is (to some degree I guess, I'm not into quantum theory) very realistic and you get a good feeling for everything you asked.

Ive always wanted to do this, and plan to.

[quote]I guess you have missed something important,
first of the very first,
the lighting simulation in DX or GL are all of artifact one,
which means is an approach to the real light phenomena in exchange of speed boosting in real-time rendering.[\quote]

Nah, I'm fully aware, that most shaders are a crude approximation. My point was, which I didnt make very clear, the confusion in reading about shaders, where the authors dont usually mention what actually happens in real life. For example I have several books that all explain exactly how specular and diffuse reflection work in regard to their simplified shader models of these phenomona, but not much at all about how the shader would be written if it was somewhat physically correct, and the implications it would create.

##### Share on other sites
danong    125
[quote]
Quote:
 I guess you have missed something important,first of the very first,the lighting simulation in DX or GL are all of artifact one,which means is an approach to the real light phenomena in exchange of speed boosting in real-time rendering.[\quote]Nah, I'm fully aware, that most shaders are a crude approximation. My point was, which I didnt make very clear, the confusion in reading about shaders, where the authors dont usually mention what actually happens in real life. For example I have several books that all explain exactly how specular and diffuse reflection work in regard to their simplified shader models of these phenomona, but not much at all about how the shader would be written if it was somewhat physically correct, and the implications it would create.

It's good you are aware of it, but not completely i guess?
Because these authors( to some extent),
some dive deep enough to know light's properties,
while some may not.
So in order not to confuse the readers with no strong physics background,
they rather excluded the theoretical parts.

Hope you enjoy in light's simulation.
Cheers.

Regards,
Daniel.

##### Share on other sites
cignox1    735
Quote:
 Original post by zurekxI can really recommend you to write your own path tracer (or something similar). A path tracer is (to some degree I guess, I'm not into quantum theory) very realistic and you get a good feeling for everything you asked.

Actually, the OP question has little to do with the specific light transport algorithm used. The key point is wich surface description you are using: physically based BRDF's would give a better description of the different materials.

##### Share on other sites
Check out, "Principles of Digital Image Synthesis" by Andrew Glassner

##### Share on other sites
Helicobster    231
Let's just clear this up.

For most computer graphics purposes, this...

...is wrong. It's okay for rough metals, but when we're talking about diffuse+specular shaders, we're talking about dielectrics.

When a ray meets a dielectric, some of it will be reflected (as per Fresnel's equation) and the rest will be refracted into the dielectric.

Beneath the surface, if it's an homogenous, clear substance like glass or water, the ray will keep going in the same direction, gradually diminished by linear absorption until it comes out the other side.

If it's a porous or inhomogenous substance (like plastic, wood, marble, concrete etc.), the ray will wander around, deflected many times by interfaces between particles of different IORs, and whatever isn't lost to absorption will eventually find its way out again, in the general direction of the surface normal.

That's what we see as 'diffuse' illumination. It's not scattered at the surface - it's scattered underneath the surface. Some wavelengths are absorbed more than others, so what comes back out after this sub-surface scattering will be tinted differently to the specular reflection.

And yes, in case you're wondering, the implication is that 'diffuse' and 'sub-surface scattering' are exactly the same effect, in reality. In computer graphics, diffuse is just a cheap & handy approximation of large-scale sub-surface scattering. If you don't believe me, take a thin sliver of any dielectric (ie: non-metallic) material and hold it up to the light.

##### Share on other sites
zurekx    167
Quote:
 Original post by cignox1Actually, the OP question has little to do with the specific light transport algorithm used. The key point is wich surface description you are using: physically based BRDF's would give a better description of the different materials.

That's true, but if you are to implement any such algorithm for learning transport theory, path tracers has a nice property of being intuitive and they require a relatively small amount of probabilistic calculations and such.

##### Share on other sites
maya18222    194
Thankyou. I found the "diffuse" thing difficult to grasp and couldn't figure out why that if both "specular" and "diffuse" reflect off the surface, why diffuse would also be changing the colour. When you talk about "diffuse" being sub-surface scattering, in that the rays actually enter the surface and then re-emit, that explains why the ray would change colour.

So is it correct to say that theres

Specular Reflection - Ray reflects off surface striked, and is exactly the same as it was before it struck, as it is after, only in a different direction. Such as a mirror

Sub-surface-scattering - Ray strikes the surface, but enters it, and reflects multiple times beneath, changing colour with each bounce before finally re-emiting in some direction that could be direction in the hemisphere above the surface. (why do you say roughly in the direction of the normal?) such as skin or was

Transmitance - Where the ray passes through a material with no affect as to its direction or colour. Such as glass

Refraction - Where the ray follows the same approach as Transmitance, only that the direction changes or is bent. such as water

Im still confused as to the situation, (which I believe is all situations), when more than one of these properties applies to some surface. Take for example a glass cup.

You can see refraction, transmitance, and reflection here. But its not 100% of one. So how does that work? What does a surface that is slightly reflective mean?

Whats happens when a ray stikes a surface that is partially reflective, as opposed to a ray that strikes a surface that is 100% reflective? The answer I come up with is that there is more of some other process. so. Keeping things simple

A surface that is 50% reflective, would perform a lot of sub surface scattering, changeing the ray colour a fair bit.

A surface that is 90% reflective, would peform a small amount of sub surfacing scattering, changeing the ray colour only slightly.

But how can a surface perform less or more SSS? surely the amount of bounces is purely random, and how quick the ray re-emits from the surface depends on the random factor that it manages to bounce of a sub surface that points back out?

Couldnt there be the chance that some 2 rays that strike a surface where SSS takes place. And where the first ray happens to emit striaght back out due to it striking a sub surface that points back out. Where the second ray could be highly "unlucky" and be bouncing around by some factor more, becuase it keeps striking sub surfaces that dont point back out.

Or am i thinking into this way too much? :P

I think I understand each process. I just am having trouble understanding when a surface property represents more than one process, such as above

##### Share on other sites
Helicobster    231
Quote:
 Specular Reflection - Ray reflects off surface striked, and is exactly the same as it was before it struck, as it is after, only in a different direction. Such as a mirror

Not really - it's more useful to assume that a ray is split into two whenever it hits a surface, and that only some of it is reflected. The rest is refracted or absorbed.

The proportions of reflection/refraction can be determined with Fresnel's equations for dielectrics, or Schlick's approximations for metals.
http://en.wikipedia.org/wiki/Fresnel_reflection
http://en.wikipedia.org/wiki/Schlick%27s_approximation
...except that we usually ignore polarisation or use a 50/50 blend of perpendicular & parallel.

Quote:
 Sub-surface-scattering - Ray strikes the surface, but enters it, and reflects multiple times beneath, changing colour with each bounce before finally re-emiting in some direction that could be direction in the hemisphere above the surface. (why do you say roughly in the direction of the normal?)

Any ray leaving a translucent substance is subject to Fresnel reflection again on its way out. The closer its exit vector to the normal, the less energy it loses to internal reflection. That just shapes the 'lobe' of this shading term so it's weaker when viewed tangentially, but it's not especially important - Lambert's cosine law will usually do the trick.

Oh - and for a more translucent look in this shading term, it pays to use a version of the normal that's unmodified or only weakly affected by bump or normal maps.

Quote:
 Transmitance - Where the ray passes through a material with no affect as to its direction or colour. Such as glass

Nope - glass is always refractive, always reflective, and always absorbs a little light. Same as water.

A thin layer of glass (like a window) only appears to leave rays unchanged because the front & back surfaces are parallel, so the refraction on entry is reversed on exit. So for realtime uses, you can skip refraction for thin layers of transparent materials (and for things like mesh curtains, of course) without sacrificing realism.

Quote:
 Whats happens when a ray stikes a surface that is partially reflective, as opposed to a ray that strikes a surface that is 100% reflective?

If you prefer to think of rays as indivisible things (like photons), then there's a chance that it'll be reflected, which depends on the angle of incidence.

You can also think of light as waves, which will certainly help improve your understanding, but it's kinda useless from a programming POV.

For our purposes, it makes much more sense to think of a ray is a bundle of infinitely many photons, so a portion of a ray can be reflected, with the proportions determined by the Fresnel equations.

It also helps to remember that nothing is 100% reflective, and that with every shading operation (except for glowy magical stuff), you should be losing 15% to 95% of the light energy you started with.

##### Share on other sites
maya18222    194
Ah yes. I was always thinking in terms of rays. And that if one ray stikes only one ray can leave. This way it easier for me to follow the rays path to get an understanding. When you talk about the splitting of rays. Doesnt this typically, from our point of view of a simulation, create an infinite number of rays within the scene? As not all surfaces will create a 100% pure reflection. Meaning that it will split rays, and its descendants will split on their collisions and so on? That is unless we allow these rays to lose all their enery and effectivly be removed from the simulation?

So if a light ray is instead modeled as a wave. what does it mean to split a wave?

##### Share on other sites
macnihilist    377
If you want to dive into physics coming from computer graphics, you may want to check out the book 'Optics' by Eugene Hecht.
While it leaves many open questions (I think it's an undergradute physics book), I found it quite illuminating.

##### Share on other sites
Helicobster    231
Quote:
 Original post by maya18222When you talk about the splitting of rays. Doesnt this typically, from our point of view of a simulation, create an infinite number of rays within the scene?...That is unless we allow these rays to lose all their enery and effectivly be removed from the simulation?

You don't need to create & manage an infinite number of rays all at once, if that's what you're asking. Typically you're scanning the scene with rays fired from the camera, just a few at a time. Those rays may still branch off as they bounce around, but with each bounce they lose energy, and with each branching they lose statistical significance, so when a ray is weak, it's easy to just drop it and move on.

You can still do interesting things by hurling a million rays around all at once - that's essentially what photon mapping is all about - but it's entirely optional.

Quote:
 So if a light ray is instead modeled as a wave. what does it mean to split a wave?

For a proper understanding of the wave nature of light, you should start with a proper understanding of waves in general. This isn't hard-core physics - a high-school physics textbook or something like (don't take this the wrong way) 'Physics for Dummies' will explain what waves can do other than just propagating in circles.

Fortunately, for our purposes, the dual wave/particle nature of light lets us get away with ignoring its wave nature altogether and simply approximating its effects. We can treat light as particles that travel instantaneously in straight lines, use tried & tested equations (from Fresnel, Snell, Lambert etc.) and have a much nicer time.