3d pixelated script

(liero) #1

Hi guys, I’ve been trying to replicate the voxelization effect I had seen many times, so finally came up with this simple script. The idea is to increases a mesh resolution -at least where needed- and then snap all its vertices to a spatial grid. This may not be the smartest approach but I got pretty decent results. Then the script removes everything but a clean vertex cloud, and dupliverts a small cube on it.

The people at blenderheads.org thought in animating this, that’s why there is a second script that also supports animation through enabling and disabling object visibility. A pre animated object is baked on each frame -it can be a mesh with modifiers or even text or curves- and the resulting mesh is processed. A material and a group are created for each object.

Suggestions to improve are welcome.
Give it a try and feel free to add your own creations here…

the script: http://dl.dropbox.com/u/16486113/Blender/3d_Pix.zip
walkcycle test: http://vimeo.com/19112712
some silly test I did: http://vimeo.com/19112282
the original thread at blenderheads.org: http://goo.gl/KXWX3

A few tips:

  • set animation start / end range from timeline
  • change the prefix name in the script before each pass to keep things clean
  • ‘size’ setting is the grid size, ‘smooth’ is smoothing factor when subdividing
  • you can animate the static version, maybe with modifiers on the duplivert or the cube/voxel
  • all voxels of the same animation shares their mesh data, modify the visible one in edit mode
  • ‘hide’ setting: if you enable dupliverts visibility you will see the verts as a trail which adds noise to the viewport, but allows you to move / rotate / scale the entire sequence from the groups mode of outliner…
  • can take a while on animations, check the progress update in console

Attachments


0 Likes

(Octopus4) #2

@_@…

i wish there’s a way so the cubes can inherent the colors from the texture/material.

was planing to make a script like this in the future, but was busy with some commercial projects.

edit: how did you make these seamless cracks?

https://vimeo.com/18661627

:slight_smile:

0 Likes

(benu) #3

That is one cool script. Just spent an hour playing around with it. I’m going to have fun with this one. Thanks!

0 Likes

(DavidGasku) #4

wow! this will sure be useful for mograph. As Dhia said, the next step would be to have a way to automatically give the cubes a color. Maybe with vertex color interpolation or by texture.

Awesome work.

0 Likes

(BlenderEi) #5

That’s really awesome! Great work and please keep on working on your script. It’d be great to have this as an addon or a modifier with parameters.
Did you do all the mathstuff yourself? If yes, well done!

Thank you!

0 Likes

(liero) #6

Hi, there’s not really much math in here, it was more a brute force thing :stuck_out_tongue: but it works pretty fast.
What I also liked in this little project is the visibility animation system, I enjoy those icons flashing in the outliner when scrubbing.

The materials support is something I will try some of this days, but I’m afraid it will flicker a bit. The current implementation is based on Blender’s dupliverts, so there is just one object -the voxel cube- replicated hundreds of times. This is very efficient but does not allows to use more than one object or material at a time. What you can do is split / separate the mesh -or maybe use the mask modifier- before processing, so you’ll end up with two or more objects.

@benu glad you liked it, post some pic if you have :yes:
@Dhia Eldeen that was easily done in inkscape, more info in the thread

Have fun.

0 Likes

(Oyster) #7

nice pic

do you know http://blenderartists.org/forum/showthread.php?t=61174&highlight=Pixelate3D ?

what is the difference between yours and that one?

0 Likes

(mib2berlin) #8

Nice, is this script for 2.56 or for 2.49?

Cheers mib

0 Likes

(benu) #9

One big difference is the ability to add it to animations. Really incredible stuff; I need to post an example… give me a week to catch up on another project first.

0 Likes

(SolarLune) #10

Really nice - I’m going to have to download this one. But you should make it inherit the Material / Texture of the original mesh, if it doesn’t do that already. That would make it perfect.

0 Likes

(MmAaXx) #11

doesnt work with latest builds :S

0 Likes

(liero) #12

@MaAaXx the script seems to work ‘ok’ here, see it is not an addon, you need to select an object and run it from a text editor window.
@Oyster didn’t know that one… but this is for 2.5x, that’s a difference, and it supports animation. On the other side the method I used to create the voxels is deceptively simple, and works from the skin and not from the volume, affecting the shape when the cubes are too big. I think it can also work with splines, maybe with a stick figure :slight_smile:
@benu looking forward to see some pic or even better some animation test!
did some other version that plays nice with materials and allows to animate resolution, will upload later…

0 Likes

(DigitalNeutrino) #13

Works for me also win7 2.56 beta , very cool little script

0 Likes

(Oyster) #14

yet another one
http://wiki.blender.org/index.php?title=Extensions:2.4/Py/Scripts/Add/Cells_v1.2

0 Likes

(cabsteabs) #15

Air purifier - tips and trics!

0 Likes

(kazinger) #16

Any tutorials on this ? I get


look in console… sure i understand what is in the console. I used a cube. I got a second cube a new cube every time I run script. Just do not know what to do now.

0 Likes

(liero) #17

Hi kazinger! I do think this is simple stuff specially the static one: you’ll get a point cloud from your object named dup, with a cube as a child. The points will be already snapped to a 3d grid and dupliverts enabled so the cube can be replicated…

Please try this: on a clean file delete the cube and add a Suzanne, scale it up a bit and in a text editor window open or paste the first script. With the monkey selected run the script (Alt+P) and you are done… you can now search for the cube inside the dup object, rescale or bevel it or add a material.

the size setting defines the cube size, the gap can be adjusted later, and smooth should be 0 for hard shapes as a cube or 1 for organic shapes as the monkey… tell me if you don’t get anything, the animated version will do the same for you on every frame, animating also the visibility…

Looking at your pic I can see you’ve been playing with the Suicidator City Generator, it is a really great script but will run only on 2.49

Some alternatives to the pixelated script:

  • with small resolutions -up to 50 cubes- you can just try the particles in grid mode and a cube as the rendered object, you’ll get two modes to play with, surface and volume.
  • if you take the time to generate a 3d grid -a vertex and some array modifiers- you can even use a modifiers stack, with a subdivide and a shrinkwrap in nearest vertex mode to create the dupliverts mesh.
0 Likes

(kazinger) #18

Wow Thanks. I do not know why the city generator showed up there. I was using it in 2.49. I got it/ 3d pix to work in one of my builds ( It very well could have been operator error ). Its the simple that confuses me. Ill make a simple shape animation now.
Thanks

0 Likes

(kazinger) #19

Now that’s way cool ( the animation with a shape key )

0 Likes

(vklidu) #20

modifier in this video looks like can do similar to your 3d pixelated script too (in video 4:20 min)

0 Likes