povray
povray copied to clipboard
Port of FS183 - cutaway_textures broken with child unions
http://bugs.povray.org/task/183
Details:
When using cutaway_textures in a CSG object that has union children, results are not as expected; instead, surfaces in the union children that have no explicit texture will be rendered with the default texture instead. This is not the case for e.g. difference children.
Example:
#default { texture { pigment { rgb 1 } } }
camera {
right x*image_width/image_height
location <0,1.5,-4>
look_at <0,1,0>
}
light_source { <500,500,-500> color rgb 1 }
#declare U = union {
sphere { <0,-0.1,-1>, 0.3 }
sphere { <0, 0.1,-1>, 0.3 pigment { color red 1 } }
}
intersection {
sphere { <0,0,0>, 1 pigment { color green 1 } }
object { U }
cutaway_textures
rotate y*90
}
When declaring U as an intersection instead, the results are as expected, with the surface of the first sphere in U being rendered with the texture defined in the outer intersection.
Comments:
Comment by Michael Sander (SolarMike) - Thursday, 30 December 2010, 02:03 GMT+5
I have taken a first attempt at looking at (and building) the source. So far what I have found is that it seems the default texture has been applied to the union object without a texture. When the final texture is evaluated, the texture is non-null and so treats that as an applied texture. The object gets this texture when line 9383 of parse.cpp (beta 41) is executed. I tried changing the logic around this statement from an OR to an AND and my test rendering came out correct (though this could easily not be the correct solution.)
Cheers, Mike
Comment by Christoph Lipka (clipka) - Thursday, 30 December 2010, 04:35 GMT+5
A solution actually exists already, but backward compatibility issues are still to be solved, so it won't be implemented in 3.7.0.
Comment by Michael Sander (SolarMike) - Thursday, 30 December 2010, 10:03 GMT+5
Thanks Christoph. :)
Does this solution exist anywhere I can get a hold of it? I very much appreciate the efforts you have put in.
Comment by Michael Sander (SolarMike) - Thursday, 30 December 2010, 10:23 GMT+5
Actually, this is no longer a pressing issue for me as my parts are rendering correctly with my change.
Thanks again, Mike
Comment by Grimbert Jérôme (Le_Forgeron) - Saturday, 21 May 2011, 21:39 GMT+5
Testing again (3.7RC3)
- intersection gives a yellow surface (green+red) with cutaway_textures (I find it strange)
- union gives a white surface (which is not the color of first item in intersection, so cutaway is useless)
- difference gives a green surface (which is ok)
Adding an explicit pigment at the intersection (instead of the first member):
- union gives a green surface (kind of ok)
- intersection too (ok also)
- difference is ok too.
Comment by Christoph Lipka (clipka) - Monday, 30 May 2011, 14:44 GMT+5
Did I mention already that, although a solution does exist, it's not bound for 3.70? Consequently it's no surprise that 3.7RC3 still gives unexpected results ;-)
See too issue #196.
Someone should check whether the mentioned solution has already found its way into the v3.8 branch.