I am running into what honestly seems like a bug in OpenSCAD, but I can't believe that something so simple could reveal a bug. I am trying to render the following code:

module tri_prism(base1, base2) {
        base1[0], base1[1], base1[2],
        base2[0], base2[1], base2[2]],

union() {

This should render two (non-overlapping) triangular prisms, like so:

Two triangular prisms side-by-side

However, this image is only the preview. When I hit F6, it renders this, with only the triangular bases being rendered:

Only the triangular bases are rendered

And the console shows this warning, which I don't know the meaning of because I am a beginner:

UI-WARNING: Object may not be a valid 2-manifold and may need repair!

Each of the prisms individually renders just fine, but the two of them together don't. Also, it is not merely a problem of appearance since exporting it as STL and opening it in Cura, I see the same useless nonsense.

Is this a bug or am I doing something wrong? And if it is a bug, how do I work around it?

  • 2
    $\begingroup$ If you are opening these files in Cura, then presumably you are going to (eventually) 3D print them, once you have fixed the issue described in your question? $\endgroup$
    – Greenonline
    Commented Feb 18, 2022 at 14:24

1 Answer 1


This is a case of "Mis-ordered faces".

That means the order in which the vertices making up one or more faces aren't in the correct order. The vertices of a face should be listed in clockwise order from the perspective of a camera looking at the face form the exterior of the polyhedron.

In this case, the problem can be solved by reordering the [0,1,2] face of the tri_prism polyhedron as, for example, [0,2,1].

The misordered face(s) can be found by enabling the Thrown Together option from the View menu and Previewing. The faces in question will be shown in magenta.

Why, then, if the faces are mis-ordered, did the prisms render just fine individually? My guess is that faces have to be properly ordered to be sure to get a correct Render. The behavior of Render is simply indeterminate for polyhedra with misordered faces. It can work in some situations, but it's not guaranteed.

Edit: I forgot to add that, in my opinion, this shouldn't be an issue, and that if it's such a big problem for the Rendering subroutine, it should intelligently reorder the mis-ordered faces in a prelude. It would avoid beginners such needless troubles.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .