LEGOification in ICE

Discussions about SOFTIMAGEs© Interactive Creative Environment©
User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 00:56
Location: Montréal, QC, Canada

LEGOification in ICE

Post by claudevervoort » 14 Jun 2011, 14:23

Hi!

I bet this as already been done more than once but playing with my son, it gave me the idea this would be a good idea for some ICE experiment.

So the idea is to lego-ify a mesh using only 2 kind of lego brick: 1x1 and 2x1. I also do not want to have bricks that hold in the air so I took a build up approach:

1: create a 3d grid covering the original mesh
2: discard any point not in that mesh
3: then starting from the bottom and moving up, discard any point that is not above another point or cannot be attached (using a 2x1 brick) to a side brick which itself is above another brick

It's all done in a big array which at the end is used to generate the points and their shape instance + orientation.

It takes however a good 20 seconds to compute that array (see my array question thread), which is about 20 times more times than the time to generate the actual particle instances!

This is the beginning of the experiment. This approach will not work to do a little figure since the arms would have to be attached from the top, not the bottom. I'm thinking of running the same logic in reverse and merging the result to achieve that. Then I will need to apply colors to the brick, for this I am thinking texture map lookup.

I'm even thinking creating a custom node with that array manipulation to see how that would fare.

Anyway a lot of stuff ahead, i'll post here when I have more.

Cheers!

Claude
You do not have the required permissions to view the files attached to this post.

User avatar
spurv
Posts: 92
Joined: 08 Jun 2009, 19:28
Skype: patodigital
Location: Portugal

Re: LEGOification in ICE

Post by spurv » 14 Jun 2011, 14:27

Cooool!!! :ymapplause:
Eu é que tou com cenas? Tu é que tás com cenas!
http://lickingtheice.tumblr.com
http://www.mariodomingos.com

User avatar
ActionArt
Posts: 853
Joined: 25 Nov 2010, 17:23
Location: Canada

Re: LEGOification in ICE

Post by ActionArt » 14 Jun 2011, 15:38

That is really unique. Looking forward to seeing more!

Chris_TC
Posts: 411
Joined: 22 Mar 2010, 16:43

Re: LEGOification in ICE

Post by Chris_TC » 14 Jun 2011, 16:50

I love this, it's awesome! More, more! :)

A while back while researching procedural modeling I stumbled over a Houdini tutorial that turns objects into bricks. I haven't watched it, but maybe you want to take a look in case it has logic that could be of use to you.
http://vimeo.com/16548929

Zafar Iqbal
Moderator
Posts: 169
Joined: 26 Oct 2009, 09:04

Re: LEGOification in ICE

Post by Zafar Iqbal » 14 Jun 2011, 17:08

Very cool!

Coincidentally I just saw this vid last night: http://vimeo.com/4649345

Moderator (!) edit: please use the URL tags - HB
- Zafar Iqbal

User avatar
Memag
Posts: 339
Joined: 08 Aug 2010, 23:37
Location: Tits

Re: LEGOification in ICE

Post by Memag » 14 Jun 2011, 19:23

Exciting stuff!

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 00:56
Location: Montréal, QC, Canada

Re: LEGOification in ICE

Post by claudevervoort » 15 Jun 2011, 02:07

Thanks for all the encouragement! And the vimeo links. Lego-ification is indeed similar to voxel, but with the extra constraint that the bricks have to hold together, no floating 1x1. This is the limitation of my current approach which only builds up. It needs a brick underneath, or the brick is removed.

I've attached an image to illustrate the issue. In red are the 2x1 bricks. As you see, there is no column of 1x1 holding in thin air. But then a good chunk of the original mesh is therefore gone since for example there is nothing to hold the arms. My current idea is to run the same logic in reverse (top-bottom) and merge the 2. Will see where that leads me.

Claude
You do not have the required permissions to view the files attached to this post.

fabricio.chamon
Posts: 94
Joined: 09 Jun 2009, 21:47

Re: LEGOification in ICE

Post by fabricio.chamon » 15 Jun 2011, 03:41

Hey Claude, this is getting super cool! keep up with the good work! =)

grahamef
Posts: 281
Joined: 23 Jun 2009, 19:01

Re: LEGOification in ICE

Post by grahamef » 15 Jun 2011, 16:39

claudevervoort wrote:My current idea is to run the same logic in reverse (top-bottom) and merge the 2. Will see where that leads me.
I think it might be simpler to test for whether there is an existing brick in either direction before removing, instead of just testing for a brick below. Most of your tree's logic would remain the same, and you don't need to deal with merging afterwards.

BTW when I say that most of your logic would remain the same, I'm assuming that you are filling the whole volume and then propagating a "do not delete" flag from the bottom pieces.

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 00:56
Location: Montréal, QC, Canada

Re: LEGOification in ICE

Post by claudevervoort » 16 Jun 2011, 00:29

Actually I don't think it would work, at least not for what I am after. I want to insert 2x1 bricks so that a dangling brick can attach itself to the other (and provide a foundation for the one above). So I need a logic to know which 2 1x1 should be changed in a single 2x1.

I've illustrated the logic here: in red are the 2x1. On the 1st pass, upward, a good chunk of the bricks are not attached (and will be removed as not valid). On the 2nd pass (down) a good chunk are now attached, and a 3rd up finishes to attach them all.

Claude
You do not have the required permissions to view the files attached to this post.

grahamef
Posts: 281
Joined: 23 Jun 2009, 19:01

Re: LEGOification in ICE

Post by grahamef » 16 Jun 2011, 17:00

claudevervoort wrote:Actually I don't think it would work, at least not for what I am after. I want to insert 2x1 bricks so that a dangling brick can attach itself to the other (and provide a foundation for the one above). So I need a logic to know which 2 1x1 should be changed in a single 2x1.

I've illustrated the logic here: in red are the 2x1. On the 1st pass, upward, a good chunk of the bricks are not attached (and will be removed as not valid). On the 2nd pass (down) a good chunk are now attached, and a 3rd up finishes to attach them all.

Claude
Ah OK, so you are creating the bricks in stages. I was assuming that you were creating them all based on the volume, then propagating a Boolean through them based on connectivity, and finally deleting based on the Boolean.

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 00:56
Location: Montréal, QC, Canada

Re: LEGOification in ICE

Post by claudevervoort » 19 Jun 2011, 14:42

I've finally found a little time to move from theory to practice. So here is the result, in red are the 2x1 bricks. As indicated in my previous post, I move up then down then up until all bricks have either been attached or discarded if there cannot be a valid path back to the ground.

Now going to handle the brick color...

Claude
You do not have the required permissions to view the files attached to this post.

User avatar
edschiffer
Posts: 21
Joined: 11 May 2011, 15:02
Location: Rio de Janeiro

Re: LEGOification in ICE

Post by edschiffer » 20 Jun 2011, 19:14

hey Claude
nice to see your tree. I've been building one too since two weeks ago. it's been a test for me, since I'm kinda new to programming.

I'm not taking this approach of testing if are bricks on bottom. I'm just emitting points spaced for the 1x1x1 bricks, imported from the official Lego software, Digital Designer - just in case someone needs to add up any other kind of brick, it would fit perfectly.

the bricks are not interpenetrating, and I added an slider to adjust the overall size of them. I'm adding an image:

Image

right now, my tree is works great for modeling, but not for animation. Since I'm emitting as much points as it fits in a given geometry, when you edit it's vertices, it adds more bricks, sliding the others. banging my head over here trying to find a way to build this array of points correctly.

User avatar
Hirazi Blue
Administrator
Posts: 5113
Joined: 04 Jun 2009, 10:15

Re: LEGOification in ICE

Post by Hirazi Blue » 20 Jun 2011, 19:17

Would you be willing to throw this into a compound and share? ;)
Stay safe, sane & healthy!

User avatar
origin
Posts: 619
Joined: 09 Jun 2009, 09:59
Location: warsaw

Re: LEGOification in ICE

Post by origin » 20 Jun 2011, 20:21

Hi guys, nice work so far

btw, there is compound by Graheme F. which may help -->
viewtopic.php?f=19&t=102&p=461&hilit=fi ... venly#p461

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 00:56
Location: Montréal, QC, Canada

Re: LEGOification in ICE

Post by claudevervoort » 20 Jun 2011, 21:13

Hi Ed,

Thanks for sharing your approach here. I think what I did for the initial 1x1 brick generation is similar to Grahame technic:

You have an index, a width, a height, a number of bricks per row (and for me per layer since I use square layer) and based on any index, you can get which position using modulo and reminders.

The position can be used to check for inclusion in geometry and, if so, execute an add point at that same location.

(here is an extract of my graph, not exactly that but i'm breaking the index in layer # and in layer index before executing this).

Claude
You do not have the required permissions to view the files attached to this post.