Giles' advice of some use but not a cure...

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Giles' advice of some use but not a cure...

Dan Zuras 3D
> From: [hidden email]
> Subject: OpenSCAD Digest, Vol 13, Issue 5
> To: [hidden email]
> Date: Sat, 11 Dec 2010 12:00:01 +0100
>
> Today's Topics:
>
>    . . .
>    2. Re: Can you give me any rendering advice...? (Giles Bathgate)
>
> ------------------------------
>
> Message: 2
> Date: Fri, 10 Dec 2010 12:12:32 +0000
> From: Giles Bathgate <[hidden email]>
> Subject: Re: [OpenSCAD] Can you give me any rendering advice...?
> To: OpenSCAD mailing list <[hidden email]>
> Message-ID: <1291983152.11295.1.camel@masala>
> Content-Type: text/plain; charset="UTF-8"
>
> On Fri, 2010-12-10 at 03:56 -0800, Dan Zuras 3D wrote:
> > Folks,
> >
> > I am trying to design an object using OpenSCAD.  It
> > is not all that complicated but it does involve the
> > union, intersection, & difference of spheres &
> > cylinders.  My method of debugging it is to add an
> > object or group of objects, render the result to see
> > if I have everything right, & make adjustments based
> > on what I see before I add the next object.
> >
> > 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.
> >
> > Is there some lesser rendering mode I could use that
> > takes substantially less time?  A wire mesh, perhaps?
> > Anything that would allow me to finish the design.
> >
> > Thanks,
>
> Have you tried
> a) rendering using openCSG (f5)
> b) reducing the number of facets $fn=10; at the top of your script
>
> Regards
>
> Giles.
>

        Giles,

        Rendering with f5 is substantially faster, up to a point.
        The log always reports 0 seconds rendering time even though
        there is an actual CPU limited delay of up to 6 seconds
        after the image is claimed to have been rendered.  Then,
        beyond that point, the object is improperly rendered but
        goes blindingly fast. :-)

        I include the code below together with some tables of f6 &
        f5 rendering times.  The tables are indexed by the upper
        limit in two loops that appear above it.  They range from
        0 to 7 which amounts to 1 to 8 objects.  As the final object
        will have something like 200 objects, I have a long way to
        go to be able to make it.

        BTW, it uses a substantial amount of memory which also
        increases with the number of objects.  As it uses some 10%
        to 16% of 4 GB with fewer that 10 objects now, I may not be
        able to make the final object at all.

        I have not tried changing $fn but since I posted that note
        I have tried simplifying the object as much as I dare.
        (The actual object.  The code below is just to demonstrate
        the problem.)

        I have also found that reducing the convexity of extruded
        objects from 10 to 2 is not only safe but substantially
        reduces the rendering time.  (The f6 time.  I will try f5
        rendering as you suggest.)

        There are also cases in which an extruded object reduces
        to a cylindar.  I will try splitting out those cases &
        replacing the extrusion with an actual cylinder & see if
        that helps.

        Are these problems common with objects consisting of more
        than 100 primitives?  Or am I running in an environment or
        in a way that is limiting my ability to render objects of
        such complexity?

        I am running Ubuntu 10.04 with 4 GB memory in a 2 CPU
        system that clocks at 2.4 GHz.  BTW, the software uses
        only 1 CPU at a time in spite of this being a classically
        parallelizable problem.  Just an observation.

        Thanks for your help.

        Its gotten me farther if not all the way there...


                                Dan


//
// foo.scad
//
// 12/9/10 3 AM To demonstrate what must be a bug in rendering.  If it
// is normal, I am in serious trouble in making the things
// I need to make for Christmas.
//
// ==========
//

module outDots() intersection() {
        cylinder(h = 13, r = 35, center = true);
        union() {
                for (i = [0:7]) rotate(18*i,[0,0,1]) translate([38,0,0])
                        scale([1/10,1/10,1/10]) sphere(r = 10*6);
        }
}

module inDots() intersection() {
        cylinder(h = 9, r = 38, center = true);
        union() {
                for (i = [0:7]) rotate(18*i,[0,0,1]) translate([38,0,0])
                        scale([1/10,1/10,1/10]) sphere(r = 10*4);
        }
}

module hedge() union() {
        translate([0,0,10]) outDots();
}

module maze() union() {
        translate([0,0,10]) inDots();
}

difference() { hedge(); maze(); }

//
// Times for various loop upper limits
// The desired upper limit is 19.
//
// upper
// limit f6 time f5 time
// ----- ------- -------
//  0 9 seconds 0 seconds ~ 0 actual
//  1 28 seconds 0 seconds ~ 0 actual
//  2 55 seconds 0 seconds ~ 1 actual
//  3 1 minute 25 seconds 0 seconds ~ 6 actual
//  4 2 minute  7 seconds 0 seconds improperly rendered
//  5 2 minute 58 seconds 0 seconds improperly rendered
//  6 3 minute 52 seconds 0 seconds improperly rendered
//  7 4 minute 51 seconds 0 seconds improperly rendered