@@ -164,12 +164,12 @@ def _convert_lamp_color_animation(self, name, fcurves, lamp, start, end):
164164 self ._exporter ().report .warn ("Cannot animate Lamp color because neither Diffuse nor Specular are enabled" )
165165 return None
166166
167- # OK Specular is easy. We just toss out the color as a point3 .
167+ # Specular must be converted to sRGB space (gamma correction) .
168168 def convert_specular_animation (color ):
169169 if lamp .use_negative :
170- return map (lambda x : x * - 1.0 , color )
170+ return map (lambda x : - pow ( x , 1 / 2.2 ) , color )
171171 else :
172- return color
172+ return map ( lambda x : pow ( x , 1 / 2.2 ), color )
173173 color_keyframes , color_bez = self ._process_keyframes (color_curves , 3 , lamp .color ,
174174 convert = convert_specular_animation ,
175175 start = start , end = end )
@@ -183,10 +183,11 @@ def convert_specular_animation(color):
183183
184184 # Hey, look, it's a third way to process FCurves. YAY!
185185 def convert_diffuse_animation (color , energy ):
186+ # Remember to convert the color to sRGB.
186187 if lamp .use_negative :
187- proc = lambda x : x * - 1.0 * energy [0 ]
188+ proc = lambda x : - pow ( x * energy [0 ], 1 / 2.2 )
188189 else :
189- proc = lambda x : x * energy [0 ]
190+ proc = lambda x : pow ( x * energy [0 ], 1 / 2.2 )
190191 return map (proc , color )
191192 diffuse_channels = dict (color = 3 , energy = 1 )
192193 diffuse_defaults = dict (color = lamp .color , energy = lamp .energy )
0 commit comments