1// Persistence Of Vision Ray Tracer Scene Description File
2// -------------------------------------------------------
3// File: @(#)tone_mapping.pov
4// Description: Demonstrates the tone mapping feature
5// Features demonstrated: tone mapping
6// Creation Date: $ 27 Feb 2005, 12:05:22 $
7// Last modified: $ 14 Mar 2005, 20:59:01 $
8// Author: Christoph Hormann <chris_hormann@gmx.de>
9//
10// Render instructions:
11// --------------------
12//
13// To render the different tone mapping settings use something like:
14//
15// -w320 -h240 +a0.3 -j +kff7
16//
17// you can try different aa settings to see the effect on antialiasing
18
19#version unofficial megapov 1.2;
20
21
22#include "tone_mapping.inc"
23
24global_settings {
25	max_trace_level 10
26	assumed_gamma 1
27
28	radiosity {
29		pretrace_start 0.08
30		pretrace_end 0.01
31		count 320
32
33		nearest_count 5
34		error_bound 0.5
35		recursion_limit 1
36
37		low_error_factor .5
38		gray_threshold 0.0
39		minimum_reuse 0.015
40		brightness 1.0
41		media on
42	}
43
44	#declare Exposure=1.6;
45	#declare Exposure_Gain=1.0;
46
47	#switch (frame_number)
48
49		#case (0) #warning "Use '+kff7 to render all versions of this scene"
50		#case (1)                       // no (linear) mapping
51			tone_mapping {
52				function { x }
53			}
54		#break
55		#case (2)                       // clipping
56			tone_mapping {
57				function { min(1, x) }
58			}
59			// predefined macro in tone_mapping.inc:
60			//Clip_Colors()
61		#break
62		#case (3)                       // exponential exposure
63			tone_mapping {
64				function { Exposure_Gain - exp( -Exposure * x ) * Exposure_Gain }
65			}
66			// predefined macro in tone_mapping.inc:
67			//Film_Exposure(Exposure, Exposure_Gain)
68		#break
69		#case (4)                       // exponential exposure with inversion
70			tone_mapping {
71				function { Exposure_Gain - exp( -Exposure * x ) * Exposure_Gain }
72				inverse function { - ln(1 -min(0.9999, x/Exposure_Gain)) / Exposure }
73			}
74			// predefined macro in tone_mapping.inc:
75			//Film_Exposure_Invert(Exposure, Exposure_Gain)
76		#break
77		#case (5)                       // exponential exposure with numerical inversion
78			tone_mapping {
79				function { Exposure_Gain - exp( -Exposure * x ) * Exposure_Gain }
80				inverse 1000
81			}
82		#break
83		#case (6)                       // inversion
84			tone_mapping {
85				function { 1 - min(1, x) }
86			}
87		#break
88		#case (7)                       // brightness/contrast adjustment
89			Brightness_Contrast(-0.3, 0.8)
90		#break
91	#end
92
93}
94
95camera {
96	location    <-0.95, 0.5, 0.4>
97	direction   y
98	sky         z
99	up          z
100	right       (4/3)*x
101	look_at     <0, 0, -0.1>
102	angle       76
103}
104
105light_source {
106	<3, 5.1, 2>*100000
107	color rgb <2.0, 1.5, 1.0>*10
108}
109
110light_source {
111	-0.3*z
112	color rgb <0.3, 0.5, 1.2>*10
113	fade_power 2
114	fade_distance 0.5
115}
116
117sky_sphere {
118	pigment {
119		color rgb <0.6,0.7,1.0>*2
120	}
121}
122
123#declare Tex_Env=
124			texture {
125				pigment { color rgb <1.0, 0.95, 0.85> }
126				finish { ambient 0.0 diffuse 0.65 }
127			}
128
129#declare Tex_Obj=
130			texture {
131				pigment { color rgb <0.4, 0.5, 1.0> }
132				finish { ambient 0.0 diffuse 0.6 }
133			}
134
135#declare Window_Size=0.3;
136
137difference {
138  box { -1.2, 1.2 }
139	box { -1.0, 1.0 }
140	box { <-2, -Window_Size, -Window_Size>, <2, Window_Size, Window_Size> }
141	box { <-Window_Size, -2, -Window_Size>, <Window_Size, 2, Window_Size> }
142	box { <-Window_Size, -Window_Size, -2>, <Window_Size, Window_Size, 2> }
143	texture { Tex_Env }
144	hollow on
145}
146
147difference {
148	sphere { 0, 0.45 }
149	sphere { 0, 0.4 }
150	cylinder { -z, z, 0.1 }
151	cylinder { -x, x, 0.1 }
152	cylinder { -y, y, 0.1 }
153
154	cylinder { -1, 1, 0.1 }
155	cylinder { <-1, -1, 1>, <1, 1, -1>, 0.075 }
156	cylinder { <-1, 1, -1>, <1, -1, 1>, 0.075 }
157	cylinder { <1, -1, -1>, <-1, 1, 1>, 0.075 }
158
159	cylinder { < 1,  1, 0>, <-1, -1, 0>, 0.05 }
160	cylinder { < 1, -1, 0>, <-1,  1, 0>, 0.05 }
161	cylinder { <-1,  1, 0>, < 1, -1, 0>, 0.05 }
162
163	cylinder { < 1, 0,  1>, <-1, 0, -1>, 0.05 }
164	cylinder { < 1, 0, -1>, <-1, 0,  1>, 0.05 }
165	cylinder { <-1, 0,  1>, < 1, 0, -1>, 0.05 }
166
167	cylinder { <0,  1,  1>, <0, -1, -1>, 0.05 }
168	cylinder { <0,  1, -1>, <0, -1,  1>, 0.05 }
169	cylinder { <0, -1,  1>, <0,  1, -1>, 0.05 }
170
171	translate -0.3*z
172	texture { Tex_Obj }
173	hollow on
174}
175
176
177box {
178	-1.3, 1.3
179	pigment { color rgbt <1,1,1,1> }
180	interior {
181		media {
182			scattering { 5, 0.05 eccentricity 0.55 extinction 0.75 }
183			method 3
184			intervals 1
185			samples 10
186			aa_level 3
187			aa_threshold 0.05
188		}
189	}
190	hollow on
191}