Feature: Texture

External libraries:
No further libraries than nori-framework has been used to complete this task.
Time spent:
6:00 (approximately)
Acknowledgements:
  • Physically Based Rendering 2010
Files:
  • include/nori/mipmap.h (new)
  • src/mipmap.cpp (new)
  • src/imagetexture.cpp (new)

Architecture

To save the textures, for each a mip-map is generated. (the same way as for the environment emitter: go there). Then a new texture-class has to be generated which holds this mip-map and evaluates it when the texture is evaluated. Basically it is the exact same approach as for any existing texture, except now the uv-coordinate is used to lookup the texel in the mip-map.

XML

Texture-type: "texture_color"

Following properties will be available for the texture to add the texture:

filename
Path to the file which contains the texture to apply to the BSDF.
scale
2D-Point which contains the scaling factor for the x (u, s) and y (v, t) axis of the texture. The meaning is: scale > 1, the texture shrinks and is repeated., whereas scale < 1 makes the texture bigger.
toWorld
Transformation to transform the coordinates accordingly.

Implementation

Texture: Image (src/imagetexture.cpp)

class ImageTexture

When the texture is created, the bitmap is loaded based on the specified image-name in the xml. Then the mip-map is created and stored on the class. For each evaluation of the uv-coordinate, the mip-map is used to decide which color the texture has on this coordinate.

Texture-Images

Ball textures

I could download the basic image-files for each ball from this website: www10.sharecg.com. Based on this I created all the needed textures with Photoshop. So I merged for example the numbers with the apple-texture to let the apple appear like an apple but still like a billiard-ball.

Walnut/Apple

The pictures for these textures I got also from the internet. The walnut I found on photl.com and the apple on deviantart.com. Also these images I had to edit to fit into the final picture as I wanted them.

Billiard-table

To get the textures, I downloaded this model. However, I simply used the textures of this, but not the model.

Environment-maps

Unfortunately I did not copy the link to this when I first downloaded them. But I found them on google. For the final image, I also downloaded the disney-castle and put it on the environment map to have it rendered on the mirror-sphere.

Validation

Texture of a sphere

ball 07 ball 15

Rotating texture of a sphere

rotated 07 rotated 15

Scaling texture of a sphere

This pictures are drawn by my girlfriend and wanted to try them out.

No scaling Scaling (1,2)
No scaling Scaling (4,4) Scaling (1,4)