Using Blender Python to create maille.
View previous topic | View next topic >
Post new topic Reply to topic
M.A.I.L. Forum Index -> Knitting Circle
   
Author Message

Joined: September 30, 2012
Posts: 255
Submissions: 13
Location: Sweden

Reply with quote
Posted on Thu Oct 24, 2013 5:17 pm
Link to Post: Link to Post

Carolides wrote:
BTW
Is there any intrest in the subject? So i don't "bump" the thread in vain.

BR
C


Absolutely! I love both Blender and chainmaille!


"When in doubt... C4" - Jamie Hyneman

My YouTube channel: http://www.youtube.com/wpa09
My band: http://www.facebook.com/carnosus

"This is an art form, and we love to be recognized for our own work, and we'd all hope not to be confused with someone else."
- Charon, March 27, 2009

Joined: January 17, 2013
Posts: 373
Submissions: 5
Location: Probably in the garage...

Reply with quote
Posted on Thu Oct 24, 2013 5:38 pm
Link to Post: Link to Post

Carolides: I certainly think so, I'm thrilled with what Blender can do. Your work on the scripting is fabulous.
Once some of the kinks are worked out I'm expecting we should be able to provide people with simple instructions and scripts for just about any weave out there for either fun or learning purposes.
Why prototype with real rings when I can just use virtual ones to test weave interactions.
I'm often surprised what a weave looks like in one direction vs another. Being able to rotate/hang and look at a weave from different angles/positions can be quite helpful when learning a new weave and Blender fills that need quite well.


Mostly Harmless

Joined: September 24, 2012
Posts: 93
Submissions: 1
Location: Stockholm, Sweden

Reply with quote
Posted on Fri Oct 25, 2013 6:56 am
Link to Post: Link to Post

Good.
I will stop porting here.
Things need to be organized in order for less experienced Blender users to be able to use the scripts.

Levi: Could you post the parameters for your textures? I can add them to the script library.
I agree that using Blender can visualize an idea. But it can also be a plattform to create tutorial animations.

Zlosk has a script that creates open rings. Very nice indeed.

I will create comments for all the stuff i have done and try to make functions.

Will look at TrenchCoatGuys algorithms for JPL. The JPL looks nice.

Joined: January 17, 2013
Posts: 373
Submissions: 5
Location: Probably in the garage...

Reply with quote
Posted on Fri Oct 25, 2013 2:25 pm
Link to Post: Link to Post

Carolides wrote:

Levi: Could you post the parameters for your textures?


If you're talking about the mat applied to the rings in the J4in1 sheet I posted the other day, do the following.
Make sure you have Cycles as the selected renderer. The material applied to the rings is a "Glossy BSDF" with an HTML color value of "A3A3A3" and a roughness of "0.100".
That alone will only do so much, the background image and the plane the rings are sitting on play a big role in making the rings look the way they do.

For Gold like rings I'm currently using "anisotropic BSDF" with color "FFF213" and "0" for Roughness but it's not quite right.

On another note:

I played around with the E4in1 script and got some numbers to show how things scale. I have some gaps in my values but I think it's enough to display what happens as the loop count increases.

To create a larger sheet I'm changing the i_loopindex_outer = -* and i_loopindex_inner = -* values, here are the results from my i7 860. I started the timer as I clicked on the Run Script button. During this time Blender seems to be doing nothing until it completes and all of the rings suddenly pop into existence. Between each run I reloaded the standard Blender start-up file to clear the traces of the previous script, if you don't clear Blender each time things get weird.

10x10 4sec
20x20 58sec
21x21 75sec
22x22 100sec
23x23 127sec
24x24 203sec
30x30 610sec (10minutes)
60x60 After 8 hours I stopped it. Not certain I cleared Blender prior to trying it so maybe that's why it never completed. I'll try again tonight.

Once I have some more samples I'll plot the data out but off the top, for each extra loop beyond -20 things seem to slow down significantly adding another 30 seconds or so for each extra loop.
While the script starts running with as many threads as you have cores in your processor (8 virtual cores in my case), all but one thread goes idle after about 10 seconds after that one other thread uses a 100% of a core until the script is done.


Mostly Harmless

Joined: August 05, 2010
Posts: 623
Submissions: 28
Location: Bar Harbor, ME, USA

Reply with quote
Posted on Fri Oct 25, 2013 3:25 pm
Link to Post: Link to Post

Did you check memory after the 8 hours? It could be capping the normal RAM and turning to virtual - which is horrible time wise.


while(!project.isFinished())
project.addRing();
// Maille Code V2.0 T7.1 R5.6 Eo.n Fper MFe.s Wsm Caws G0.8-1.6 I2.4-8.0 Pn Dcdejst Xw1 S07

Joined: January 17, 2013
Posts: 373
Submissions: 5
Location: Probably in the garage...

Reply with quote
Posted on Fri Oct 25, 2013 3:34 pm
Link to Post: Link to Post

Yep, Blender was up to 2.9GB of memory usage. System was at 4.8GB of total usage. Both kept climbing but I gave up. I have 8GB in this box, running Linux Mint 15 and the swap usage was only at 2MB if memory serves and that was probably my browser sessions that got paged out.

As I mentioned I'm not a 100% certain I cleared Blender out properly prior to that run, it was late and I was excited. I've had 20x20 runs die out looping forever if I don't clear Blender between each click of Run Script.


