What is parallax mapping?
Parallax mapping is a technique that adds depth and detail to textured surfaces for computer-generated graphics.
Parallax mapping is a popular tool for creating the illusion of surface detail without adding extra polygons to a 3D model. This technology allows textures to reveal irregularities, like bumps and dents, when viewed from different angles.
Parallax mapping 101.
What is a parallax map?
A parallax map is a type of texture that explains the depth or height of a surface’s details — similar to a topographic map.
For example, if you’re looking at a 3D graphic of a brick wall, it looks flat without special effects. But parallax mapping makes the brick wall look more realistic by adding recessed grout lines to the flat image. This technology “tricks” the eye by manipulating textures to look three-dimensional in a 2D space.
This technology has so many applications, including:
- Video games
- Films and animation
- Virtual reality and augmented reality
- Web design
The basics of depth perception.
Your eyes and brain work together to process visual information and perceive depth. Your brain determines depth with binocular cues, which compare each eye’s images to create a cohesive image. This helps you to judge depth.
But we can also judge depth with just one eye, thanks to monocular cues. Perspective, shadow, relative size and texture gradients tell your brain important information about depth.
Parallax mapping works because of how the human brain perceives depth. As you move, closer objects shift more than distant ones. Parallax mapping uses this principle to make object textures change in response to your angle, which simulates the depth your brain expects to see.
For example, when riding in a car, nearby trees seem to zip by quickly, while distant mountains move slowly. This difference in motion gives you a sense of depth. Parallax mapping mimics this experience by making close details move slightly more, giving the illusion of depth on a flat surface.
Parallax textures.
Parallax textures are also called height or displacement maps. These are grayscale images where the shades of grey represent the height of surface details. A lighter shade is for raised areas, while darker shades are for lower areas.
These textures make it possible to add depth to otherwise flat surfaces without adding more polygons. This makes visuals more realistic without compromising on speed or load times.
Parallax mapping uses textures to reference how each part of the main texture should change based on the viewer’s angle. The map’s algorithm interprets the grayscale values of the parallax texture to create a more realistic image.
Creating parallax textures.
To generate a parallax texture:
- Start with a base image. This is a flat texture image of the surface you want to replicate, such as bricks, tiles or stone.
- Determine the height. Visualise which parts of the texture should be raised and recessed.
- Put it in grayscale. Use a graphics editor to paint the areas with shades of grey — light for raised areas and darker for recessed areas.
- Refine the design. Blur and contrast the texture to make smoother transitions between all areas.
You don’t need to do this manually, either. Adobe Photoshop comes with tools for creating and refining grayscale images. Adobe Substance 3D is a more advanced tool for creating parallax textures in just a few clicks.
Parallax mapping techniques.
How parallax mapping works.
Parallax mapping works on several underlying principles:
- Texture offset. Parallax mapping works by offsetting texture co-ordinates. It shifts where the texture samples are based on the viewer’s perspective to create the illusion of depth.
- Height and displacement maps. Parallax mapping uses a grayscale map to guide the degree of texture offset.
- Viewing angle. The parallax mapping effect changes based on the angle where you view the surface. As the angle changes, the offset adjusts to simulate a 3D surface.
Imagine you’re looking at an open book. Each page represents a layer of depth in a texture. You’d see each page clearly if you look straight down at the book at a 90-degree angle. But if you tilt the book, the pages closer to you will cover the pages that are further away. Parallax mapping simulates this effect on 2D textures using a height map to dictate which textures are closer or further away from you.
Step-by-step parallax mapping guide.
Parallax mapping is an advanced technique, but tools like Substance 3D make it easy. Follow these tips to get started as a beginner:
- Start with a texture. This could be a brick wall, cobblestone path or a tile floor.
- Create a height map. Use software like Photoshop to convert the texture to grayscale.
- Use a graphics engine. Most graphics engines, like Unity, support parallax mapping. Import your main texture and the height map.
- Apply parallax mapping shader. Assign a shader or materials to add parallax mapping to your texture and link it to your height map.
- Adjust parameters. Adjust the intensity of the parallax effect to get the desired illusion of depth.
- View from different angles. Move your camera around to see how the texture adjusts as you change angles.
These are quick tips to get you started, but don’t be afraid to experiment with parallax mapping on your own.
Benefits of parallax mapping.
There are many benefits of parallax mapping, including:
- Enhanced realism. Parallax mapping gives images a more tactile look to simulate real-world user experiences.
- Emotional immersion. Improved realism has an impact on storytelling for games and animations, bringing stories to life.
- Optimised performance. Parallax mapping adds depth by manipulating textures instead of adding more polygons. It renders much more quickly, which is helpful for real-time applications like video games.
Practical applications.
Parallax mapping is useful for a variety of applications, such as:
- Video games, including virtual reality
- Architectural models
- Product visualisation for manufacturers and retailers
From flat to 3D: parallax mapping in Substance 3D.
Parallax mapping revolutionised everything from video games to web design. This technology breathes life into designs and adds much more detail to flat 2D images.
The best way to see the power of parallax mapping is to try it out in your own designs. Try Adobe Substance 3D to create stunning, intricate graphics that jump off the screen.
Frequently Asked Questions
WHAT IS THE DIFFERENCE BETWEEN BUMP AND PARALLAX MAPPING?
Both techniques simulate depth on a surface without adding extra geometry. However, bump mapping uses grayscale bump maps to simulate the highs and lows of a texture, which affect how it reflects light. Bump mapping appears flat when you look at it from an angle.
Parallax mapping goes further by offsetting texture co-ordinates based on the viewer’s perspective. This gives more depth to textures.