You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The preview panel occasionally displays entire faces of entities that were used as second and later operands in a difference operation, despite that parts of these faces are not adjacent to any occupied volume.
To Reproduce
Steps to reproduce the behavior:
Open OpenSCAD and create a new script.
Paste in and execute the script below.
Observe the preview display shows crosshatching indicating the presence of elements that are not actually part of an entity (see screenshot).
These green crosshatch rectangles indicate the position of a cube entity that was subtracted from the lenticular "ikea" objects to flatten one edge. The edge of the large cube is exactly aligned with the cube used to remove part of the lens shape -- their faces touch but there is no overlap between them. A portion of that face remains as the flattened edge surface of the ikea object, but the whole face should not be shown.
Expected behavior
Entities used as second and subsequent operands in a difference operation, should not be visible in the preview panel at all. This "ghost face" of a missing cube is confusing.
The simple answer is that yes, the previewer gets Z-fighting artifacts any time that a face of a negative object aligns with a face of a positive object. There can be similar issues when faces that have been subtracted away align with positive faces of a different color.
There are roughly two strategies for addressing this problem:
Arrange that those cases don't happen. The major case there is where you are subtracting a negative object from a positive one and cutting into its surface. Arrange that the negative object extends outside the positive object. (But that doesn't directly help your particular scenario.)
Wrap strategic pieces with render(), which forces OpenSCAD to fully evaluate the geometry of that subassembly.
In your particular case, wrapping the difference() in ikea() in a render() appears to address the problem.
Why does it do this, and why doesn't somebody fix it? Because the previewer does black magic to get its performance, and it's a wonder that it works as well as it does, and nobody has a better answer. Recent work to dramatically improve render performance may provide a viable replacement, though it's still slower than the previewer and more limited in other ways like color and transparency support.
Describe the bug
The preview panel occasionally displays entire faces of entities that were used as second and later operands in a difference operation, despite that parts of these faces are not adjacent to any occupied volume.
To Reproduce
Steps to reproduce the behavior:
These green crosshatch rectangles indicate the position of a cube entity that was subtracted from the lenticular "ikea" objects to flatten one edge. The edge of the large cube is exactly aligned with the cube used to remove part of the lens shape -- their faces touch but there is no overlap between them. A portion of that face remains as the flattened edge surface of the ikea object, but the whole face should not be shown.
Expected behavior
Entities used as second and subsequent operands in a difference operation, should not be visible in the preview panel at all. This "ghost face" of a missing cube is confusing.
Code reproducing the issue
Screenshots
Environment and Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: