jtobler / flam3

Automatically exported from code.google.com/p/flam3
0 stars 0 forks source link

Background color of fractal incorrect #6

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?  =============
1. Pick  a background color like orange: "255 128 64"

What is the expected output? What do you see instead? ================
You should see that color as the background color. Instead I get white as the 
rendered background color.

If I set white as the background color, I see white, but much of the fractal is 
overlaid with white. (You can see the non-background areas of the fractal by 
specifying a transparent render.)

If I set black as the background color, the render shows the correct result.

What version of the product are you using? On what operating system? ===========
flam3-render version 3.0.0
Mac OS X

Please provide any additional information below. =================
Analysis: the following lines of code in rect.c lines 1072 - 1074 cause the 
error:
Change:
      background[0] /= vib_gam_n/256.0;
      background[1] /= vib_gam_n/256.0;
      background[2] /= vib_gam_n/256.0;
To:
      background[0] /= vib_gam_n;
      background[1] /= vib_gam_n;
      background[2] /= vib_gam_n;

The original code caused background color values 256 X larger than they should 
have been. Those values were then clipped to 255. (that is why an orange 
background became white and also explains why
when the background color was set to white, the white background overlaid a lot 
of the fractal
[alpha blending a very BIG number with the fractal colors caused the colors to 
overflow and be clipped as white].
It also explains why a background color of black worked properly.  0 X 256 => 0

I tested with my own copy of the code and this change fixed the bug.

Original issue reported on code.google.com by centcomf...@gmail.com on 13 Feb 2011 at 5:49

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for the report.  The bug was in the documentation :)  The background 
color should be 3 floats in 0-1.0.  I updated the wiki on the XML format.

Original comment by scottdra...@gmail.com on 13 Feb 2011 at 10:59

GoogleCodeExporter commented 8 years ago
Thanks for letting me know. Version 3.0 has been very stable and has been 
working well for me.

Original comment by centcomf...@gmail.com on 14 Feb 2011 at 10:21