Normals1
Check your repo for the Normals1
program. Modify the surface normals to produce a wave pattern. Create your wave pattern as follows:
- Get an offset vector from the center of the object to the point of interest
- Get the distance d of this offset vector
- Once you have the distance, normalize the offset
- Compute a scale as
cos((dis*5-time)*4)
- Scale the offset by half of the scale factor
- Get a new normal as the normalized sum of scaled offset and the normal
- Color the surface with this new normal
The GLSL functions length
and normalize
will be useful.
Answer these questions:
-
Your name:
-
How many times is the vertex shader called? (check Model.h if needed)
-
What is your estimate for how many times the fragment shader is called?
-
Where should you insert your code to modify the normal? You should not modify any other files.
-
What would be the appearance if we computed reflectence over the surface with the new normals?
- What are the limitations of this method?
Once you are done, show your instructor and turn in your answer sheet.
Your solution should look similar to this: