Legolizer


#1

Hi there,

i found a thread in the lightwave forum (http://www.cgtalk.com/showthread.php?t=163202) some days ago where someone wrote a plugin to convert an object into a legolike structure. i found that pretty funny so i tried to write something like it for 3dsmax. i ran into the same problems (very slow, and sometimes holes won’t get filled), but beside this, it is working pretty well :wink: i will try to fix the remaining bugs and add some more things this week…

take a look at it, if you want, you can download it here
there is a short description within the script

i really would like to see some results (i think we can do better than the lightwave guys ;)), because i don’t have much time to do some tests by myself…

Happy Legolizing :slight_smile:


#2

cool will check it out. saw that lightwave plug and was jealous :slight_smile:

.


#3

great googly-moogly… I can’t wait to give this a try.


#4

Great one! Gave me good laughs. :smiley: Alltho it’s a quite slow…


#5

haha… this is great! bit heavy on the processor, but works like a charm! gave it a quick test ride… will play with it as soon as i find some free time… :slight_smile:

great work!


#6

Gonna try it right now! Thanx


#7

Such a fun plugin and still no cool pictures posted?

Here’s my Teapot + Legolizer + ReallySimpleLightningSetupThatRendersReallySlow™

Some little comments on how you could improve the script if you plan to work on it further: (and make it better then the lightwave one :thumbsup:)

  • Real lego’s always have a seam where they meet, would be nice to have the lego’s edges automaticly chamfered so you see the seam.
  • An option to change the number of sides of the cylinder on top would be nice.
  • Max doesn’t really like a lot of seperate objects in a scene so making all lego’s one editable mesh/poly would probably make the viewport run a lot smoother. (I say probably because my max crashed with an out of memory error when i attempted to attach 5000 lego’s at once…)

keep up with the good work!


#8

Hiya, Very cool good work.

I modified the script somewhat and disabled screen redraw completely and also closed the command panel (withcui.commandPanelOpen ). It made the script twice as fast.

Also, if it’s going to be even remotely close to fast in the viewport then the number of independent object must be far less. Just attaching them to one or possibly some more meshes will make it extremely much faster in the viewport.

Also, how do you make the geometry? It looked like you do a very great deal of things in the nested for loops, do you really have to do all of it all the times?
I haven’t looked at the problem or the code in depth but wouldn’t it make sense to do it this way:

  • build the lego block, they are all the same size right?
  • figure out where they should be placed, for example by movin in a 3d matrix over the object and checkning if there should be pieces or not.
  • copy and attach the small blocks into the bigger mesh

It seems like it should be quite alot faster, but then again I haven’t looked that closely at the problem

Anyway it creates great pictures even though it almost kills the computer.

I can upload my modifications if you like, but they should be easy for you to do if you like them.
Keep up the good work.

/Andreas


#9

Hey, thanks for the comments!! I updated the script a little, it’s a bit faster now (but unfortunatly not that much, i am still working on a faster method for scanning the object, but it needs more testing…)

changes:

  • closed the command panel (great tip :wink: )
  • sceneRedraw is now optional
  • Number of Cylinder Segments can be changed
  • Added chamfer for the blocks (but it slows down and gives way more polys)
  • Blocks are attached to one object (except if you choose random colors)

Andreas, the way i create the blocks is nearly that what you wrote, i first split the source mesh into the segments, then, for each segment, i create a raster and scan each position if the source obj has vertices in this position (i am doing this with a volume select, which might be a big performance killer). The check for vertices is the main performance problem, because, depending on the number of blocks, there are really a lot checks to do. I am currently working on another method where i don’t have to check every block, but it’s still not working…

Arnage, nice pic :wink: although i don’t know how many lego teapots i have seen the last days, because i also use these for testing :slight_smile:


#10

ok heres my first test. took nearly an hour to complete…lol

.


#11

this is just the coolest script/plugin i’ve seen in some time! i cant think of a single practical use of it, but it gave me a thrill to just watch my models become a stack of legos. i showed it to my wife, a lego fan, and she also thought it was just the coolest thing her geeky husband has tried to show her in some time :slight_smile:

now if it could update frame by frame, and we could make easy work of an effect simmilar to that White Stripes video.


#12

Note to self… 16hrs and only 2/3 complete on a million+ poly model. LOL Sadly I had to crash it out this morning so that I could work. Good news though… it hadn’t locked up or stalled. It was still crunching.


#13

ok, that is good, i was a little worried that you actually recreated the objects every time. I will think some on it. But I mean there has has to be a faster way to do this, unfortunately one may have go go into c++ crunching to program a faster way to figure out where the blocks should be, since that is what is taking the most time. I think what may be a real performance killer is probably creating all the modifiers over and over. max is always very much faster if one can trick it into using only one modifier.
Also if you attach the blocks to one object, max may be much faster, it really hates many objects for some silly reason.
Keep it up!
/Andreas


#14

your desings are really cool


#15

Does it work with Max 5?


#16

damn, i really have to speed things up on this one… waited about 3 hours when it crashed because it ran out of memory after creating 30000 blocks :frowning:
but there is still hope that i can optimize it a bit further, but i think that due to the large polycount it generates (i have had about 1mio polys on the last one) it never will be that fast…

cg219: i’m not sure if i used any max6 specific functions in the script, best way to find out would be to try it :wink:


#17

I trimmed down the skeleton to just the skull. Took about 21 min to generate, and I upped the grid to around 8x8x8.


#18

Nifty script. I don’t have any interesting images to post yet but had a few thoughts on the functionality. The new build that makes 1 object is cool but an option to build each block as an instance would be cool. This way after using the script someone could alter the original object, like adding a bevel or adjusting the cylinder mesh and have it propagate through all of the blocks. Another idea, but probably beyond the scope of the script, would be a random way to combine some of the blocks to have 1x2, 1x3, and 1x4 bricks.

This is fun, I’ll have poke around some old models to find something worthy of Legolizing!


#19

Is it possible to make it delete faces which are inside the structure? That would reduce the poly amount quite a lot.


#20

Awesome :applause:, the teapot looks so much better than mine… probably helps to have it rendered and built with a few more blocks, so…now who is good with MEL? :stuck_out_tongue: J/K

-Arngautr