Part 4: Texture, Normal and Bump Mapping & Perlin Noise
The fourth part of the ray tracer is all about textures. For this part, the following features are introduced: 1. Texture Mapping In this version of the ray tracer, three types of textures ( Image , Perlin and Checkerboard textures) are supported. For this reason, I decided to implement a base Texture class, and three derived classes called ImageTexture , PerlinTexture and CheckerboardTexture . For texture mapping, there are several options for using the color value obtained from the texture: - Replace all: Disable all shading computations and just paste the texture color on the object. - Replace kd: Normalize the color value obtained from the texture to [0,1] range and use it as the diffuse reflectance constant (kd) directly. - Blend kd: Normalize the color value obtained from the texture to [0,1] range and take the average of the obtained value and the provided diffuse reflectance constant (kd). Use this value as the new kd. - Replace backgroun...