I noticed that when you have an object inside a transparent object, the
interior object isn't visible.
OK, so the preview handling of transparency isn't "real", that must be
just one of its artifacts.
But then I realized that # and % don't have this issue; an object inside
a #object or a %object is visible.
color("gray", alpha=0.5) sphere(20);
cylinder(h=50,d=20,center=true);
translate([50,0,0]) {
#sphere(20);
cylinder(h=50,d=20,center=true);
}
translate([100,0,0]) {
%sphere(20);
cylinder(h=50,d=20,center=true);
}
Apparently # and % are transparent in a different way than
color(alpha=xxx) is transparent. Perhaps color(alpha=xxx) could be fixed?
(I'm happy to look into this myself, eventually, but I figured maybe
somebody else was already deeply familiar with the OpenCSG interface and
artifacts.)
Alpha channel in color() is very dependent on part ordering. Parts made after the part with the alpha channel will not show through the transparency. Only parts made before the transparent part show through.
The # and % modifiers, however, are not just setting a color with a transparency… they are also causing those parts to be rendered after everything else. That means everything else shows through them.
On Jan 10, 2021, at 9:59 PM, Jordan Brown openscad@jordan.maileater.net wrote:
I noticed that when you have an object inside a transparent object, the interior object isn't visible.
OK, so the preview handling of transparency isn't "real", that must be just one of its artifacts.
But then I realized that # and % don't have this issue; an object inside a #object or a %object is visible.
color("gray", alpha=0.5) sphere(20);
cylinder(h=50,d=20,center=true);
translate([50,0,0]) {
#sphere(20);
cylinder(h=50,d=20,center=true);
}
translate([100,0,0]) {
%sphere(20);
cylinder(h=50,d=20,center=true);
}
<nepfofljkeebpjoh.png>
Apparently # and % are transparent in a different way than color(alpha=xxx) is transparent. Perhaps color(alpha=xxx) could be fixed?
(I'm happy to look into this myself, eventually, but I figured maybe somebody else was already deeply familiar with the OpenCSG interface and artifacts.)
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I think that the difference is that the transparent object is being booleaned, and thus OpenCSG thinks that it should be obscuring the other object. The Z-buffering code in question is not aware of the alpha value. The % and # modifiers create a separate object tree to display the transparent objects that is not booleaned with object in the main "solid" tree (though in the case of the # modifier, there is another copy in the "solid" object tree).
It is interesting to note that you can still apply color to objects using the % modifier (even making them look like solid objects), but they won't be added to the main object tree. In some cases, when you're trying to visualize/animate complex interaction and never actually need to do a CGAL render, this sometimes makes it possible to speed up previews (while producing the same visual results) by skipping slow and unnecessary implicit unions.
On Jan 10, 2021, 22:00 -0800, Jordan Brown openscad@jordan.maileater.net, wrote:
I noticed that when you have an object inside a transparent object, the interior object isn't visible.
OK, so the preview handling of transparency isn't "real", that must be just one of its artifacts.
But then I realized that # and % don't have this issue; an object inside a #object or a %object is visible.
color("gray", alpha=0.5) sphere(20);
cylinder(h=50,d=20,center=true);
translate([50,0,0]) {
#sphere(20);
cylinder(h=50,d=20,center=true);
}
translate([100,0,0]) {
%sphere(20);
cylinder(h=50,d=20,center=true);
}
<nepfofljkeebpjoh.png>
Apparently # and % are transparent in a different way than color(alpha=xxx) is transparent. Perhaps color(alpha=xxx) could be fixed?
(I'm happy to look into this myself, eventually, but I figured maybe somebody else was already deeply familiar with the OpenCSG interface and artifacts.)
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
On 1/10/2021 10:10 PM, Revar Desmera wrote:
Alpha channel in color() is very dependent on part ordering. Parts
made after the part with the alpha channel will not show through the
transparency. Only parts made before the transparent part show through.
Aha! (And now that you say that, I think I might have asked about it
before.)
Thanks.
The # and % modifiers, however, are not just setting a color with a
transparency… they are also causing those parts to be rendered after
everything else. That means everything else shows through them.
Makes me wonder whether color(alpha=xxx) could do the same thing. But
that's more than just tweaking some parameter.
And, Whosawhatsis, thanks for the tip on coloring %objects.