-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenSCAD preview bug: after rendering parts of model are missing by rotation #4345
Comments
Note for the future: it makes it a lot easier for people looking at your problem if you can reduce it to the simplest program that demonstrates the problem, rather than asking them to understand a 400-line program. I suspect that what's happening is that the previewer doesn't like it if the camera is inside any part of the model - notably including the invisible parts that are used to cut away from the model. Here's a simple program that demonstrates that problem:
As you rotate the view, when the camera is in +XYZ the side of the sphere reappears. Whether this is a bug or a limitation, shrug, but it's a known behavior. The previewer cheats a lot to get performance, and this is one of the places where the cheating shows. I see that your model has significant chunks of invisible geometry used to cut away from the model. (You can see them with View/Thrown Together.) Check to see if the artifacts that you are seeing are tied to having the camera inside those volumes. |
Thanks for the comments. Most of the difference()s go to the inside, the big sphere to get white sphere hull only, and small cubes to remove half of the vertex spheres inside (right): Oh, and there really is one difference() that goes to the outside, for each of the spherical triangles. I will try to generate a small standalone example, but I am pretty sure that camera position is not inside, although that could explain behavior based on your comments. |
Wow, you were right.
Need to investigate why there are hull()s reaching out soooo far! (that get difference()d away normally): |
I should have read
then no change "difference() --> union()" would have been needed to see the same thing. |
When OpenCSG draws the preview it draws both the positive and negative objects. If the negative objects are too close to the camera the faces that cross the front clipping plane are not drawn and that breaks the simulated CSG difference. |
Yeah, like I said, the previewer cheats. It stacks up triangles with exactly the right modes in exactly the right order to simulate boolean operations. It can do that very fast, but there are a number of ways that it's fragile. |
Nophead makes a good point: I said that the problem was when the camera was inside the model. That's not quite right. It's when the camera is too close to the model, because stuff that's closer to the camera than a certain distance is dropped. |
Thanks for the explanations. This time no rotation, but varying distance with $vpd = 34.6+$t*1: This is 10step animation with "Preview": This is 10step animation with "Thrown Together": Here is new approach I tried, much less maximal distance (~12) than before (35), radius of white sphere around origin is 6. |
Thanks for all the information. Toggling "Preview" and "Thrown Together" views: You can close this issue based on explanations on how OpenCSG preview works for delivering fast viewing experience. |
I noticed a preview display problem for OpenSCAD model nearly completely filling view. I stored the model here:
https://stamm-wilbrandt.de/en/forum/C60.preview_problem.scad.txt
With 10-step 1fps animation the problem clearly shows like this:
![](https://camo.githubusercontent.com/e5229c9145111238ea044b3041d23277fc0e11cbd6896b2ea0137bd1bf09dd9e/68747470733a2f2f7374616d6d2d77696c6272616e64742e64652f656e2f666f72756d2f4336302e707265766965775f70726f626c656d2e736361642e616e696d2e676966)
I see this problem with OpenScad preview under Pi400 64bit Raspberry Pi OS (based on Debian), as well as on Intel Celeron J4125 with Ubuntu 22.04. Also the cuts shown are not along the gray spherical triangles I create with modules, so I would say this is caused by OpenSCAD previewer.
Unrelated, but I generated same model for JSCAD, and JSCAD in browser does not have this partially missing view issue:
https://openjscad.xyz/?uri=https://stamm-wilbrandt.de/en/forum/C60.preview_problem.jscad
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: