Skip to content

Commit

Permalink
added title
Browse files Browse the repository at this point in the history
  • Loading branch information
noah-ku committed Apr 5, 2024
1 parent b392f57 commit d473ea9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions homework4.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ A shader program is a type of computer program that is designed to use the GPU i
Each shader program needs a `.vert` and a `.frag` file, which correspond to the vertex and fragment shaders respectively. Vertex shaders first work with all the vertices in the 3D space and converts the points into 2D coordinates. Some of the properties involved include modifications to the normals. On the other hand, we have fragment shaders. These types of shaders typically deal with the lighting, coloring, and texturing of the object. With both of these types of shaders, you can create a very realistic feel to the different cloth types involved. Both of these process each vertex and make a set of calculations, using the texture's lookup material and other properties like the color.
It then outputs the processed calculations with new lighting, thus creating a working shader program.

### Blinn-Phong Shading Model Explanation

We can see how this works with the Blinn-Phong example. The Blinn-Phong model is a way to quickly simulate the way light reacts to different objects using 3 basic components. The first component is the ambient lighting (`ka * Ia`) that represents a constant and basic illumination throughout all objects. The next component is the diffuse reflection (`kd * (I / r ^ 2) * max(0, n * l)`), which is dependent on the angle of the light and gives the material a more detailed look. The final component involved is the specular reflection (`ks * (I / r ^ 2) * max(0, n * h) ^ p`), which gives a mirror-like effect to the object. BY combining all these, you can get a very realistic feel
when utilizing this shader in your scene. To code this, we modified the `Phong.frag` file and used different `vec3` constants to adjust the equation. Piecing together all the components including the user input, we were able to successfully create a Blinn-Phong shader program.

Expand Down

0 comments on commit d473ea9

Please sign in to comment.