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

Cube Wall Normal Scene rendered in 30ms

Brick Wall with Normal Map 30ms

Cube Waves Scene rendered in 43ms

Cube Cushion Scene rendered in 44ms

Sphere Perlin Scale Scene rendered in 65ms

Sphere Normal Scene rendered in 368ms

Sphere Nearest Bilinear Scene rendered in 23ms

Plane Nearest Scene rendered in 10ms

Plane Bilinear Scene rendered in 11ms

My Tap Scene rendered in 4min 18sec


Issues



I encountered an issue with bump mapping in spheres. When I use transformed rays for bump mapping, the problem is resolved. However, I couldn't achieve this with meshes, even though I applied transformed rays to the mesh.

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.


The my tap scene file contains the wrong texture file path. The path was "../textures/bathroom.jpg", but it should have been "textures/bathroom.jpg". It took many hours to identify the issue with the path.

Some Notes:
  • 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

Popular posts from this blog

Leveling Up Raven: BVH, Transformations, and Instancing

Raven: The Beginning of My Ray Tracing Journey

Enhancing Raven: Multisampling and Distribution Ray Tracing