Saturday, February 16, 2013

Ray Tracer Part 7 - Tone Reproduction

For the final part of the Ray Tracer, Tone Reproduction, using Reinhard and Ward Compression techniques, were implemented.

Ward Compression

Ward, 1 nit
Ward, 10 nits


Ward, 100 nits
Ward, 1000 nits


Reinhard Compression

This portion I've had a lot of issues with. I realize that in Reinhard, the Max Luminance is supposed to have very little (if any) effect on the luminance of the scene.  Unfortunately, I can't find where in my code this seems to go wrong. The equations seem almost identical to me, and I'm simply at a loss. Instead, I got these interesting images.

My code was as follows (per pixel):
// Part A of Compression            
pixels[y][x].l_red = ( kv * pixels[y][x].l_red ) / log_avg_lum;            
pixels[y][x].l_green = ( kv * pixels[y][x].l_green ) / log_avg_lum;            
pixels[y][x].l_blue = ( kv * pixels[y][x].l_blue ) / log_avg_lum;    
       
// Part B of Compression            
pixels[y][x].l_red = ((pixels[y][x].l_red)/ (1 + pixels[y][x].l_red)) *ld_max; pixels[y][x].l_green = ((pixels[y][x].l_green)/ (1 + pixels[y][x].l_green)) * ld_max;            
pixels[y][x].l_blue = ((pixels[y][x].l_blue)/ (1 + pixels[y][x].l_blue))*ld_max;

// Apply Device Model            
pixels[y][x].l_red = pixels[y][x].l_red / ld_max;            
pixels[y][x].l_green = pixels[y][x].l_green / ld_max;            
pixels[y][x].l_blue = pixels[y][x].l_blue / ld_max;            

// Print Point to Screen            
glColor3f( pixels[y][x].l_red, pixels[y][x].l_green, pixels[y][x].l_blue ); glVertex2d( x, y );

Reinhard, 1 nit
Reinhard, 10 nits


Reinhard 100 nits
Reinhard 1000 nits

Reinhard, with different Key-Value pixel selection

I was still able to use a key-value pixel selection for this, which showed a little better effect. All pictures were taken with a Lmax of 1, to simulate if my Reinhard above was working properly.


Reinhard, Key Value at x=400 y=400
Reinhard, Key Value at x=100 y=100


Reinhard, Key Value at x=250 y=250

No comments:

Post a Comment