Skip to content
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

Examples for possible inclusion in isosurface.scad #1559

Open
RAMilewski opened this issue Feb 3, 2025 · 32 comments
Open

Examples for possible inclusion in isosurface.scad #1559

RAMilewski opened this issue Feb 3, 2025 · 32 comments

Comments

@RAMilewski
Copy link
Contributor

Note that these use a local copy of isosurface.scad so line 2 must be changed before inclusion.

@RAMilewski
Copy link
Contributor Author

Image

'''
include <BOSL2/std.scad>
include <isosurface.scad>

stats = false; // [true,false]

bounding_box = [[-60,-50,-5],[35,50,21]];
funcs = [
move([-20,0,0]) * scale([25,4,4]), mb_sphere(1), // fuselage
move([30,0,5]) * scale([4,0.5,8]), mb_sphere(1), // vertical stabilizer
move([30,0,0]) * scale([4,15,0.5]), mb_sphere(1), // horizontal stabilizer
move([-20,0,0]) * scale([6,45,0.5]), mb_sphere(1), // wing
];
isovalue = 1;
voxel_size = 1;

metaballs(funcs = funcs, isovalue=isovalue, bounding_box = bounding_box, voxel_size = voxel_size, show_stats = stats);

'''

@amatulic
Copy link
Contributor

amatulic commented Feb 3, 2025

Nice! Shrinking the bounding box just a little bit, to [[-55,-50,-5],[35,50,17]], improved the execution time by 1.5 seconds.

Enclose your code between four backticks ```` instead of three single quote marks, to make it look like code.

I have included this in the examples. I moved the wing back 5 units; as a pilot and former avid model airplane builer, I felt that the wing needed to move back for the center of gravity to look more correct; it looked tail-heavy originally.

@RAMilewski
Copy link
Contributor Author

Ha... I'm also a pilot (SEL and LTA with about 25 solo hours in sailplanes but no sailplane rating). I kept the wing forward to keep the aft fuselage from getting too fat. That version was my first rough cut. If it can get the time I'll maybe add a cockpit canopy and tip-tanks. Not sure if I can turn it into an airliner with underwing engines.

...any idea how to do a NACA airfoil in metaballs? :)

@amatulic
Copy link
Contributor

amatulic commented Feb 4, 2025

Cool. My ratings are single-engine land and glider aero-tow-only, and most "recently" I got an ultralight certification (before the recreational pilot rating existed). All this happened in Texas in the 1970s and 1980s when costs were reasonalble. I haven't flown in years, however. My last flight was to take my fiancee (now my wife) up for a spin in Virginia where I lived at the time. I live in California now, and it's too expensive to fly around here.

I was thinking about an airfoil too. NACA is a rather precise formula, so I don't think that's possible with metaballs, but you may get something close by using negative metaballs to subtract the lower camber.

@amatulic
Copy link
Contributor

amatulic commented Feb 4, 2025

Thanks Richard. You did a later one with a ball orbiting around all over the place. That's the one I'd like to use.

Although... this one above is mesmerising to watch.

Also, it would be better with axes turned off.

@RAMilewski
Copy link
Contributor Author

Image

@RAMilewski
Copy link
Contributor Author

Image

@amatulic
Copy link
Contributor

amatulic commented Feb 6, 2025

Thanks Richard. Those files are huge! Nearly 1200x1000, way bigger than needed for a web page and consumes processing power moving 13 megabytes around repeatedly.

Would it be possible to make it half the size, like normal 4:3 format 600x450? That's a reasonable size for a web image. It looks like it's already 8-bit and not 16-bit graphics, which is good.

