discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Irregular mesh generated

K
kitwallace
Fri, Sep 11, 2015 7:45 AM

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.

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.
MS
Mark Schafer
Fri, Sep 11, 2015 11:11 AM

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
Discuss@lists.openscad.org
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

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 > Discuss@lists.openscad.org > 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 > >
K
kitwallace
Fri, Sep 11, 2015 4:18 PM

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.

--
View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13772.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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. -- View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13772.html Sent from the OpenSCAD mailing list archive at Nabble.com.
DB
don bright
Fri, Sep 11, 2015 11:28 PM

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
hmbright@fastmail.fm

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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 hmbright@fastmail.fm 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
TH
Tim Hawkins
Sat, Sep 12, 2015 12:02 AM

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 hmbright@fastmail.fm 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
hmbright@fastmail.fm

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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

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 <hmbright@fastmail.fm> 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 > hmbright@fastmail.fm > > 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 > > Discuss@lists.openscad.org > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
N
Neon22
Sat, Sep 12, 2015 5:59 AM

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
http://forum.openscad.org/file/n13778/Wings3D_001112a.jpg
http://forum.openscad.org/file/n13778/Wings3D_001117a.jpg

--
View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13778.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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 <http://forum.openscad.org/file/n13778/Wings3D_001112a.jpg> <http://forum.openscad.org/file/n13778/Wings3D_001117a.jpg> -- View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13778.html Sent from the OpenSCAD mailing list archive at Nabble.com.
R
runsun
Sat, Sep 12, 2015 7:40 AM

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, are divided into multiple segments:

http://forum.openscad.org/file/n13779/Oloid_20150912_KitWallace.png

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)?mmlen/dist(pq):ratio)
[ L
dist(pq,"x")+pq[0].x
, Ldist(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: doctest , faces ( git ), offliner ( git );

tips: hash( 1 , 2 ), sweep , var

$ -- Linux Mint 17.1 Rebecca x64  + OpenSCAD 2015.03.15/2015.04.01.nightly

--
View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13779.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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, are divided into multiple segments: <http://forum.openscad.org/file/n13779/Oloid_20150912_KitWallace.png> 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: doctest , faces ( git ), offliner ( git ); tips: hash( 1 , 2 ), sweep , var $ -- Linux Mint 17.1 Rebecca x64 + OpenSCAD 2015.03.15/2015.04.01.nightly -- View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13779.html Sent from the OpenSCAD mailing list archive at Nabble.com.
K
kitwallace
Sat, Sep 12, 2015 7:52 AM

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.

--
View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13780.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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. -- View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13780.html Sent from the OpenSCAD mailing list archive at Nabble.com.
K
kitwallace
Sat, Sep 12, 2015 9:44 AM

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.

--
View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13781.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

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. -- View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13781.html Sent from the OpenSCAD mailing list archive at Nabble.com.
N
Neon22
Sat, Sep 12, 2015 10:38 AM

@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.

--
View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13782.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

@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. -- View this message in context: http://forum.openscad.org/Irregular-mesh-generated-tp13765p13782.html Sent from the OpenSCAD mailing list archive at Nabble.com.