Feature: Texture Mirror

External libraries:
No further libraries than nori-framework has been used to complete this task.
Time spent:
1:00 (approximately)
Acknowledgements:
  • -
Files:
  • src/mirror.cpp (updated)

Idea / Architecture / Implementation

I made a little trick (maye also hack) for the final image. I wanted to print the numbers on the spheres which are mirrors. Therefore, I created a new class "mirror_mask", which allows me to add an alpha-image and albedo-image to the mirror-behaviour. It simply behaves exactly as a mirror when the mask has the value 0 at the given uv-coordinate (intersection) by returning simply the same values in the pdf and eval as the normal mirror. However, when the alpha-value is not 0, the color of the albedo is returned. It actually works pretty well and fullfils exactly my intention, to print the numbers on the mirror-spheres.

XML

Texture-type: "mirror_mask"

Basically exactly the same as the checkerboard, but with one value more:

alpha
Texture which holds the alpha-chanel. All non-zero-values are used to blend in the texture defined in texture.
albedo
The texture which is used to return when the alpha-value is non-zero.

Validation

Texture on a mirror-sphere

Textured mirror

Alpha texture which has been used for the above rendering

Important: the bright disk on the top is from the light source which is above the ball.

Textured mirror