
- Computer Graphics - Home
- Computer Graphics Basics
- Computer Graphics Applications
- Graphics APIs and Pipelines
- Computer Graphics Maths
- Sets and Mapping
- Solving Quadratic Equations
- Computer Graphics Trigonometry
- Computer Graphics Vectors
- Linear Interpolation
- Computer Graphics Devices
- Cathode Ray Tube
- Raster Scan Display
- Random Scan Device
- Phosphorescence Color CRT
- Flat Panel Displays
- 3D Viewing Devices
- Images Pixels and Geometry
- Color Models
- Line Generation
- Line Generation Algorithm
- DDA Algorithm
- Bresenham's Line Generation Algorithm
- Mid-point Line Generation Algorithm
- Circle Generation
- Circle Generation Algorithm
- Bresenham's Circle Generation Algorithm
- Mid-point Circle Generation Algorithm
- Ellipse Generation Algorithm
- Polygon Filling
- Polygon Filling Algorithm
- Scan Line Algorithm
- Flood Filling Algorithm
- Boundary Fill Algorithm
- 4 and 8 Connected Polygon
- Inside Outside Test
- 2D Transformation
- 2D Transformation
- Transformation Between Coordinate System
- Affine Transformation
- Raster Methods Transformation
- 2D Viewing
- Viewing Pipeline and Reference Frame
- Window Viewport Coordinate Transformation
- Viewing & Clipping
- Point Clipping Algorithm
- Cohen-Sutherland Line Clipping
- Cyrus-Beck Line Clipping Algorithm
- Polygon Clipping Sutherland–Hodgman Algorithm
- Text Clipping
- Clipping Techniques
- Bitmap Graphics
- 3D Viewing Transformation
- 3D Computer Graphics
- Parallel Projection
- Orthographic Projection
- Oblique Projection
- Perspective Projection
- 3D Transformation
- Rotation with Quaternions
- Modelling and Coordinate Systems
- Back-face Culling
- Lighting in 3D Graphics
- Shadowing in 3D Graphics
- 3D Object Representation
- Represnting Polygons
- Computer Graphics Surfaces
- Visible Surface Detection
- 3D Objects Representation
- Computer Graphics Curves
- Computer Graphics Curves
- Types of Curves
- Bezier Curves and Surfaces
- B-Spline Curves and Surfaces
- Data Structures For Graphics
- Triangle Meshes
- Scene Graphs
- Spatial Data Structure
- Binary Space Partitioning
- Tiling Multidimensional Arrays
- Color Theory
- Colorimetry
- Chromatic Adaptation
- Color Appearance
- Antialiasing
- Ray Tracing
- Ray Tracing Algorithm
- Perspective Ray Tracing
- Computing Viewing Rays
- Ray-Object Intersection
- Shading in Ray Tracing
- Transparency and Refraction
- Constructive Solid Geometry
- Texture Mapping
- Texture Values
- Texture Coordinate Function
- Antialiasing Texture Lookups
- Procedural 3D Textures
- Reflection Models
- Real-World Materials
- Implementing Reflection Models
- Specular Reflection Models
- Smooth-Layered Model
- Rough-Layered Model
- Surface Shading
- Diffuse Shading
- Phong Shading
- Artistic Shading
- Computer Animation
- Computer Animation
- Keyframe Animation
- Morphing Animation
- Motion Path Animation
- Deformation Animation
- Character Animation
- Physics-Based Animation
- Procedural Animation Techniques
- Computer Graphics Fractals
Shadowing in 3D Graphics
The counterpart of lighting is shadowing. 3D graphics needs proper shadow algorithms also to visualize the shapes in more natural way. Rendering realistic shadows is a challenging task due to the variety of constraints, like multiple light sources, object geometry, and the need for both hard and soft shadows.
In this chapter, we will see the fundamental concepts and practical examples of shadowing techniques in 3D computer graphics for a better understanding.
Shadows in 3D Graphics
Shadows enhance the realism of 3D scenes. They add depth and helping the viewer perceive spatial relationships between objects. The shadows provide crucial information about the geometry of objects also their relative positions, and the light sources affecting them.
Rendering shadows is not a straightforward task because there are various factors. For instance, shadows may need to be cast by multiple light sources, rendered on non-planar surfaces, or simulate soft transitions between light and dark areas, etc.
Two of the most popular techniques for real-time shadow rendering are the shadow volume algorithm and shadow mapping algorithm.
Importance of Shadows
In 3D graphics, shadows are needed to create immersive and realistic scenes. They give the observer a sense of depth and the spatial arrangement of objects in a scene. Shadows help in differentiating between the foreground and background and provide information about the light source's intensity and position.
Challenges in Rendering Shadows
Rendering realistic shadows is a challenging task due to the many constraints involved. For instance −
- Shadows must consider planar and non-planar receivers.
- Single or multiple light sources may exist.
- Both hard and soft shadows may need to be rendered.
Shadow Volume Algorithm
There are many such algorithms, one of them is shadow volume algorithm. This algorithm, is the most commonly used methods for rendering shadows in 3D graphics. It divides the virtual world into areas that are in shadow and areas that are not. This algorithm works by projecting the shadows of objects behind them, determined by the light and occludes.
How does the Shadow Volume Algorithm Work?
The shadow volume algorithm can be broken into two steps −