Mostly Harmless

Joined: January 17, 2013
Posts: 373
Submissions: 5
Location: Probably in the garage...

Reply with quote
Posted on Sat Oct 26, 2013 2:19 pm
Link to Post: Link to Post

Success!

Somewhere after 6 hours and less than 10 hours the script completed at 60x60 with all 7442 rings happily in place.

The saved .blend file is only 421MB but when opened it drives Blenders RAM usage to 3.3GB.

It took 2.5 minutes to render the above image using the Blender Render but due to paging it takes another 4-5 minutes for Blender to become responsive again.

Blender says it peaked at 8534.42MB or 8.5GB while rendering. So if you only have 4GB of RAM you probably shouldn't try generating a 60x60 sheet and even with 8GBs it gets real slow. Just closing Blender after rendering that image took around 15 minutes.

My total system memory usage was around 12GB after rendering that image, I'm going to bump this box up to 16GB (sadly it's max) and see how things go from there until then I'm going to play with smaller sheets.


Mostly Harmless

Joined: September 24, 2012
Posts: 93
Submissions: 1
Location: Stockholm, Sweden

Reply with quote
Posted on Sat Oct 26, 2013 9:53 pm
Link to Post: Link to Post

Nice Smile

Don't try to animate it Smile it will kill your comp.

Br
C[/list]

Joined: September 24, 2012
Posts: 93
Submissions: 1
Location: Stockholm, Sweden

Reply with quote
Posted on Sat Oct 26, 2013 10:07 pm
Link to Post: Link to Post

Have an idea i will try tommorow.
Instead of trying to create a 100x100 sheet why not break it down to smaller pieces ex. 100 10x10 sheet storing away the relevant start cordinates.

Will look around to see if there is a way to garbage collect the Blender session so resources get freed.

According to you calculation 10x10 took 4 secs. That would result in 400 sec run for a 100x100 sheet.

00:04 here so sleep time soon.

Br
C

Joined: September 30, 2012
Posts: 255
Submissions: 13
Location: Sweden

Reply with quote
Posted on Sun Oct 27, 2013 1:05 pm
Link to Post: Link to Post

Levi wrote:
Success!


That looks really good. I feel like I can't do that to my computer haha. It would hate me forever. Looks really promising though!


"When in doubt... C4" - Jamie Hyneman

My YouTube channel: http://www.youtube.com/wpa09
My band: http://www.facebook.com/carnosus

"This is an art form, and we love to be recognized for our own work, and we'd all hope not to be confused with someone else."
- Charon, March 27, 2009

Joined: September 24, 2012
Posts: 93
Submissions: 1
Location: Stockholm, Sweden

Reply with quote
Posted on Mon Oct 28, 2013 6:47 pm || Last edited by Carolides on Wed Oct 30, 2013 1:43 pm; edited 1 time in total
Link to Post: Link to Post

Removed old code

Joined: February 7, 2012
Posts: 99
Submissions: 1

Reply with quote
Posted on Mon Oct 28, 2013 6:52 pm
Link to Post: Link to Post

Depends on what type of animation you're doing with it. If it's just falling from a static end or on top of a smaller object, you could try simulating the first section, saving the perimeter to keyframes, then simulating the next attached section, and so on. It would have to be something simple for which the stabilizing weight of the whole sheet doesn't make a big difference(though I guess you could mess with that setting...).

Joined: September 24, 2012
Posts: 93
Submissions: 1
Location: Stockholm, Sweden

Reply with quote
Posted on Mon Oct 28, 2013 7:04 pm
Link to Post: Link to Post

Since every torus has a distinct name set by the script (not needed i will use it to set material and textures later) physics can be added with another loop that selects all objs and sets the modifiers after.

Still though the RAM usage is horrific.
i will end up in 8-9k objects so creating somthing bigger than that require some heavy duty machinery Smile

Now i will try to implement SV file input to be able to create patterned E4-1

BR
C

Joined: September 24, 2012
Posts: 93
Submissions: 1
Location: Stockholm, Sweden

Reply with quote
Posted on Mon Oct 28, 2013 7:06 pm
Link to Post: Link to Post

TheMuffinmaster wrote:
Depends on what type of animation you're doing with it. If it's just falling from a static end or on top of a smaller object, you could try simulating the first section, saving the perimeter to keyframes, then simulating the next attached section, and so on. It would have to be something simple for which the stabilizing weight of the whole sheet doesn't make a big difference(though I guess you could mess with that setting...).


Not there yet Smile

Joined: January 17, 2013
Posts: 373
Submissions: 5
Location: Probably in the garage...

Reply with quote
Posted on Tue Oct 29, 2013 2:24 am
Link to Post: Link to Post

/Levi dusts off the Cray.



Sadly, I don't have a Cray but I do have some patience.
If you "Bake all Physics" then save the file, the physics get saved to the file. Next time you open the file you can jump straight to frame X without the hassles of baking or trying to play it without bakes.
This is the same 60x60 sheet from before that I "dropped" onto a big torus that's sitting on an even bigger plane. The render was taken at frame 108, for no particular reason.


Mostly Harmless

Post new topic Reply to topic
Jump to:  
Page 3 of 7. Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
All times are GMT. The time now is Sat Apr 04, 2020 7:01 pm
M.A.I.L. Forum Index -> Knitting Circle
Display posts from previous: