CST 325 - Graphics Programming (Week 7 and 8)
Shadow Mapping & Final
Concepts
- Path tracing: realistic shadows appear naturally as a consequence of the algorithm. Hard shadows have path tracing straightforward.
- Two main approaches: volume – based, image – based.
- Volume based: used by many from 2000 to 2010. It extrudes polygons away from light source. Since its polygon based, it has problem with geometries that have lots of mesh.
- Image based: also known as shadow mapping since 2006, and it is pixel-based. The algorithm involves comparing the distance from the light perspective to create a shadow map and store in the texture.
- Shadow mapping: Computing the shadow mapping ranges from -1 to 1 and redistribute it to 0 to 1 range for color. Use the light as a camera to create a projection matrix and get clip space coordinated. Divide by W to get coordinates and distance Z to do the comparison.
- Problems: aliasing (blocky shadows) and surface acne that looks like the shadow goes in and out repeatedly. Another problem is byproduct of reprojection, which can be solved by adding bias offset or increase shadow map’s resolution. However, adding too much bias can result in peter panning (the shadow drifts away).
Application
The
final project was surely overwhelming but also fun, allowing room for me to be
creative. At the beginning, I was struggled with given code from gltf-viewer since
it is different from the json geometry I used to work with. I remained calm and
worked one by one, starting with the skybox. In order to use the json files and
the geometries correctly, I had to play around and observe the objects’
behaviors. Of course, the problem started when involving the gltf-viewer,
causing many errors. Even though Professor updated the file and solved the
problem, I felt proud for finding a temporary resolution to load the models
with gltf-viewer.
The
problem piled up one after another when I kept working on the project. In the
end, I managed to solve them, and there are two most notable moments. One is
when I had to read through gltf-viewer, the models’ scene file in order to load
the texture and emissive correctly. To my surprise, I managed to add or change
some lines of code to achieve my desire (with explanation from ChatGPT as
well). Previously, when facing with overwhelm files with lots of code like
these, I tend to leave them be and use what I need (some functions). But now I
gain more confidence with reading, understanding and manipulating the files to
do what I desire.
Another
moment is when I was working with creating the algorithm for randomizing the
missile and fighters. Complicated matrices, variables for forward direction
didn’t work as expect, utilizing the lookAt function, and many other obstacles.
I could just remove those features completely since they are extra and not
required for the project, but I decided not to. After many trials, many
approaches and countless debug, I managed to find the recipe to randomize the
objects, their directions and make them move. If I have extra time, I could
turn the whole fleet into a battle (only if the website can run it), because
the projectiles can share the algorithm of lookAt.
Last
but not least was the UI elements. Again, I could call my final project done
and move on. But I chose not to and decided to spice up the UI, since this is
the chance for creativity that I don’t want to miss. Previously, I learned from
Software Design course how to add UI through html file. But the question was
how can I make it more interesting with different shapes, colors and features.
So, I searched around, found many documents and UI website. However, there were
much new knowledge in those codes. I could simply just copy the codes but doing
so limit my creation as well. Therefore, I spent time understanding what those
codes do and applied them to my own UI elements. The results were not just
satisfied, but I felt proud to overcome the obstacles and made them my own.
After all the resources I poured into the final project, it’s hard to tell how proud I am now. It was a great time working on the project, I can tell because I was willing to spend more time and effort. Moreover, I wanted to add more features if there was more time to work with. I also shared my project’s video with my friends on Discord and Facebook many times as well. I think they are enough to prove how much this final project means to me and how proud I feel about it.
Comments
Post a Comment