Tales of Multiply Map and Gamma Correction
Using a detail map, or multiply map, on top of diffuse map is a somewhat popular way to eliminate the repeating pattern on tiled textures.
Why do different objects have different colors? It is because they absorb and reflect different spectrums of incoming light. For example, a black surface looks black because it absorbs all the spectrums, and a white surface is white because it reflects everything. Likewise, a red surface reflects red spectrum while absorbing the others.
I have been posting the English version of my Intro to Shader Programming book in this blog. I intended to publish it some years ago, but I had more important things to occupy myself. I thought it was a bit too late to publish this book, but I got lucky this time.
New HLSL in this chapter NORMAL: a shader semantic used to retrieve normal data from a vertex buffer normalize(): normalizes a vector dot(): dot product function saturate(): clamps a value to [0, 1] range reflect(): vector reflection function pow(): raises base to the power of exponent
New HLSL in this chapter float4: a vector data type with 4 components float4x4: 4 X 4 matrix data type mul(): multiplication built-in function. Can handle almost all data types POSITION: Semantic for vertex position. Useful to read only the position info from vertex data