You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most textures and level geometry have two types of reflection which dictate their appearance to players: specular and diffuse. (There is also environment mapping, which is a kind of specular reflection, but that is beyond the scope of this guide.) This guide aims to give a simple background to the physics of specular highlights and diffuse lighting, and the steps a mapper needs to take in order to make their lighting physically realistic.
All reflection follows the simple rule called the law of reflection: light bounces off a surface at the same angle in the opposite direction:
This law alone accounts for all of how typical light propagates (in the absence of glass, etc. which causes refraction), and is the reason we're able to see anything that isn't a light source itself. The engine breaks this up into two catagories: specular, or direction-specific, lighting, and diffuse, or direction-independent, lighting.
Diffuse Reflection
Diffuse reflection is the result of an irregular surface, such that at a large distance it is not possible to tell which direction the surface is oriented in order to figure out which direction the reflected ray will go. This means that regardless of what angle you present a given illuminance onto a perfectly diffuse surface, it will have the same brightness.
Please note however that this does not mean that a perfectly diffuse surface, like a plane, will be equally bright everywhere if lit by a point source: the illuminance goes down as you get farther away from a point source of a constant luminous flux: as you get farther away from a point source, the amount of light per unit area goes down proportional to the distance away from the point source squared.
Specular Reflection
Specular reflection is easier to grasp than diffuse reflection: the surface normal (an arrow pointing perpendicular to the surface) is the same at all useful scales. This means that light in bulk behaves as one would expect from applying the law of reflection: you don't see any reflected light unless you are directly in the reflection path of the light source.
Many textures have a specular map which tells the engine which areas of the texture are shinier and should have more intense specular reflections. The "blob" of specular highlights is modeled because most surfaces have small variances in their surface which tends to warp the light image, and because point light sources are called upon to simulate lights with areal dimensions.
Normal Mapping
auster's side walls with flat diffuse maps; the "texture" seen here is purely from the normal mapping
There's a wrinkle in this simple model caused by the introduction of normal maps: a texture which tells the engine which direction the surface normal points (what direction the texture faces). This allows the engine to cheaply calculate how much light is hitting a certain area by its angle relative to the light source without requiring actual geometry. It affects both specular and diffuse reflections in this way and allows adding considerable texture realism without undue computational effort.
Lighting in RE
Here, with a light set in the air, the two types of lighting are apparent: diffuse lighting as an even disk around the light source, and a specular reflection which follows the law of reflection macroscopically. Both of these are physical and reasonable to see in the real world
Unphysical Specular Reflections
This is not a physical situation but is quite an easy trap to fall into: a specular reflection on a flush light makes no sense at all: the textured light source is flush with the surface, so the incident angle is 0° and the reflected rays are likewise 0°; the player cannot see these because they would need to be exactly at ground height (at which point the solid angle of the floor is zero). This is caused by having the light entity above the floor (so the floor gets lit at all) where it can cast meaningful specular reflections.
If the situation calls for a flush light on a wall, ceiling, or floor, be careful to disable specular lighting (flag 8), remove the specular channel from the texture (either by vshaderparam specscale 0 0 0 or removing the specular alltogether in the .cfg file), or removing the offending light alltogether with a lightfx spotlight so that unphysical specular highlights do not appear.
If one must use strip lighting, which is light-intensive and not recommended anywway, it is important to disable specular highlights as well to prevent odd-looking point speculars.
Unphysical Diffuse Reflection
Likewise, be careful about how the diffuse lighting presents itself on the area around the light: since the light cannot physically cast rays onto the area flush with it, the only justification for any diffuse light around the lamp is that the light source is bouncing off of other walls and then back onto the area surrounding the light (this is global illumination). This is usually not actually the case, but is less jarring and more acceptable than unphysical speculars which follow the camera.
One way to fix these lighting concerns is by use of a spotlight lightfx, which can redirect the light away from the adjacent surface.
Examples of Problematic Lighting
Please note that speculars did not have a flag to allow disabling prior to 1.9: there may not have been a workable way for the mappers to remove the problems shown.
This is not an indictment on the mappers' work (for the above reason) but a way for people to understand what problematic lighting looks like.
Echo has these lights on the base pillars, which provide these unphysical speculars from the recessed, banded lights wrapping around the pillars.
Neodrive shows a ceiling specular reflection from the two flush ceiling lights highlighted.
Conflict with a pair of recessed lights throwing intense speculars onto a surface they can't.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Most textures and level geometry have two types of reflection which dictate their appearance to players: specular and diffuse. (There is also environment mapping, which is a kind of specular reflection, but that is beyond the scope of this guide.) This guide aims to give a simple background to the physics of specular highlights and diffuse lighting, and the steps a mapper needs to take in order to make their lighting physically realistic.
Diagrams from OpenStax College Physics p784: https://openstax.org/details/books/college-physics
How do reflections work?
All reflection follows the simple rule called the law of reflection: light bounces off a surface at the same angle in the opposite direction:
This law alone accounts for all of how typical light propagates (in the absence of glass, etc. which causes refraction), and is the reason we're able to see anything that isn't a light source itself. The engine breaks this up into two catagories: specular, or direction-specific, lighting, and diffuse, or direction-independent, lighting.
Diffuse Reflection
Diffuse reflection is the result of an irregular surface, such that at a large distance it is not possible to tell which direction the surface is oriented in order to figure out which direction the reflected ray will go. This means that regardless of what angle you present a given illuminance onto a perfectly diffuse surface, it will have the same brightness.
Please note however that this does not mean that a perfectly diffuse surface, like a plane, will be equally bright everywhere if lit by a point source: the illuminance goes down as you get farther away from a point source of a constant luminous flux: as you get farther away from a point source, the amount of light per unit area goes down proportional to the distance away from the point source squared.
Specular Reflection
Specular reflection is easier to grasp than diffuse reflection: the surface normal (an arrow pointing perpendicular to the surface) is the same at all useful scales. This means that light in bulk behaves as one would expect from applying the law of reflection: you don't see any reflected light unless you are directly in the reflection path of the light source.
Many textures have a specular map which tells the engine which areas of the texture are shinier and should have more intense specular reflections. The "blob" of specular highlights is modeled because most surfaces have small variances in their surface which tends to warp the light image, and because point light sources are called upon to simulate lights with areal dimensions.
Normal Mapping
auster's side walls with flat diffuse maps; the "texture" seen here is purely from the normal mapping
There's a wrinkle in this simple model caused by the introduction of normal maps: a texture which tells the engine which direction the surface normal points (what direction the texture faces). This allows the engine to cheaply calculate how much light is hitting a certain area by its angle relative to the light source without requiring actual geometry. It affects both specular and diffuse reflections in this way and allows adding considerable texture realism without undue computational effort.
Lighting in RE
Here, with a light set in the air, the two types of lighting are apparent: diffuse lighting as an even disk around the light source, and a specular reflection which follows the law of reflection macroscopically. Both of these are physical and reasonable to see in the real world
Unphysical Specular Reflections
This is not a physical situation but is quite an easy trap to fall into: a specular reflection on a flush light makes no sense at all: the textured light source is flush with the surface, so the incident angle is 0° and the reflected rays are likewise 0°; the player cannot see these because they would need to be exactly at ground height (at which point the solid angle of the floor is zero). This is caused by having the light entity above the floor (so the floor gets lit at all) where it can cast meaningful specular reflections.
If the situation calls for a flush light on a wall, ceiling, or floor, be careful to disable specular lighting (flag 8), remove the specular channel from the texture (either by
vshaderparam specscale 0 0 0
or removing the specular alltogether in the .cfg file), or removing the offending light alltogether with alightfx
spotlight so that unphysical specular highlights do not appear.If one must use strip lighting, which is light-intensive and not recommended anywway, it is important to disable specular highlights as well to prevent odd-looking point speculars.
Unphysical Diffuse Reflection
Likewise, be careful about how the diffuse lighting presents itself on the area around the light: since the light cannot physically cast rays onto the area flush with it, the only justification for any diffuse light around the lamp is that the light source is bouncing off of other walls and then back onto the area surrounding the light (this is global illumination). This is usually not actually the case, but is less jarring and more acceptable than unphysical speculars which follow the camera.
One way to fix these lighting concerns is by use of a spotlight
lightfx
, which can redirect the light away from the adjacent surface.Examples of Problematic Lighting
Please note that speculars did not have a flag to allow disabling prior to 1.9: there may not have been a workable way for the mappers to remove the problems shown.
This is not an indictment on the mappers' work (for the above reason) but a way for people to understand what problematic lighting looks like.
Echo has these lights on the base pillars, which provide these unphysical speculars from the recessed, banded lights wrapping around the pillars.
Neodrive shows a ceiling specular reflection from the two flush ceiling lights highlighted.
Conflict with a pair of recessed lights throwing intense speculars onto a surface they can't.
Beta Was this translation helpful? Give feedback.
All reactions