Irregular mesh generated

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

Irregular mesh generated

kitwallace
My apologies since this is only marginally an OpenSCAD question:

I had the idea of creating more organic objects by algorithmicly generating models in OpenSCAD and then manually modifying them with Sculptris.   Aside from the need to convert STL to OBJ (why isnt OBJ exportable BTW?) , the models tear very easily.  This is probably because the mesh generated by OpenSCAD contains very irregular triangles. One test case is two spheres hulled, creating long connecting strips split into two skinny triangles.

Can anyone suggest a way of remeshing to create a more regular triangulation.

Chris
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

Neon22
Hi Kit,
I would suggest loading the stl into Wings3D and then selecting the
useful faces to subdivide and add more faces/detail that way . Its an
excellent watertight modeller.
1. Select all Faces, Untriangulate
2. Select a face, Select faces with similar area
3. do a sequence of inset, bevel ops until have desired density.
4. Export

However it can't read the stl variant that openscad writes :(
  - (OpenSCAD can read the watertight stl that Wings3D generates).
So if you wanted to use it you'd have to load it into something else
first, then export as obj or stl and try another variant of the format.

I imagine Blender works as well... but not as familiar with the polygon
tools...


On 9/11/2015 7:45 PM, kitwallace wrote:

> My apologies since this is only marginally an OpenSCAD question:
>
> I had the idea of creating more organic objects by algorithmicly generating
> models in OpenSCAD and then manually modifying them with Sculptris.   Aside
> from the need to convert STL to OBJ (why isnt OBJ exportable BTW?) , the
> models tear very easily.  This is probably because the mesh generated by
> OpenSCAD contains very irregular triangles. One test case is two spheres
> hulled, creating long connecting strips split into two skinny triangles.
>
> Can anyone suggest a way of remeshing to create a more regular
> triangulation.
>
> Chris
>
>
>
> --
> View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 2015.0.6125 / Virus Database: 4419/10616 - Release Date: 09/10/15
>
>


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

kitwallace
Thanks for the tip.  I've not encountered Wings 3D and its a wonderful tool and great fun.

However I can't get your suggestion to work on the objects I have in mind with skinny triangles eg. the Oloid see http://kitwallace.tumblr.com/post/85636282539/oloid generated by

module oloid(r,h=0.1) {
   hull() {
     cylinder(r=r,h=h);
     translate([0,pow(2,0.5)*r,0])  // two-point roller
         rotate([0,90,0])
            cylinder(r=r,h=h);
   }
};

$fn=50;
oloid(20);

(actually Wings finds holes in this solid)

Seems to me that inset and bevel just makes even more skinny triangles.  
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

donbright
In reply to this post by kitwallace
I was working on OBJ last year but had some personal challenges that
interfered and I dropped the ball, sorry to all. I think Giles
implemented OBJ export in a branch somewhere. Alternative meshing is
possible but non trivial. Do you have a triangulation algorithm that you
have in mind that you would prefer? And how would the UI work? A
check-mark button that is displayed when the user clicks export?

--
  don bright
  [hidden email]

On Fri, Sep 11, 2015, at 02:45 AM, kitwallace wrote:

> My apologies since this is only marginally an OpenSCAD question:
>
> I had the idea of creating more organic objects by algorithmicly
> generating
> models in OpenSCAD and then manually modifying them with Sculptris.  
> Aside
> from the need to convert STL to OBJ (why isnt OBJ exportable BTW?) , the
> models tear very easily.  This is probably because the mesh generated by
> OpenSCAD contains very irregular triangles. One test case is two spheres
> hulled, creating long connecting strips split into two skinny triangles.
>
> Can anyone suggest a way of remeshing to create a more regular
> triangulation.
>
> Chris
>
>
>
> --
> View this message in context:
> http://forum.openscad.org/Irregular-mesh-generated-tp13765.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

Tim Hawkins

You guys looked at assimp?

http://assimp.sourceforge.net

Input/output library supporting a vast number of 3d mesh formats.


On Sat, Sep 12, 2015, 07:28 don bright <[hidden email]> wrote:
I was working on OBJ last year but had some personal challenges that
interfered and I dropped the ball, sorry to all. I think Giles
implemented OBJ export in a branch somewhere. Alternative meshing is
possible but non trivial. Do you have a triangulation algorithm that you
have in mind that you would prefer? And how would the UI work? A
check-mark button that is displayed when the user clicks export?

--
  don bright
  [hidden email]

On Fri, Sep 11, 2015, at 02:45 AM, kitwallace wrote:
> My apologies since this is only marginally an OpenSCAD question:
>
> I had the idea of creating more organic objects by algorithmicly
> generating
> models in OpenSCAD and then manually modifying them with Sculptris.
> Aside
> from the need to convert STL to OBJ (why isnt OBJ exportable BTW?) , the
> models tear very easily.  This is probably because the mesh generated by
> OpenSCAD contains very irregular triangles. One test case is two spheres
> hulled, creating long connecting strips split into two skinny triangles.
>
> Can anyone suggest a way of remeshing to create a more regular
> triangulation.
>
> Chris
>
>
>
> --
> View this message in context:
> http://forum.openscad.org/Irregular-mesh-generated-tp13765.html
> Sent from the OpenSCAD mailing list archive at Nabble.com.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

Neon22
In reply to this post by kitwallace
Hi Kit,
I made on at 30 and tried smoothing it. bit wobbly.
Then I made at 50 and simply selected all the edges and cut into 10 then connected them.
Worked pretty well but there are two extra edges in there. Perhpas the mechanism you used to get it into wings3D somehow made a bad object but my mechanism worked just fine. (no one can afford my mechanism).
So here's two images and I have a model for you if you'd like..
ping me by email if you want it. Its 125kB
wobbly smoothed version
manually cut version
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

