algorithmic modeling for Rhino
I was trying to figure out how to trace an image directly by grasshopper.
It is really time consuming if I manually trace a complicated image using the bitmap method.
If possible can anyone post the grasshopper file for tracing image.It doesn't need to be very accurate.
There had been a discussion on it before but it did not give me the output as I saw.There might be some error in the file I created.
Could anyone post the working grasshopper file for it?
Tags:
FYI: After saving the Meshmixer re-meshed file to .OBJ
http://www.holmes3d.net/graphics/meshman/ Meshman does a great Catmull-Clark subdivision of the same mesh.
One thing I just noticed about Kangaroo is that some of the components are just clusters, such as Pressure Force containing Pressure:
And Springs From Mesh is also a cluster containing Springs:
I wish Kangaroo 2 had mesh fabric since I believe it's more sophisticated.
So the pressure force only works on triangles but I have a quad mesh, eh? It's first step is to triangulate, thus *doubling* the force items! Ouch. Got to be a better way. Works though.
Kangaroo Unary Force is much much faster than Pressure Force, like 30 milliseconds rather than 3 minutes for a 150X150 quad mesh, though it only acts in one vector direction. Fine! That's what I want instead of ballooning outwards, just puffing upwards.
THIS WILL WORK! Creating the mesh springs is only three seconds for 200X200 and the Unary Force is still milliseconds. Only Kangaroo takes an initiation time then cycles rapidly (0.5 seconds each) and it only takes a few cycles, maybe a dozen or two.
There is considerable 3D aliasing from the 2D mesh crudeness.
Now, to best Laurent's scheme, let's double down to 400X400. First I disable Kangaroo, and the timer. The preparation takes...FOREVER....and...ever...4.6 minutes to cull the points is all, a trivial step there is likely a better strategy for than finding the ones on the inside then using those to cull duplicates from the whole collection. The springs only took 12 seconds and the forces again milliseconds.
Kangaroo, to initialize takes...after hitting the reset button to start it...over 15 minutes and counting...well 400X400 is 160K vertices and Rhino tends to bog down at 30K points...but it was done in 30 minutes. Then I enable the timer and each cycle takes...uh...it's not in any error mode but nothing is happening past a very faint first automatic cycle that shows in the mesh...yet no CPU power is being used by Rhino...well...it's simply not running...ah, well, there's just a dummy delay of another 5 minutes and then the cycles take 2.7 seconds...what a stupid delay that was not using CPU power.
Now that it's cycling, can I change the stiffness in real time, usually I can...well, no, I seem to be back in the 5 minute delay, but not the 30 minutes interface-locking one...still waiting. Here is a 1/4 scale height model of the above output:
Time's up, life goes on. The aliasing and slow speed make it unworkable except for little logos or something. Some math and parallel processing are needed?
OK so I discovered two main things:
(1) Kangaroo Pressure Force is quite slow and only acts on triangles, but can be replaced by Unary Force.
(2) Cheating by using a singular bounding box mesh results in extreme aliasing effects that carry into the 3D realm as regular steps along what should be smooth surfaces.
On sleeping on it, I realized I hadn't yet tried fast Unary Force on fine quad meshes from the standard Grasshopper meshing system that includes the meshing options component.
Bingo! It's fast now. Workable. I don't need super fine meshing since I'm not running from aliasing. I can still use rather fine local meshes since Unary Force lets Kangaroo do a simple thing just in the Z direction rather than a full 3D force.
After only a minute or so of Kangaroo initialization that slows the interface, each of a dozen needed cycles takes half a second, FOR THE ENTIRE GRAPHIC.
I just set the timer to 1 second so I can move around the interface, and I double click the Windows taskbar timer shut-off to enjoy the result.
WHILE RUNNING VIA TIMER, IF I CHANGE A SPRING/FORCE SETTING IT SUFFERS NO DELAY AT ALL AND JUST ALTERS THE OUTPUT OVER TIME. I can change Unary Force from 20 to 100 and immediately see the bigger areas balloon like crazy:
It's fast enough overall to play with, yet the individual steps are slow enough that it's fun to watch the hysteresis as it overshoots back from 100 to 20 Unary Force, going concave in the middle of bulges then back to more shallow hills.
A force of 1000 is a bit disturbing, I wonder if I can tamp it down with greater spring strength or will that just give me the same result as before?
Looks like it's the same, just the ratio matters. Makes sense I guess. At one point it blew up though. Hitting the reset button...a minute later it blows up again...and just doesn't like huge numbers, so I don't see an advantage playing with bombs. The high mesh strength is pulling the mesh apart.
With low Unary Force and moderate mesh tension, you get flat tops, as if the overall force on the mesh fighting its anchored edge vertices, is enough to displace it, but the surface itself is too stiff to care about local gravity.
Then you have less flat areas as you increase Unary Force:
Weird, there *is* some sort of absolute effects, rather than just relative, between Unary Force and spring stiffness, since now I'm getting flat tops even in the extreme:
Oh, wait, strike that, I may be seeing but a single step with the timer off, subject to hysteresis. With the timer back on...it can sit there a minute...not locked up but just idling...until you see the Display > Widgets > Profiler time start cycling to near half minute numbers...makes you want to hit the reset button...and indeed that locks the interface for another initialization...and yes, it was merely hysteresis, not an equilibrium result. My former flat tops may have been due to that too, due to my use of the Windows taskbar timer disabler. The lesson is that you can obtain different results by using a long timer setting and just stopping it before it equilibrates.
This script is a keeper, fast and fun after the relatively mild Kangaroo initialization period is over.
The uniform mostly quad meshing is all done in Grasshopper too, from any flat surface with holes, especially from images of shapes that are traced with potrace to give surfaces with holes.
Could I switch to hex meshes from triangular meshes to do the same thing with fewer vertices?
Are there other forces I can add to smooth the bulging? Letting things bulge is not so bad if you then just scale down the result in Z afterwards (though perhaps the same result could be had with lesser force):
Also, can this same thing be done with possibly faster Kangaroo 2?
Here is a convenient potrace.exe parser for Grasshopper, a Python script that lets you select an input file via Grasshopper, fires off potrace, then reads back in the potrace DXF file and outputs it to Grasshopper as a list of closed polylines as well as a superior hole-smart set of planar surfaces:
You can tweak the potrace flags by double clicking to open the Python code.
Running the polylines into a Grasshopper Surface component fails to consider holes smartly, and bizarrely lacks a component for the normal PlanarSrf command:
Potrace compiled binary program versions:
http://potrace.sourceforge.net/#downloading
Enclosed in Win64 version and Shubman's sample file that works even with the watermark on it.
Thanks a lot for all that research Nick.
From a "simple" question you lead me (us ?) thru all your detailed answers & accompagning gh definitions too a passionating stream of differents tries toward something usable.
You are kind of motivating guy that push me (us ?) to try more stuff. I could'nt say nothing!
Cheers from cloudy Marseille
I did not get how to create the parser tool mentioned above since I am new to grasshopper .
please help.
And thank you for your detailed suggestions.
They have proved to be of great help to me.
My Monday post ( http://www.grasshopper3d.com/xn/detail/2985220:Comment:1468521 ) has a Grasshopper file you can ignore any complicated part of, keeping just the Python script.
You will have to install Grasshopper Python:
http://www.food4rhino.com/project/ghpython
You will have to install parser.exe too, which is just a downloaded directory, and point the Python to it by right clicking the file path component leading into the Python component.
Run a picture in by right clicking the other input to Python and out should come traced polyline and optionally surfaces too.
He Nik. I am new to Grasshopper. I saw that you made a potrace parser which come in very handy for me! Thank you very much for sharing this unique tool!
I was wondering if there is a way to change the input of the parcer to smoothen the polyline surfaces.
Beneath is a picture of a fingerprint, but I would like to get rid of the tiny surfaces and smoothen the larger surfaces.
Do you have any idea how I could achieve this?
A possibly superior way to puff these up into 3D is here:
http://www.grasshopper3d.com/forum/topics/puffing-of-flat-surfaces-...
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by