Elevating Raven: Texture Mapping
Hi everyone, welcome to the fourth blog of my ray tracing journey. In this assignment, I have implemented texture mapping features in Raven. These enhancements include support for diffuse, normal, and bump mapping using image-based textures. In addition to handling image textures, Raven can generate procedural textures, such as Perlin noise and checkerboard pattern.
Dragon Scene rendered in 1.2 sec |
Implementation
I started to implement a Texture base class, then derived three classes, ImageTexture, PerlinTexture, and CheckboardTexture, from it. After that, I updated my parser to handle the newly introduced parameters, Textures, TextureMap; Interpolation, Decal modes etc..
- Replace All: Ignore shading and simply map the texture color directly onto the object’s surface.
- Replace kd: Use the texture value as kd value.
- Replace ks: Use texture value as ks value. (Unfortunately, I couldn't manage my time to implement it. Although it is not hard to implement, I was unable to do it. 😑. I will add it in the next homework.)
- Blend kd: Equally mix the existing material kd value with the one that comes from the texture.
- Replace Background: This texture defines the background texture of the scene.
- Replace Normal: Use the texture for normal mapping
- Replace Bump: Use the texture for bump mapping
For ImageTextures, two interpolation methods, Nearest Neighbor and Bilinear, are supported.
In addition to ImageTexture, PerlinTexture is also supported. I implemented PerlinNoise as a separate class from PerlinTexture, and PerlinTexture objects contain an instance of PerlinNoise. To generate PerlinNoise, I used the techniques discussed during the lectures. Then, CheckboardTexture is implemented according to given instruction in the homework guideline.
Then, I have integrated the stb library for image reading.
Cube Wall Scene rendered in 28ms |
I encountered an issue with the Bump Normal in scenes involving transformations. When transformation occurs in Meshes, the bump mapping doesn’t work, but it functions correctly in scenes Spheres. This is the only problem I was unable to resolve in HW4.
This past week has been particularly challenging for me, and I struggled to manage my time effectively to complete HW4 on schedule. As a result, I used one late day.
Regarding the assignment, I encountered an issue with bump normals in scenes involving transformations on meshes. Despite my efforts, I have not yet found a solution to this problem, but I plan to address it in HW5.
Additionally, I was unable to implement specular mapping due to time constraints. Although the implementation is relatively straightforward, I could not prioritize it this week and will include it in HW5.
Comments
Post a Comment