32. What Does a Sample Point Mean? What happens when this pixel is evaluated? Given a set of parameters interpolated from the triangles 3 vertices, how do we go about generating a color?
33. Texture Filtering Review A (1-A) B (1-B) Sample Color = A*B * + A*(1-B) * + (1-A)*B * + (1-A)*(1-B)* +
36. A common hack: Level of Detail MIP Level By lowering the amplitude Of the displacement, effectively decreasing to a less complex model as the model moves further away. This will prevent aliasing, but isn’t accurate
43. Texture Space Lighting Rasterize triangles using texture coordinates as positions, the left image is the normal sampled at each point, and the right image is the computed lighting
46. A roadway, snapshots We can see Moiré patterns on any filtered non linear functions. Additionally, temporal aliasing becomes problematic.
47. Using TSL The artifacts are largely mitigated if we render the non linear function and MIP reduce. We can also see more high frequency detail.
48.
49. The Shader void lightPositional( …) { // norm, light and half are in tangent space // power, Kd, Ks and norm come from textures … //normalized blinn phong float fS = pow ( saturate ( dot (norm, half)), power)) * power; float fD = saturate ( dot (norm, light)) * diffuseIntensity; vColorOut.xyz = fS * Ks + fD * Kd; vColorOut.a = 1; //put us in gamma space for the direct rendering only if (bTextureView) vColorOut = sqrt (vColorOut); }
50. Pasting the texture on the Scene void light_from_texture( float2 vTexCoord: TEXCOORD0, out float4 vColorOut: COLOR0 ) { // this is done with full anisotropy turned on // with SRGBTexture set to true vColorOut = tex2D (LightMapSampler, vTexCoord); //for atlased objects, we do not want to blend in // unrendered pixels if ( vColorOut.a > 1e-5 ) vColorOut.xyz /= vColorOut.a; //put us in gamma space vColorOut = sqrt (vColorOut); }
59. A simple non linear function The Blinn-Phong lighting model is one of the most common half angle based lighting functions. The above is a normalized version , that is the total emitted energy is close to constant for any power. This model is parameterized by N, Kd, Ks, and p. Changing these values changes the properties of the underlying surface
60. A common approach The image on the left is lit with MIP maps fading to flat, while the image on the right is what the image would look like if rendered at a higher resolution and scaled down. The objects do not physically look the same.
61. A more correct MIP map The images in the middle were rendered directly to the screen using a BRDF approximating MIP map. The more we zoom out, the larger the difference between the correct and incorrect approaches
62. Examining a mip level – simple 32 32 32 32 32 Next MIP Level – same thing
63. Examining a mip level 8 45 16 25 25 Next MIP Level, Average Power?
64. Examining a MIP level 32 32 32 32 32 Next MIP Level, Average power, normal?
68. Reflectance at a single texel Ks = .02, P = 30 Ks = .02, P = 30 Ks = .02, P = 24 Ks = .01, P =30 Ks = ???, P = ??? (?,?,?) For a given light and view direction, how do we pick a Ks, a Power and Normal so that we get the same final color? MIP Level 0 MIP Level 1
69. Solving for a single patch of texels For a given patch of texels w wide and h tall: Where,
70. We care about all pairs of L and V Creating an error function for a single pair of L and V: Need to find the minimum error across all possible V and L
71.
72.
73.
74. Non linear with Blinn Phong With the Blinn-Phong BRDF, the error plot shows that the function is mostly smooth. As long as we take a guess in the dark region, we should be fine. Graph is log(1 + error) power Ks