coloring model causes Z-fighting, depending on order

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

coloring model causes Z-fighting, depending on order

JordanBrown
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: coloring model causes Z-fighting, depending on order

nophead
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 <[hidden email]> 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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org