Bump mapping is a family of techniques that utilize special textures to present more details on the object surface, in addition to the plain diffuse color. Here I'll implement the most common ones with a simple set of assets. Note that some of them can be combined to achieve better results.
I'm not going to explain these concepts, but since the terminologies might be used differently in other contexts, I'll give some brief clarifications below.
Assets
- Diffuse texture: rgb is the intrinsic diffuse color
- Normal texture: rgb is the surface normal vector
- Heightfield texture: r/g/b is the height value (in this example they are depth values)
Mapping methods
- Normal mapping: read the normal value from the normal texture in fragment shader
- Displacement mapping: read the heightfield texture in vertex shader and displace the z values of object geometry
- Parallax mapping: offset the texture coordinate in fragment shader with simple trigonometry
- Relief mapping (a generic term for parallax relief mapping, parallax occlusion mapping and steep parallax mapping): offset the texture coordinate in fragment shader, with offset calculated by approximation of the intersection between view ray and surface using multi-layer samples along the ray
References
- Real-Time Rendering 3rd edition Chpts. 6.7
- LearnOpenGL - Parallax Mapping