Shadow Volume Creation
A shadow volume is constructed by extending the silhouette of an occluding object as seen from the light source. This creates a volume that represents the space in which the shadow exists.
Determining Shadowed Areas
After calculating all shadow volumes, the algorithm checks whether an object or part of it is within any shadow volume. This is done using a stencil buffer, which counts how many times a ray from the viewpoint crosses the boundary of a shadow volume. If a ray crosses into a shadow volume more times than it crosses out, the object is in shadow.
Real-Time Example: Doom 3
The shadow volume algorithm is widely used in real-time applications, such as video games. A notable example is the game Doom 3. There the shadow volume technique to create realistic shadows. The algorithm's ability to handle complex geometries made it a popular choice for such high-detail environments.
Projection Shadows
Another type is the projection shadows. This algorithms cast shadows on planar surfaces through projection transformations. These were among the earliest shadow rendering algorithms and are relatively simple and fast to compute. However, projection shadows have limitations, as they only work on planar surfaces and are prone to producing artifacts like anti-shadows or fake shadows.
Projection shadows work by projecting objects onto a planar surface, similar to how a 3D object is projected onto a 2D screen. While this technique is computationally simple, it does not handle non-planar surfaces well.
Improvements
There are several improvements have been proposed to address the weaknesses of projection shadows. One such method is the use of an accumulation buffer. This is to produce soft shadows, which avoids issues like anti-shadows. Additionally, techniques like spherical light sources this help generate smoother, more realistic shadows, although these methods come with their own limitations, such as increased computational cost and potential distortion in shadow size.
Shadow Mapping
Another advanced idea is Shadow mapping. This is a highly effective real-time technique for rendering shadows. It shows creating a shadow map from the light's perspective and using this map to determine which parts of the scene are in shadow.
How Shadow Mapping Works?
Shadow mapping works by rendering the scene from the point of view of the light source. This is storing the distance from the light to the nearest objects in a depth buffer called the shadow map. Then, the scene is rendered from the camera's perspective. For each pixel, the algorithm checks whether the distance from the light to the object is greater than the value stored in the shadow map or not. If it is, the pixel is in shadow.
This technique is relatively fast and works well for a wide range of objects and surfaces. The Z-buffer technique, often used with shadow mapping. This helps that only the closest objects to the light source are considered when calculating shadows.
Improvements to Shadow Mapping
There are several techniques that have been developed to improve shadow mapping. For example, silhouette maps. This help to reduce aliasing at shadow edges, improving the overall visual quality of the shadows. These maps store additional information about shadow boundaries. This is allowing the algorithm to create smoother, more realistic edges.
Applications of Shadow Mapping
Autodesk Maya and some other 3D software like Blender3D are there. These 3D design software use a combination of shadow map and ray tracing algorithms to generate realistic shadows.
Maya offers both software and hardware renderers, with the hardware renderer relying on the graphics card's computing power. Maya's ability to combine different shadowing techniques allows it to create fast, high-quality shadows in both interactive and final renders.
Conclusion
In this chapter, we explained the techniques for rendering shadows in 3D graphics. We covered the importance of shadows in creating realistic scenes. Then, we discussed the shadow volume algorithm, its real-time applications, and how it accurately handles complex shadowing scenarios.
Next, we covered projection shadows, an early shadowing technique that is fast but limited to planar surfaces. We also looked at the shadow mapping technique, which efficiently handles a variety of objects and surfaces, and examined improvements like silhouette maps.