[OpenSCAD] Can you give me any rendering advice...?

Dan Zuras 3D threedee at nonabelian.com
Sun Dec 26 17:05:57 CET 2010


> Subject: Re: [OpenSCAD] Can you give me any rendering advice...?
> From: Marius Kintel <marius at kintel.net>
> Date: Sat, 25 Dec 2010 22:57:09 +0100
> To: Dan Zuras 3D <threedee at nonabelian.com>,
>  openscad at rocklinux.org
> 
> On Dec 10, 2010, at 12:56 PM, Dan Zuras 3D wrote:
> 
> > 	The fly in the ointment is that CGAL increases the
> > 	rendering time by a lot for each object I add.  And
> > 	I am no where near the number of objects I need.
> >
> 
> I took a look at this and the reason why the F5 preview has issues is =
> that the intersection operation causes the number of evaluated objects =
> for OpenCSG to increase dramatically. We have implemented a safety =

	Thank you for looking into the problem.
	How dramatically?

> measure where we don't render this preview if the number of objects =
> after CSG normalization exceeds 1000. This could be made configurable in =

	Will this mitigate the problem or merely
	cause OpenSCAD to crap out when it happens?

> the GUI, but it would quickly become extremely slow to render the =
> resulting CSG trees.
> I'm not 100% familiar with the inner workings of the OpenCSG library, so =
> it hard to say if it's possible to optimize this.
> 
> Also, the CGAL library used for geometric evaluation (F6) is extremely =
> slow. This is a long-standing issue which I'm hoping to be able to =

	I believe I (& others) have run into variations
	of this issue before.  While I also have no idea
	how it happens I am well aware that it does.

> address in the future, although it's not too trivial. I'm painfully =
> aware of that this significantly limits the usefulness of OpenSCAD for =
> large designs, or even certain types of smaller designs. In the next =
> version of OpenSCAD, CGAL will be isolated into components which could =
> be rewritten to other libraries, which would open for easier =
> experimentation in case someone feels like picking up this issue.
> 
>  -Marius

	This last approach is the only path to a real cure,
	IMHO.

	The fact that OpenCSG or CGAL uses aribtrary precision
	software floating-point rather than 64-bit hardware
	double precision is at the root of the problem.  The
	fact that their data structures grow to gobble up
	huge amounts of memory in a more than linear fashion
	suggests some algorithmic problem as well.

	Really, in an era of cheap computers with gigabytes
	of memory & gigaFLOPS of processing power available,
	one would expect to be able to render objects with
	millions of primitives in seconds.  Not be crippled
	in both time & space by the attempt to render (at
	all) a thing with mere thousands of primitives.

	I know now that the fault lies with CGAL or OpenCSG
	& not with anything you have written.  Still, the
	decision to use them to save programming time must
	be looked at again in the light of how much rendering
	time your users are spending.

	If, as you suggest, this can be done incrementally
	then the pain of doing it can be administered in
	small doses.

	And the promise is that OpenSCAD will become an
	extraordinary tool when you come out the other end.

	I look forward to that day.

	Yours,

				Dan


More information about the OpenSCAD mailing list