I tried converting these but ImageMagick doesn't seem to understand animated PNG files, or I just don't know how to use it (it's more vast in its options than BOSL2).

Alternately, post the code and I can make them. I have made OpenSCAD animations for things I upload to Printables and Thingiverse.

@RAMilewski
Copy link
Contributor Author

RAMilewski commented Feb 6, 2025

I'll poke around and see if I can find an APNG generation tool that lets me resize them. EZGIF.com doesn't appear to.
For now if you insert them into the markdown file using HTML tags instead of GFM you can resize them just as on a web page. If I can shrink them I'll do a PR with the smaller animations.

The other options would be to decrease the frame rate.

@amatulic
Copy link
Contributor

amatulic commented Feb 6, 2025

The problem is that a 13 megabyte graphic animation is a pretty big payload for this repo which is 20 MB without that graphic. Also, the whole 13 MB must by downloaded by every browser, which may cause unnecessary expense with metered connection and just adds unnecessary bulk and server load to the traffic.

When I do an animation, I have OpenSCAD save every frame to png, and then I use the ImageMagick 'convert' or 'magick' commandline to merge them all into an animation. It can do other things like crop, resize, resample, etc. while it's making the animation. You can get the file size reasonably small with it.

I had another thought while taking a nap today. I imagined a rounded cube, a torus, and a ball with intersecting orbits, and the cube and the torus were rotating around multiple axes as they moved. The objects orbits also wouldn't be much bigger than the size of each object, so they'd be interacting with one another most of the time.

@RAMilewski
Copy link
Contributor Author

OH! Hadn't thought of usiing ImageMagick. Good idea! Probably quicker too.

@RAMilewski
Copy link
Contributor Author

Image

@RAMilewski
Copy link
Contributor Author

Image

@amatulic
Copy link
Contributor

amatulic commented Feb 7, 2025

That's much more reasonable size, under 4 MB. It's still PNG, though, and needs cropping. It might fit in 600x450. If it was GIF I could do it but I can't do anything with animated PNG without losing the animation.

I like the image that looks like balls moving under a blanket. There's something I find faintly creepy about it.

When I set up an animation, I adjust the preview window to the size I want. You can see the size in the bottom bar of the OpenSCAD window. This is really hard to do on a high-resolution display if you're going for an exact size. I have a second monitor with low resolution so I usually put OpenSCAD there to get better control over the window size. Then I set the preview to the zoom level and position I want, and start the animation.

@RAMilewski
Copy link
Contributor Author

Image

@amatulic
Copy link
Contributor

amatulic commented Feb 13, 2025

Thanks. Added to #1564
I increased the frame rate using -delay 4. The image above looked a bit rough. A lower frame rate smoothed out the motion. -delay 3 would be 30 frames/sec, but -delay 4 worked OK.

@RAMilewski
Copy link
Contributor Author

Image
include <BOSL2/std.scad>
include <BOSL2/isosurface.scad>

stats = false; // [true,false]

isovalue = 1;
voxel_size = 1;
b_box = [[-25,-25,0],[25,25,81]];

body = [
   up(20) * scale([1,1.2,2]), mb_sphere(10), 
   up(10), mb_sphere(5),   
   up(50) * scale([1.2,0.8,1]), mb_sphere(10, cutoff = 15),
   move([0,-11,50]), mb_cuboid(2),
   move([5,-10,54]), mb_sphere(0.5, negative = true),
   move([-5,-10,54]), mb_sphere(0.5, negative = true),
   move([0,15,6]), mb_sphere(2, cutoff = 5),
];

// eyes
xflip_copy() move([5,-8,54]) color("skyblue") sphere(2, $fn = 32);
//teeth
xflip_copy() move([1.1,-10,44]) color("white") cuboid([2,0.5,4], rounding = 0.15);


hind_leg = [ 
   move([-15,-5,3]) * scale([1.5,4,1.75]), mb_sphere(5),
   move([-15,10,3]), mb_sphere(3, negative = true),
];

front_leg = [ 
   move([-9,-4,30]) * zrot(30) * scale([1.5,5,1.75]), mb_sphere(3),
   move([-9,10,30]), mb_sphere(2, negative = true),
];

ear = [
   yrot(10) * move([0,0,65]) * scale([3,1,7]) , mb_sphere(2),
   yrot(10) * move([0,-5,65]) * scale([2,2,5]) , mb_sphere(2, cutoff = 3, influence =2, negative = true),
];


color("BurlyWood") {
   metaballs(body, voxel_size, b_box, isovalue, show_stats = true);
   xflip_copy() {
       metaballs(hind_leg, voxel_size, b_box, isovalue, show_stats = true);
       metaballs(front_leg, voxel_size, b_box, isovalue, show_stats = true);
       metaballs(ear, voxel_size, b_box, isovalue, show_stats = true);
   }
}

@RAMilewski
Copy link
Contributor Author

RAMilewski commented Feb 22, 2025

Image
include <BOSL2/std.scad>
include <BOSL2/isosurface.scad> 


v_size = 1;
b_box = [[-35,-20,-25], [35,22,40]];
headZ = 23;


metaballs([
    scale([1.5,1,1]),    mb_disk(18,16),                //body
    left(10)* up(14),    mb_disk(3,5, influence = .5),  //neck shim
    left(10) * up(headZ),   mb_sphere(10, cutoff=11),   //head
    left(26) * up(30),   mb_sphere(5, negative = true, cutoff = 8),
    
    left(15) * up(headZ - 1) * fwd(5), mb_disk(1,2, cutoff = 4),       //cheek bulge
    left(15) * up(headZ - 1) * back(5), mb_disk(1,2, cutoff = 4),       //cheek bulge
     //beak
    left(23) * up(headZ) * zscale(0.4)* yrot(90), mb_capsule(12,3, cutoff = 5),
    left(18) * up(headZ), mb_disk(2,4),
    left(15) * up(headZ) * xrot(90), mb_disk(2,4),
    left(22) * up(headZ+1) * scale([1.2,1,0.75]) , mb_sphere(2, cutoff = 3),
    //tail
    right(20) * up(8) * yscale(1.7) * yrot(35), mb_cyl(h = 15, r1 = 4, r2 = 0.5), 
    ], 
    v_size, b_box, show_box = false, show_stats = true);

@amatulic
Copy link
Contributor

Really nice work. For the duck, I wonder if you could use a couple of negative balls with a close cutoff to make indentations where the eyes would go.

@RAMilewski
Copy link
Contributor Author

Image
include <BOSL2/std.scad>
include <BOSL2/isosurface.scad>
legD = 1;
tibia = 14; 
femur = 12;
head = [-35,0,78];
a = [12,6]; //leg offsets
voxel_size = 0.75;
bb = [[-45,-12,-5], [25,12,90]];

spec = [
    // legs
    move([-a.x,-a.y]), mb_connector([-4,0,0],[-6,0,tibia],legD, influence = 0.2),
    move([-a.x,a.y]), mb_connector([0,0,0],[0,0,tibia],legD, influence = 0.2),
    move([a.x,-a.y]), mb_connector([-2,0,0],[-3,0,tibia],legD, influence = 0.2),
    move([a.x,a.y]), mb_connector([0,0,0],[0,0,tibia],legD, influence = 0.2),

    move([-a.x,-a.y,tibia]), mb_connector([-6,0,0],[-2,0,femur],legD),
    move([-a.x,a.y,tibia]), mb_connector([0,0,0],[0,0,femur],legD),
    move([a.x,-a.y,tibia]), mb_connector([-3,0,0],[-1,0,femur],legD),
    move([a.x,a.y,tibia]), mb_connector([0,0,0],[0,0,femur],legD),

    // Hooves
    move([-a.x-6,-a.y]), mb_cyl(d1 = 1, d2 = 0.2, h = 2, cutoff = 1),
    move([-a.x,a.y]),    mb_cyl(d1 = 1, d2 = 0.2, h = 2, cutoff = 1),
    move([a.x-3,-a.y]),  mb_cyl(d1 = 1, d2 = 0.2, h = 2, cutoff = 1),
    move([a.x,a.y]),     mb_cyl(d1 = 1, d2 = 0.2, h = 2, cutoff = 1),

    // Body
    up(tibia+femur+10) * yrot(10), mb_cuboid([18,8,8]),
    up(tibia+femur+15)*left(10), mb_sphere(2),
    up(tibia+femur+8)*right(13)*xrot(90), mb_disk(1,4),
    
    // Tail
    up(tibia+femur+8), mb_connector([18,0,0],[22,0,-16],0.5, cutoff = 1),
    
    // Neck
    up(tibia+femur+35)*left(22)*yrot(-30)* yscale(0.75), mb_cyl(d1 = 8, d2 = 5, l = 38),
    
    // Head
    move(head + [-4,0,-3])*yrot(45)*xscale(0.75), mb_cyl(d1 = 3, d2 = 8, l = 12),
    move(head), mb_cuboid([3,3,3]),    
    
    // Horns
    move(head), mb_connector([0,-2,5],[0,-2.5,8],0.3, cutoff = 1),
    move(head + [0,-2.5,8],), mb_sphere(0.5, cutoff = 1),
    move(head), mb_connector([0,2,5],[0,2.5,8],0.3, cutoff = 1),
    move(head + [0,2.5,8],), mb_sphere(0.5, cutoff = 1),
    
    // Ears
    move(head + [2,-8,4])* xrot(60) * scale([0.5,1,3]) , mb_sphere(d = 2, cutoff = 2),
    move(head + [2,8,4])* xrot(-60) * scale([0.5,1,3]) , mb_sphere(d = 2, cutoff = 2),
];

metaballs(spec, voxel_size, bb,show_stats = true);

   

@amatulic
Copy link
Contributor

@RAMilewski you have an extra comma before the closing parenthesis in lines 46 and 48.

@adrianVmariano
Copy link
Collaborator

Giraffe has trailing commas in the horns section that fail in stable openscad. Model runs as is so there aren't any extra parentheses.

@amatulic
Copy link
Contributor

@RAMilewski - would you update the giraffe code above with the latest?

Also, how long does this take for you to render it? The code above took 5 minutes on my computer.

@RAMilewski
Copy link
Contributor Author

Here's the latest duck. Small changes (.05 steps) in voxel_size have a big effect on the shape of the eyes. This is 1, and looks slightly sinister.

Image
include <BOSL2/isosurface.scad> 

v_size = 1;
b_box =   [[-30, -17, -11], [27, 17, 31]];
headZ = 21;

spec =[
    scale([1.5,1,1]),       mb_disk(18,16),                //body
    left(10)* up(14),       mb_disk(3,5, influence = .5),  //neck shim
    left(10) * up(headZ),   mb_sphere(10, cutoff=11),   //head
    left(26) * up(30),      mb_sphere(5, negative = true, cutoff = 8),
    
    left(15) * up(headZ-1) * fwd(5),  mb_disk(1,2, cutoff = 4),       //cheek bulge
    left(15) * up(headZ-1) * back(5), mb_disk(1,2, cutoff = 4),       //cheek bulge
    // eyes
    left(17.5)*up(headZ+3)*fwd(4.5),  mb_sphere(1, negative = true, cutoff = 1.25),
    left(17.5)*up(headZ+3)*back(4.5), mb_sphere(1, negative = true, cutoff = 1.25),
    //beak
    left(23) * up(headZ) * zscale(0.4)* yrot(90), mb_capsule(12,3, cutoff = 5),
    left(18) * up(headZ), mb_disk(2,4),
    //left(15) * up(headZ) * xrot(90), mb_disk(2,4),
    left(22) * up(headZ+1) * scale([1.2,1,0.75]) , mb_sphere(2, cutoff = 3),
    //tail
    right(20) * up(8) * yscale(1.7) * yrot(35), mb_cyl(h = 15, r1 = 4, r2 = 0.5), 
    ];

    metaballs(spec, v_size, b_box, show_box = false, show_stats = true);

@RAMilewski
Copy link
Contributor Author

RAMilewski commented Feb 24, 2025

Here's the giraffe with a voxel size of 0.85. At 0.9 the tail becomes discontinuous. It takes about 40 seconds to preview.

Image
include <BOSL2/std.scad>
include <BOSL2/isosurface.scad>
legD = 1;
tibia = 14; 
femur = 12;
head = [-35,0,78];  //head position
stance = [12,6];    //leg position offsets
vsize = .85;
bbox =  [[-45.275, -11.475, 0], [22.725, 11.475, 87.5]];

spec = [
    // Legs
    move([-stance.x,-stance.y]), mb_connector([-4,0,0],[-6,0,tibia],legD, influence = 0.2),
    move([-stance.x,stance.y]),  mb_connector([0,0,0],[0,0,tibia],legD, influence = 0.2),
    move([stance.x,-stance.y]),  mb_connector([-2,0,0],[-3,0,tibia],legD, influence = 0.2),
    move([stance.x,stance.y]),   mb_connector([0,0,0],[0,0,tibia],legD, influence = 0.2),

    move([-stance.x,-stance.y,tibia]), mb_connector([-6,0,0],[-2,0,femur],legD),
    move([-stance.x,stance.y,tibia]),  mb_connector([0,0,0],[0,0,femur],legD),
    move([stance.x,-stance.y,tibia]),  mb_connector([-3,0,0],[-1,0,femur],legD),
    move([stance.x,stance.y,tibia]),   mb_connector([0,0,0],[0,0,femur],legD),

    // Hooves
    move([-stance.x-6,-stance.y,1]),    mb_capsule(d= 2, h = 3, cutoff = 2),
    move([-stance.x-1,stance.y,1]),     mb_capsule(d= 2, h = 3, cutoff = 2),
    move([stance.x-3.5,-stance.y,1]),   mb_capsule(d= 2, h = 3, cutoff = 2),
    move([stance.x-1,stance.y,1]),      mb_capsule(d= 2, h = 3, cutoff = 2),

    // Body
    up(tibia+femur+10) * yrot(10),        mb_cuboid([18,8,8]),
    up(tibia+femur+15)*left(10),          mb_sphere(2),
    up(tibia+femur+8)*right(13)*xrot(90), mb_disk(1,4),
    
    // Tail
    up(tibia+femur+8), mb_connector([18,0,0],[22,0,-16],0.5, cutoff = 1, influence = 0.2),
    
    // Neck
    up(tibia+femur+35)*left(22)*yrot(-30)* yscale(0.75), mb_cyl(d1 = 8, d2 = 5, l = 38),
    
    // Head
    move(head + [-4,0,-3])*yrot(45)*xscale(0.75), mb_cyl(d1 = 3, d2 = 8, l = 12),
    move(head), mb_cuboid([3,3,3]),    
    
    // Horns
    move(head), mb_connector([0,-2,5],[0,-2.5,8],0.3, cutoff = 1),
    move(head + [0,-2.5,8]), mb_sphere(0.5, cutoff = 1),
    move(head), mb_connector([0,2,5],[0,2.5,8],0.3, cutoff = 1),
    move(head + [0,2.5,8]), mb_sphere(0.5, cutoff = 1),
    
    // Ears
    move(head + [2,-8,4])* xrot(60) * scale([0.5,1,3]) , mb_sphere(d = 2, cutoff = 2),
    move(head + [2,8,4])* xrot(-60) * scale([0.5,1,3]) , mb_sphere(d = 2, cutoff = 2),
];

metaballs(spec, vsize, bbox,  show_stats = true);

...although I do quite like the way it looks a voxel_size = 0.5. But that takes 3 minutes to preview.

Image

@RAMilewski
Copy link
Contributor Author

Be sure to check the metaballs argument order on both of those. I think you were discussing changes to the argument order.

@RAMilewski
Copy link
Contributor Author

And a couple of tweaks to the bunny. Previews in about 40 seconds at voxel_size 1.

Image
include <BOSL2/isosurface.scad>

stats = false; // [true,false]

voxel_size = 1;
b_box = [[-22,-24,0],[20,20,78]];

body = [
    up(20) * scale([1,1.2,2]), mb_sphere(10), 
    up(10), mb_sphere(5),   
    up(50) * scale([1.2,0.8,1]), mb_sphere(10, cutoff = 15),
    move([0,-11,50]), mb_cuboid(2),
    move([5,-10,54]), mb_sphere(0.5, negative = true),
    move([-5,-10,54]), mb_sphere(0.5, negative = true),
    move([0,15,6]), mb_sphere(2, cutoff = 5),
];

// eyes
xflip_copy() move([5,-8,54]) color("skyblue") sphere(2, $fn = 32);
//teeth
xflip_copy() move([1.1,-10,44]) color("white") cuboid([2,0.5,4], rounding = 0.15);


hind_leg = [ 
    move([-15,-5,3]) * scale([1.5,4,1.75]), mb_sphere(5),
    move([-15,10,3]), mb_sphere(3, negative = true),
];

front_leg = [ 
    move([-9,-4,30]) * zrot(30) * scale([1.5,5,1.75]), mb_sphere(3),
    move([-9,10,30]), mb_sphere(2, negative = true),
];

ear = [
    yrot(10) * move([0,0,65]) * scale([4,1,7]) , mb_sphere(2),
    yrot(10) * move([0,-3,65]) * scale([3,2,6]) , mb_sphere(2, cutoff = 2, influence =2, negative = true),
];


color("BurlyWood") {
    metaballs(body, voxel_size, b_box, show_stats = true);
    xflip_copy() {
        metaballs(hind_leg, voxel_size, b_box, show_stats = true);
        metaballs(front_leg, voxel_size, b_box,  show_stats = true);
        metaballs(ear, voxel_size, b_box, show_stats = true);
    }
}

@amatulic
Copy link
Contributor

The tail of the giraffe looks fine with any voxel size if you remove the influence argument.

The new mb_cyl, now that it has more influence on its surroundings, really messed up the head and neck. Here's my attempt at repairing it. I had to shrink the dimension arguments for the head, neck, and body.

At voxel_size=0.85 it takes 1:08 to preview for me.

Image

include <BOSL2/std.scad>
include <BOSL2/isosurface.scad>

legD = 1;
tibia = 14; 
femur = 12;
head = [-35,0,78];  //head position
stance = [12,6];    //leg position offsets
vsize = 0.85;
bbox =  [[-45.5, -11.5, 0], [23, 11.5, 87.55]];

spec = [
    // Legs
    move([-stance.x,-stance.y]), mb_connector([-4,0,0],[-6,0,tibia],legD, influence = 0.2),
    move([-stance.x,stance.y]),  mb_connector([0,0,0],[0,0,tibia],legD, influence = 0.2),
    move([stance.x,-stance.y]),  mb_connector([-2,0,0],[-3,0,tibia],legD, influence = 0.2),
    move([stance.x,stance.y]),   mb_connector([0,0,0],[0,0,tibia],legD, influence = 0.2),

    move([-stance.x,-stance.y,tibia]), mb_connector([-6,0,0],[-2,0,femur],legD),
    move([-stance.x,stance.y,tibia]),  mb_connector([0,0,0],[0,0,femur],legD),
    move([stance.x,-stance.y,tibia]),  mb_connector([-3,0,0],[-1,0,femur],legD),
    move([stance.x,stance.y,tibia]),   mb_connector([0,0,0],[0,0,femur],legD),

    // Hooves
    move([-stance.x-6,-stance.y,1]),    mb_capsule(d= 2, h = 3, cutoff = 2),
    move([-stance.x-1,stance.y,1]),     mb_capsule(d= 2, h = 3, cutoff = 2),
    move([stance.x-3.5,-stance.y,1]),   mb_capsule(d= 2, h = 3, cutoff = 2),
    move([stance.x-1,stance.y,1]),      mb_capsule(d= 2, h = 3, cutoff = 2),

    // Body
    up(tibia+femur+10) * yrot(10),        mb_cuboid([16,7,7]),
    up(tibia+femur+15)*left(10),          mb_sphere(2),
    up(tibia+femur+8)*right(13)*xrot(90), mb_disk(1,4),
    
    // Tail
    up(tibia+femur+8), mb_connector([18,0,0],[22,0,-16], 0.4, cutoff = 1),
    
    // Neck
    up(tibia+femur+35)*left(22)*yrot(-30)* yscale(0.75), mb_cyl(d1 = 5, d2 = 3, l = 38),
    
    // Head
    move(head + [-4,0,-3])*yrot(45)*xscale(0.75), mb_cyl(d1 = 1.5, d2 = 4, l = 12, rounding=0),
    move(head), mb_cuboid(2),    
    
    // Horns
    move(head), mb_connector([0,-2,5],[0,-2.5,8],0.3, cutoff = 1),
    move(head + [0,-2.5,8]), mb_sphere(0.5, cutoff = 1),
    move(head), mb_connector([0,2,5],[0,2.5,8],0.3, cutoff = 1),
    move(head + [0,2.5,8]), mb_sphere(0.5, cutoff = 1),
    
    // Ears
    move(head + [2,-8,4])* xrot(60) * scale([0.5,1,3]) , mb_sphere(d = 2, cutoff = 2),
    move(head + [2,8,4])* xrot(-60) * scale([0.5,1,3]) , mb_sphere(d = 2, cutoff = 2),
];

metaballs(spec, bbox, voxel_size=vsize, show_stats = true);

@amatulic
Copy link
Contributor

amatulic commented Feb 25, 2025

I like how the bunny looks like it's smiling. Execution time can be much faster if each component has its own bounding box. Total time went from 1 minute to 10 seconds, for me.

For the duck, it might be better to make some soft indentations in the head, and then embed regular non-metaball spheres in those indentation to make eyes.

Image

@amatulic
Copy link
Contributor

I got the bunny down to 25 seconds (which would probably be 15 seconds on your machine) with voxel sizes smaller than 1. What helped the most was having separate bounding boxes for each component, and I shaved off several more seconds by saving the ear, hind leg, and front leg into VNF structures, and then uxing vnf_polyhedron() to render copies of them. In this way those metaballs don't need to be computed twice.

@RAMilewski
Copy link
Contributor Author

I think your giraffe fix is fine. Go with that. I want to fiddle with the horns and ears a bit, but we can update that in some future post-release PR. I feel really dumb about the bounding_boxes on the bunny! I even went through the console and added up all the voxel bounding box spaces to set the overall number!

Putting them into VNFs is the obvious way to handle reusing and distributing parts if they're not in the same call to metaballs().
The bunny example would be a good place to make that point explicitly in the docs.

@amatulic
Copy link
Contributor

Yes, I did make that point in the example in the docs. It's in the latest version of the PR #1566

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants