11 ms·
OpenSCAD 3D rendering just got an order of magnitude faster
- prideout 5y agoI'm surprised that OpenSCAD uses GMP. I would think that 64-bit doubles would be good enough.
- R0b0t1 5y agoIt's wise to pick a library that can act as a portable layer over implementation details.
- amelius 5y agoPerhaps they need it to ensure robustness of geometric predicates, in edge cases. E.g. if the determinant of some matrix becomes too close to zero, switch to exact arithmetic.
- ur-whale 5y ago> I would think that 64-bit doubles would be good enough. Implementing robust boolean operations on polyhedral geometry is and has been known for quite a while to be very hard if you do not have arbitrary precision math, or at the very least some sort of interval arithmetic that kind winds back a calculation and increases the precision up to the point where an unambiguous decision can be made about the sign of an expression. Here's an example: create a sphere, tesselate it to - say - a million triangle (not much these days), make a rotated copy of the original by 0.01 degrees and intersect with the original. I guarantee you the resulting calculation will either crash your floating point based implementation or it'll produce a model that will be non manifold.
- Animats 5y agoI used to watch that get better in each release of Autodesk Inventor. A useful test is to model a bolt. Make a cylinder. Make a 2D cutting tool that has one thread profile. Extrude the thread profile along a spiral. Subtract that from the cylinder. Now you have a threaded rod. Now make a 2D hexagon for the bolt head. Extrude. Union with cylinder. Now chamfer all edges of the bolt head. Also chamfer the end of the bolt. Now take a close look at where the threads meet the bolt head, and where the threads meet the chamfer. If those are all correct, then you have a usable CSG CAD system for machined parts. Inventor started getting that right around 2012. Admittedly, you don't usually model threads at that level of detail. Inventor has "cosmetic threads", which are just textures, which is what you use for ordinary bolts. This is mostly an exercise for CAD operators. It's like whiteboarding for programmers. You sit the applicant down at a workstation, hand them a bolt and calipers, and say "model this". Sometimes you do need that kind of detail, because you're going to have a machine tool machine the thing.
- dekhn 5y agoFusion 360 handles this perfectly. In fact it has thread creation directly built in (both textured and modelled explicitly). I recently needed to make a nut for a specific thread, and did it by subtracting the thread from a volume. If you're careful you can inspect the results and see how to offset the thread slightly to move from a too-tight fit to a simple press fit.
- Animats 5y agoFusion 360 is the same CSG engine as Inventor. It just has fewer features and is tied to "the cloud". Inventor has pro features such as "would you like a finite element analysis of the weak points in that", and "Warning - gear tooth counts are not relatively prime and may result in uneven wear".
- deleted 5y ago[deleted]
- Tossrock 5y agoFusion360 has FEA in the Simulation workspace.
- ChrisLomont 5y ago64-bit doubles are not good enough for a production cad system. Many operations, including CSG, may require much more precise numbers to resolve the question of if and how things intersect, if surfaces remain manifold or fail to be orientable, and on and on. Those things needing (to be careful) arbitrary precision can sometimes be truncated back to 64 bit doubles, as long as necessary invariants are maintained. A simple example: suppose you have a shape at the origin, that is designed for careful CNC, so maybe 1/10,000th of an inch or maybe even 1/100,000th of an inch accuracy. Suppose 1/10,000th accuracy is, say, ~14 bits of mantissa, then making the part 16 inches long is another 4 bits. We're up to 28 bits. Now suppose you do an operation, like intersection with another such part, or a fillet or rounding, whose computation merely needs to square numbers. Now you need 28*28 bits, anf you overflow the mantissa. Or move the part out to coordinate 64, uses another 6 bits. And god forbid you hit an algorithm that needs to cube numbers, which triples the number of bits you need in order to retain accuracy needed for the final part to meet tolerances. It gets troublesome quite quickly.
- sokoloff 5y agoWouldn’t ~14 bits down to 10^-4 plus 4 bits to get to 2^4 be ~18 bits rather than ~28?
- ChrisLomont 5y agoYep, made error as I was editing it xamples. The underlying idea stands- bits get used up very quickly in many CAD algorithms.
- adgjlsfhk1 5y agoIf 64 bit doubles aren't enough, why not use libquadmath? It gives you 113 bits of mantissa, and should be around 10x faster than arbitrary precision.
- ChrisLomont 5y ago113 bits will still fail on iterative processes. If you dig into probably any of the robust kernels of things like parametric modelers, they all need these methods. The above example I gave is terribly naive: things get vastly worse. Above was only position. Now build in Bezier surfaces, or better yet, NURBs so you can do true conics as well as crazy freeform surfaces. Now compute the intersection of such objects. These intersections require very high degree polynomial representations. Now repeat. If you quantize points on the intersection curves too much, you'll get all sorts of pathologies, things doubling back, near singularities .. The way to deal with this flawlessly is to allow whatever precision is needed to prove necessary constraints are met. A good lib would use each representation as needed: double, libdouble, liquid, liboct, etc. as needed, and eventually arbitrary precision. I've written several systems that do such over my career. It's a cool space A nice simple place to try this is to make an arbitrary precision Mandelbrot zoomer that switches underlying types as needed for precision. It's much more fun to make these work on various AVX flavors, or on GPUs. All are doable.
- b33j0r 5y agoBest tool for boolean geometry I’ve personally used. I’ve had many more successful 3D prints than any of the point-and-click CAD tools in which I have also spent hundreds of hours. But with ADHD tendencies, the rendering time of OpenSCAD often had me getting distracted and forgetting to finish whatever I was doing for a while. This is very exciting! Great work, OpenSCAD team.
- YaBomm 5y ago> Best tool for boolean geometry I’ve personally used. I have good luck with Blender... much more then with Freecad... haven't tried OpenSCAD though...
- ur-whale 5y agoBlender is really nice for certain things, but: 1) Blender is a general purpose 3D tool, and many things that you need for CAD aren't there. Fillets, Chamfers and a robust boolean engine are missing. Also, when you do things in Blender, everything is geared towards how it will look, not towards making sure that things fit each other precisely. For example, getting blender to place an object 3.4mm off the face of a rotated cube along the normal of that face and rotated 33 degrees around that normal is possible, but really not easy. 2) It can be programmed via python, but it isn't the core use case and for programming 3D models using blender, a) the learning curve is very steep b) the resulting code is very verbose because the API wasn't really designed for this use case. c) there is almost no documentation and very little examples of parametric modeling using the blender python API available on the internets. 3) the boolean engine in blender is fast, but it is far less robust than the one in openscad (CGAL-based) and will often simply refuse to produce a model for reasons that are entirely obscure. 4) Even with the newer geometry node engine, Blender is basically centered around a destructive workflow (early steps in the construction of a model can only be changed via undo/redo), and building paramatric models is really not easy unless you get down to the python API.
- b33j0r 5y agoPreach! (I shortened my comment to make it more pithy, had a lot of those same thoughts, and appreciate how you fleshed them out!) 5. I write my own blender plugins quite often, and they break with my next `git pull`. Blender moves fast and breaks things ;) I do python professionally and gamedev 3D/VR stuff as a side piece. I spent 5 hours in blender tonight trying to bake an alpha channel. Something I’ve done before. It’s a nightmare to maintain a blender plugin. Because (as you point out) blender is opensource clay, not a surgical scalpel. OpenSCAD is a precision knife.
- bseidensticker 5y agoThis is so incredible! I just tried this out with a few of my models and I can vouch for the order of magnitude.
- ur-whale 5y agoIf true, this is fantastic news. OMW to try it right now on a score of old models I have stashed around.
- ur-whale 5y agoSo ... Bearer of bad news here: I've tried this on a model I had lying around, and ... :-\ box.scad is an old, somewhat complicated electronics enclosure where I experimented with building a non-trivial, fully filleted model with scad. The model has quite a lot of "natural" booleans (eg holes and such), but also, the fillets are implemented either: - with a ton of procedurally generated minkowski sums (offsets) combined with booleans. - with hulls of far-apart spheres TL;DR: as far as I can tell, fast-csg does not render the model properly :-( speedup with fast-csg is decent (~5x) only at very low $fn speedup is entirely underwhelming when $fn gets high minkowski offsets likely gobble up the bulk of the render time This also made it very clear that render times aren't linear at all when $fn grows, and this is both true for traditional openscad and fast-csg. Your mileage may get much better if you steer clear of hulls and minkowski sums, and to be fair, I'd need to run a benchmark with no minkski in it. Benchmark: old : time openscad -o z.stl box.scad new : time openscad-nightly --enable fast-csg -o z.stl box.scad $fn = 5 old = 6.8 sec new --enable fast-csg = 1.2 sec x 5.6 $fn = 10 old = 15 sec new --enable fast-csg = 3 sec x 5 $fn = 20 old = 67 sec new --enable fast-csg = 25 sec x 2.68 $fn = 40 old = 427 sec new --enable fast-csg = 369 sec x 1.15
- mrfusion 5y agoWow I’m so happy people are working on this. I love the program but Ive had to abandon several interesting ideas due to never rendering.
- 13of40 5y agoSame here. I was experimenting with 3d printing stamps (like for ink) with flexible filament from 2-color raster images, and the render time just for that was about 15 or 20 minutes per step. I will definitely need to download this.
- jandrese 5y agoYeah, I thought that rendering a 1000x1000 surface for a dimensional wall hanging should be no problem, but OpenSCAD gobbled up 16GB of memory and then crashed. I would also love for it to have a variable that rounds off corners to some diameter on the cubes, cylinders, and even polyhedrons. It's possible to round off corners using the intersection operator but it is a lot of work and something that I do in almost everything I build. Nobody likes unnecessary sharp corners.
- tdeck 5y agoI was looking for this recently and found a great OpenSCAD library called RoundAnything. It looks very productive: https://github.com/Irev-Dev/Round-Anything https://github.com/Irev-Dev/Round-Anything
- 5y ago
- IgorPartola 5y agoSweet. I use OpenSCAD for my models and it’s been really cool. Wish I was better after designing more organic looking shapes but lost times I need simple objects anyways so it doesn’t matter as much.
- PennRobotics 5y agoAlternatively, now you can increase $fn an order of magnitude and get imperceptibly smooth curved surfaces and complicated minkowski sums.
- ur-whale 5y agoYou're assuming minkowski and other boolean things are O($fn). Are they though?
- PennRobotics 5y agoNo idea. When I multiply all $fn by 10, the render takes between 50 and 200 percent of the original render time or else the program crashes. In any case, the new flags make renders wicked fast.
- knolan 5y agoHow does this compare to the new Geometry Nodes in Blender? The flexibility of what people are producing in Blender 3.0 is staggering.
- sprobertson 5y agoWith OpenSCAD your script is the model - there are no mouse-based modeling tools like you might be used to with Blender or other 3D software. The closest comparison I can think of is if each of Blender's geometry nodes were a single line of code.
- knolan 5y agoYou can view the source of each node in Blender, but that’s not the point. Writing a script is not fundamentally different form connecting nodes in geometry nodes and entering attributes. What I’m asking is how do the output and performance differ.
- tragictrash 5y agoIt most definitely is fundamentally different than dragging points around with your mouse. You can use recursion and complex maths. Plus, the way you approach designing an object is very different from doing traditional 3d modeling. Professional developers who excel at architecture and code organization will have a much easier time completing complex objects than someone more green. You should play around with it to find out. You will be disappointed though, because you're looking to compare a fish with a horse in a race.
- sidewndr46 5y agoThis is incredibly accurate. Once I learned OpenSCAD my entire process of thinking about physical design via computer aided tools disappeared. Gone is the process of memorizing dozens of shortcut, hundreds of menus and painstakingly selecting items and entering values into fields or dialog boxes. Instead I can create in just minutes what would take a huge breadth of knowledge to do using conventional point-and-click interfaces. There are some places where the point-and-click UI makes sense. For example I like how I can layout the parts on a simulated baseplate with Cura. But there is really no design or thought into that process. Just slap them onto the plate in a way they won't overlap and I'm done.
- app4soft 5y agoWhy version "doubled" in AppImage-snapshots names of Linux x86_64?[0] > OpenSCAD-2022.02.09.ai10824-2022.02.09.ai10824-x86_64.AppImage BTW, As for "10x performance" — just tried, but not see speedup.[1] [0] https://files.openscad.org/snapshots/ https://files.openscad.org/snapshots/ [1] https://twitter.com/app4soft/status/1491567347295039490 https://twitter.com/app4soft/status/1491567347295039490
- tqkxzugoaupvwqr 5y agoYou must enable it in the settings or via cli flag --enable=fast-csg
- app4soft 5y agoGuess, I misread "10x rendering", so my issue probably related to `vertex-object-renders-*` — and as I tested there is no any changes in it.[0,1] [0] https://twitter.com/app4soft/status/1491575600439508992 https://twitter.com/app4soft/status/1491575600439508992 [1] https://twitter.com/Torsten_Paul/status/1491712810916757508 https://twitter.com/Torsten_Paul/status/1491712810916757508
- ucirello 5y agoThis is exciting news. And I enjoyed to learn that some investigation on adding parallelism has been done. OpenSCAD is my main design driver, so when I hit these performance corners, it'd drive me nuts. OpenSCAD and https://github.com/nophead/NopSCADlib https://github.com/nophead/NopSCADlib is a winning combo.
- sydthrowaway 5y agoUh no, you need BOSL2
- wilsonjholmes 5y agoYes! Its wonderful!
- ravenstine 5y agoAnd threadlib.
- app4soft 5y ago> > Uh no, you need BOSL2[0] > And threadlib[1] And dotSCAD[2] So, OpenSCAD user needs to install a lot of extra libs[3] to be productive;) [0] https://github.com/revarbat/BOSL2 https://github.com/revarbat/BOSL2 [1] https://github.com/adrianschlatter/threadlib https://github.com/adrianschlatter/threadlib [2] https://github.com/JustinSDK/dotSCAD https://github.com/JustinSDK/dotSCAD [3] https://openscad.org/libraries.html https://openscad.org/libraries.html
- ravenstine 5y agoDefinitely, but I also consider that a good thing. What I really never liked about most tools for creating media is they try and do way too much. My mindset is close to that of UNIX philosophy, thus I like that out of all the 3D/CAD tools I've used, OpenSCAD pretty much does one thing out of the box... and does it adequately. I like that it doesn't pretend it can do everything I want, but when there's something I need it to do, like add threads or screws to a project, there's probably a library for that because OpenSCAD is already code-oriented rather than the code coming second. dotSCAD looks dope! I hadn't heard of it, but now I know what I'll be playing with next time I spin up my 3D printer.
- alpineidyll3 5y agoI loved openscad but not it's eff. This is amazing news.
- Inhibit 5y agoNo, thank you for making OpenSCAD better! It's always nice to read the process behind an improvement as well.
- greesil 5y agoOh thank goodness
- t8y 5y agoI wonder if there will be any CAD software that used SDF for modelling. Smooth detail + easy slicing seems like a good fit.
- reasonabl_human 5y agoInteresting stuff! Does anyone here have recommended learning resources for openSCAD? Have used creo but minimally, as a hobbyist. Would be fun to build enclosures for some Eagle boards.
- teeray 5y agoNo Starch has a book on it. I flipped through it at the bookstore and it seemed pretty comprehensive, with a neat final project too
- vbezhenar 5y agoWhat’s OpenSCAD use case? I recently built a printer and started to print things. OpenSCAD was the first software I reached because I’m developer and writing code felt natural for me. But it took so much time and result was kind of hard to understand and change. Then I moved to FreeCAD, learned about parametric modelling and it was like the whole other world. I was like 10x more productive compared to OpenSCAD and result was easy to change and adapt. Then I moved to Fusion and from that point I think that I’ve found a sweet spot, Fusion is similar to FreeCAD, but feels much more polished.
- tombert 5y agoFWIW, I went through the exact opposite progression of what you described (Fusion->FreeCAD->OpenSCAD), and I liked OpenSCAD the best. I feel like I've gotten good models out of it, and have done elaborate enough stuff in the process. I suppose there's no accounting for taste.
- SOLAR_FIELDS 5y agoI prefer the style of OpenSCAD but I’ve found that there are certain things that the software just is either really hard to achieve or incapable of doing entirely. One recent example is that I was designing a part for injection molding and I needed to add a draft angle to the part. This seemingly simple operation is rather trivial to do in FreeCAD and Fusion 360. It is not at all trivial in OpenSCAD. Another example of OpenSCAD’s limitations is the render time for parts produced by boolean operations which this change purportedly helps a lot with. But there is also still not a guarantee that the output of those boolean operations is actually a manifold object. Slicers these days are actually quite good at repairing geometry but even with a moderately complex part produced by boolean operations (in my case it was often one that required subtraction of cylinders across multiple pieces of an object) I found OpenSCAD’s output to produce some bizarre issues with geometry that even the slicer could not repair very well. I too like OpenSCAD the best and often find myself more productive in it than other pieces of software, especially for simple models. But for complex models it can’t really hold up to the more traditional parametric modeling software (yet)
- CodeWriter23 5y agoThis is I wanna give that guy a big hug awesome!
- ochafik 5y agoAww thanks, happy it's helping others!
- unnouinceput 5y agoOpenSCAD is such a poor choice of words. You see, it's too close to something else entirely, that when people will hit a roadblock, which can happen when you learn a new application, that it just comes naturally when you swear. Perhaps the authors of this application might consider replacing the "S" with something else?
- Karen48 5y ago[dead]
- toisanji 5y agoawesome, I have commits in there and used it many years ago for this project: https://github.com/jtoy/sensenet https://github.com/jtoy/sensenet I used it to generates 10s of thousands of models for machine learning research