Geometry Builder (featuring CSG Subtraction)

Over past several months we’ve got questions about why don’t we support CSG subtraction. I know it’s very frustrating to see all those solids and not be able to subtract one from other. 😀

Well your wait is over. Today we are introducing Geometry Builder which lets you do just that. Here’s a screenshot that should explain the idea in a glance.

Now let me explain the details of how it works. But before that, let me explain why we took so long.

We have long been using the Cadmium solid modeling library that we open sourced last year to do CSG boolean operations on the server. That is how we build all the templates that you can customize and add to your models. But offering these CSG operations in interactive environments inside the browser is a different ball game.

1. CSG algorithms are expensive, they are too slow for meaningful interaction
2. They have to be run on server, so the interactivity suffers depending upon speed of your network connection
3. The nature of boolean operations makes the interaction strategy difficult (How do you move a solid that is to be subtracted or in other words is invisible)

Of course others have already tried to solve this problem, on desktop as well as in browser. However we had to implement a solution that will solve all of the above problems and will be cheap at the same time. If we tried to run CSG algorithms on our servers while you manipulate the shapes in your browser, we will have to make them super fast and scalable, which will require very expensive hardware/software setup. And still you will get sluggish response if your network is slow.

To solve these problems we invested some quality time earlier this year implementing a completely different solution. We implemented a CSG algorithm that runs in browser and runs very quickly. I wrote about it in the past when we introduced Interactive Template Editor. Since then we have improved the algorithm further to make it produce better results and fixed some issues that makes it run on all browsers and platforms that support WebGL (previously it had problems on Windows machines running WebGL via Angle).

Now we are using the same algorithm to give you interactive CSG editing.

If you want to build custom geometries by subtracting a set of solids from other, then you can click the new button in the Shapes bar – “Make your own geometry”

That will launch the Geometry Builder dialog. This is a mini editor, similar to the main editor you use. Its purpose however is very specific. It allows you to add only primitive geometries (Cylinder, Box, Sphere, Torus). After adding them you can click on them to change their properties (radius, height, etc) and apply different transforms (rotation, shear, scale, etc.). Most importantly you will see a checkbox named “Subtract”. If you check it, the geometry will go red in editor, but in the preview section you will see it subtracted from other solid. You can keep making changes to your geometries and the preview will update immediately reflecting the changes you make.

This approach has the benefit that you can manipulate the solid to be subtracted very easily, even though it’s meant to be hollow. You do the changes in the editor where you see this solid in red and the preview shows the subtracted solid as a hollow carved into another solid.

When you are happy with the results, click the Build button. Now the geometry will be shipped to the server and will be baked into a proper mesh that you can add to your model, this should happen within seconds. You can add any number of instances of this geometry to your main model. You can perform all the regular operations on it as well. If you want to make any changes to it in future, click on it and press the Edit icon. The geometry will be opened in the Geometry Builder in the state that you left it in before.

This feature opens up possibilities for really wild solid geometries. I can’t wait to see what you make of it.

As always, if you find any bugs, please drop us a note.

This entry was posted in Uncategorized. Bookmark the permalink.

19 Responses to Geometry Builder (featuring CSG Subtraction)

1. Rose says:

I see no option to control the exact location of any of the pieces made in Geometry Builder. I really like having this option in the main screen, in fact the only thing the main screen cannot do for me is a Boolean operation.

2. JayGeeBee says:

I seem to be doing something wrong. I used Geometry Builder to create a simple rectangular block, very thin (.04 units). I built that and it appeared in my design fine. Then to add to it I clicked on it and selected Edit to return to Geometry Builder. All fine so far. I edited it adding some holes using the subtract feature and then “built” it. Returning to the design the holes are not present, it is shown exactly as the original block with no holes. What am I doing wrong?

• jyro says:

Can you post a link to your model? If you try a different position of holes, does it take effect?

3. JayGeeBee says:

I moved all 3 holes, built and there was no change in the design. Here is the link, I think http://www.3dtin.com/1tae

• jyro says:

Here’s a workaround. Increase the height of holes from 1 to 10. That worked for me.

4. JayGeeBee says:

Yup, that worked. At least now you have something to do. 🙂

Thanks.

5. Marcus says:

Wasted a load of work in this by pressing escape by mistake. That’s VERY annoying. Also you cannot place things exactly. You can turn grid snapping off, but that’s hardly accurate. An object align and relative move are very basic needed functions that are missing.

6. Marcus says:

There’s no “Undo”

7. 99guspuppet says:

How do you copy an object into *geometry builder” ?

8. 99guspuppet says:

regarding http://www.3dtin.com/9dve ……….How do I subtract my yellow and gray connector from a blue 50% cylinder ?

• jyro says:

Hi, you are correct that one cannot copy objects from the main view of the model to the Geometry Builder view. In the sketch you mention above, you would have to create the half cyclinder, the yellow and gray connectors anew in the geometry builder and then perform the subtraction operation on them.

9. AndyB says:

I am trying a simple subtraction to create a sort of tube (subtract one cylinder from another) – the preview looks perfect but when I hit build, all I get is “err_internal”.

• jyro says:

Hi Andy, can you try again? The problem should have been fixed now.

• AndyB says:

awesome! thanks – it works like a charm now!

• AndyB says:

btw, if you could figure a way to ghost/un-ghost elements in the builder, it would make working much easier. For example, I’ve tried to re-create the hemispherical shell, using a 2 spheres and a cube. If I could see “through” some of the objects, positioning would be much easier! Note: As I type this I realize that modifying my workflow could also help, but I still think a transparency feature would be a good addition. Thanks!

10. AndyB says:

…and as someone else mentioned, an alignment feature between objects in the builder is a must!

11. Katie says:

I am getting the err_internal as well,… Any suggestion?

12. Dave says:

Why not just build things in the regular window but with a different color and then have an option to turn that color into anti matter? example – build a counter sunk screw hole with a green cone and cylinder, place it into the red part, and turn it into air.