discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

coloring model causes Z-fighting, depending on order

JB
Jordan Brown
Mon, Apr 6, 2020 2:05 AM

I thought I had the Z-fighting thing under control - make sure your
differences always exceed the thing being subtracted from; never have
the faces match.

But then after coloring a bunch of parts, I noticed Z-fighting.

It seems that if you have a face that's differenced away, it can still
sometimes cause Z-fighting with an adjacent part.

translate([0,0,-10]) cube(10);
color("blue") difference() {
    cube(10);
    translate([1,-1,-1]) cube([8,12,10]);
}

But if I just swap the order of the parts, there's no Z-fighting...

color("blue") difference() {
    cube(10);
    translate([1,-1,-1]) cube([8,12,10]);
}
translate([0,0,-10]) cube(10);
I thought I had the Z-fighting thing under control - make sure your differences always exceed the thing being subtracted from; never have the faces match. But then after coloring a bunch of parts, I noticed Z-fighting. It seems that if you have a face that's differenced away, it can still sometimes cause Z-fighting with an adjacent part. translate([0,0,-10]) cube(10); color("blue") difference() { cube(10); translate([1,-1,-1]) cube([8,12,10]); } But if I just swap the order of the parts, there's no Z-fighting... color("blue") difference() { cube(10); translate([1,-1,-1]) cube([8,12,10]); } translate([0,0,-10]) cube(10);
NH
nop head
Mon, Apr 6, 2020 7:56 AM

Yes all the negative objects are drawn and even though not visible in the
final object can cause Z fighting. When you make complex assemblies it is
impossible to ensure all the negative parts don't interact, so I always
render a 3D difference or intersection. Because that is slow I avoid 3D
difference as much as possible. For example, your blue shape could be a
linear_extruded 2D difference and then it won't Z-fight and will be fast to
draw.

On Mon, 6 Apr 2020 at 03:06, Jordan Brown openscad@jordan.maileater.net
wrote:

I thought I had the Z-fighting thing under control - make sure your
differences always exceed the thing being subtracted from; never have the
faces match.

But then after coloring a bunch of parts, I noticed Z-fighting.

It seems that if you have a face that's differenced away, it can still
sometimes cause Z-fighting with an adjacent part.

translate([0,0,-10]) cube(10);
color("blue") difference() {
cube(10);
translate([1,-1,-1]) cube([8,12,10]);
}

But if I just swap the order of the parts, there's no Z-fighting...

color("blue") difference() {
cube(10);
translate([1,-1,-1]) cube([8,12,10]);
}
translate([0,0,-10]) cube(10);


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Yes all the negative objects are drawn and even though not visible in the final object can cause Z fighting. When you make complex assemblies it is impossible to ensure all the negative parts don't interact, so I always render a 3D difference or intersection. Because that is slow I avoid 3D difference as much as possible. For example, your blue shape could be a linear_extruded 2D difference and then it won't Z-fight and will be fast to draw. On Mon, 6 Apr 2020 at 03:06, Jordan Brown <openscad@jordan.maileater.net> wrote: > I thought I had the Z-fighting thing under control - make sure your > differences always exceed the thing being subtracted from; never have the > faces match. > > But then after coloring a bunch of parts, I noticed Z-fighting. > > It seems that if you have a face that's differenced away, it can still > sometimes cause Z-fighting with an adjacent part. > > translate([0,0,-10]) cube(10); > color("blue") difference() { > cube(10); > translate([1,-1,-1]) cube([8,12,10]); > } > > > But if I just swap the order of the parts, there's no Z-fighting... > > color("blue") difference() { > cube(10); > translate([1,-1,-1]) cube([8,12,10]); > } > translate([0,0,-10]) cube(10); > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >