discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: [OpenSCAD] Newbie... Rendering Difference generated unexpected output

M
MichaelAtOz
Wed, Jul 20, 2016 2:12 AM

Welcome to the forum.

When you render (F6) it looks normal, and the exported object will be OK -
baring other problems ;)

F5 preview uses an approximation of the geometry using tricks that provide a
quick view, what you see is called  z-fighting
https://en.wikipedia.org/wiki/Z-fighting  . As you can read in the link it
is caused by co-incident faces.

You already worked out how to fix it, basically make the object you are
removing a smidgen larger than the main object.

Many people end up using a variable, e or epsilon (maths - an arbitrarily
small positive quantity) with a small value like 0.1 [you may need to change
it if you have very large or small designs], like so;

e=0.1;
h=20;
d=10;
size=h;
difference() {
cube(size);
translate([0,0,-e])
cylinder(h=h+2*e,d=d);
}

I use s=0.05 - for smidgen, and s2=s*2, then  do like so;
difference() {
cube(size);
translate([0,0,-s])
cylinder(h=h+s2,d=d);
}

You will have other issues sometimes when you have co-incident faces
elsewhere, so it is good to have two objects offset by a smidgen, like if
you put a cylinder just touching a cube surface, it is better to 'embed' the
cylinder into the cube by, like 0.01.


Admin - PM me if you need anything, or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”  Fight it! http://www.ourfairdeal.org/  time is running out!

View this message in context: http://forum.openscad.org/Newbie-Rendering-Difference-generated-unexpected-output-tp17943p17944.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Welcome to the forum. When you render (F6) it looks normal, and the exported object will be OK - baring other problems ;) F5 preview uses an approximation of the geometry using tricks that provide a quick view, what you see is called z-fighting <https://en.wikipedia.org/wiki/Z-fighting> . As you can read in the link it is caused by co-incident faces. You already worked out how to fix it, basically make the object you are removing a smidgen larger than the main object. Many people end up using a variable, e or epsilon (maths - an arbitrarily small positive quantity) with a small value like 0.1 [you may need to change it if you have very large or small designs], like so; e=0.1; h=20; d=10; size=h; difference() { cube(size); translate([0,0,-e]) cylinder(h=h+2*e,d=d); } I use s=0.05 - for smidgen, and s2=s*2, then do like so; difference() { cube(size); translate([0,0,-s]) cylinder(h=h+s2,d=d); } You will have other issues sometimes when you have co-incident faces elsewhere, so it is good to have two objects offset by a smidgen, like if you put a cylinder just touching a cube surface, it is better to 'embed' the cylinder into the cube by, like 0.01. ----- Admin - PM me if you need anything, or if I've done something stupid... Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above. The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out! -- View this message in context: http://forum.openscad.org/Newbie-Rendering-Difference-generated-unexpected-output-tp17943p17944.html Sent from the OpenSCAD mailing list archive at Nabble.com.
M
milktea
Wed, Jul 20, 2016 4:53 AM

Thank you so much. Glad to know that it is not my install or my machine's
problem. Yes, I ended up trying to use the 0.1 as the epsilon for canceling
the regions. I didn't know I have to "embed" my object as well. It is nice
to know that. Thank you so much for your help.

--
View this message in context: http://forum.openscad.org/Newbie-Rendering-Difference-generated-unexpected-output-tp17943p17945.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Thank you so much. Glad to know that it is not my install or my machine's problem. Yes, I ended up trying to use the 0.1 as the epsilon for canceling the regions. I didn't know I have to "embed" my object as well. It is nice to know that. Thank you so much for your help. -- View this message in context: http://forum.openscad.org/Newbie-Rendering-Difference-generated-unexpected-output-tp17943p17945.html Sent from the OpenSCAD mailing list archive at Nabble.com.