runsun
This post was updated on .
In reply to this post by kitwallace
Since the points can be obtained through function, it is possible to make more points along the hull lines. In the following figure, a hull line, PQ, which we already know the coordinates, is divided into multiple segments:



Here are the two functions I use to create those segment points:
function onlinePt ( pq, len=undef, ratio=0.5 )=
(
    let( pq = [pq[0],pq[1]]
       , L = isnum(len)?mm*len/dist(pq):ratio)
        [ L*dist(pq,"x")+pq[0].x
        , L*dist(pq,"y")+pq[0].y
        , L*dist(pq,"z")+pq[0].z ]
);

function onlinePts ( pq, lens=false, ratios=false )=
(
        ratios==false?
        ( len(lens)==0?[]
          : [for(l=lens) onlinePt( pq, len=l)]
        ):
        ( len(ratios)==0?[]
      : [for(r=ratios) onlinePt(pq,ratio=r)]
        )
);
The 1st ( onlinePt ) creates a single pt between PQ, the 2nd ( onlinePts ) creates multiple pts. Some required functions are not included, but they are straightforward and easy to make.

I use the following to create the above segment pts:
    onlinePts( [P,Q] ratios=[0:0.1:1] )


kitwallace wrote
Thanks for the tip.  I've not encountered Wings 3D and its a wonderful tool and great fun.

However I can't get your suggestion to work on the objects I have in mind with skinny triangles eg. the Oloid see http://kitwallace.tumblr.com/post/85636282539/oloid generated by

module oloid(r,h=0.1) {
   hull() {
     cylinder(r=r,h=h);
     translate([0,pow(2,0.5)*r,0])  // two-point roller
         rotate([0,90,0])
            cylinder(r=r,h=h);
   }
};

$fn=50;
oloid(20);

(actually Wings finds holes in this solid)

Seems to me that inset and bevel just makes even more skinny triangles.
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

kitwallace
In reply to this post by donbright
Don,  An alternative algorithm which traded  minimal number of triangles for triangle regularity would be great. Looking at http://doc.cgal.org/latest/Mesh_3/ it looks the parameter cell_radius_edge_ratio could control the mash topology as required here.  Perhaps this and maybe other rendering parameters could be set in Edit/Preferences/Advanced?

Neon22, Many thanks for your efforts - much appreciated.  My efforts were less successful than yours, with many unconnected vertices.  I'll ping you for the file to see how it works in Sculptris.
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

kitwallace
In reply to this post by runsun
Runsun , Great idea - that leads to a better way for creating a ruled surface directly as a polyhedron rather than the clucky hulled cylinders I had been using.  

In general though I think it would be useful to be able to generate meshes with a topology and format compatible with other tools such as Sculptris and Wings.
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

Neon22
In reply to this post by Tim Hawkins
@timHawkins
I just tried assimp.
Regrettably it took every polygon in the stl file and saved it as an obj with no shared vertices at all.
So for our purposes - this is not a useful library for conversion.

It may be useful to export to obj but would need eval for that.
Not sure where the error lies - in the obj writer or the stl reader, or the internal representation of objects.
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

kitwallace
For Wave 3D I just need to convert the STL to binary and assimp does this OK.  Doesn't help with Sculptris however..  It would be really good to add OBJ format export (and Binary STL?)  to OpenSCAD. Sounds like its nearly done anyway?
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

kintel
Administrator
Hi all,

To summarize a bit:
o Our OBJ export issue: https://github.com/openscad/openscad/issues/351
o Binary STL would make sense. This issue needs to be addressed: https://github.com/openscad/openscad/issues/649
o Looks like Wings3D only supports binary STL. They should really improve the importer since most people tend to use ascii STL.
o Having a meshing option which guarantees some sane triangle aspect ratio would be really good. The challenge is dealing with small/null triangles, so we might have to combine this with some sort of decimation algorithm to merge redundant small triangles.

Btw., we have the same issue when creating twisted linear extrusions, but with a much worse effect on the geometry.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

nophead
When 3D printing you want the least triangles that tessellate the vertices. Extra ones cause more line segments in the slice and some slicers pass those on to gcode.

On 12 September 2015 at 16:06, Marius Kintel <[hidden email]> wrote:
Hi all,

To summarize a bit:
o Our OBJ export issue: https://github.com/openscad/openscad/issues/351
o Binary STL would make sense. This issue needs to be addressed: https://github.com/openscad/openscad/issues/649
o Looks like Wings3D only supports binary STL. They should really improve the importer since most people tend to use ascii STL.
o Having a meshing option which guarantees some sane triangle aspect ratio would be really good. The challenge is dealing with small/null triangles, so we might have to combine this with some sort of decimation algorithm to merge redundant small triangles.

Btw., we have the same issue when creating twisted linear extrusions, but with a much worse effect on the geometry.

 -Marius


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Irregular mesh generated

runsun
In reply to this post by kitwallace
kitwallace wrote
In general though I think it would be useful to be able to generate meshes with a topology and format compatible with other tools such as Sculptris and Wings.
Sure. It's always better to have features built-in. I'm still hoping that someday openscad can report coordinates of a shape ...
$ Runsun Pan, PhD
$ libs: scadx, doctest, faces(git), offline doc(git), runscad.py(2,git), editor of choice: CudaText ( OpenSCAD lexer); $ Tips; $ Snippets