Archive for the 'Uncategorized' Category

Blender Python Dojo @ EPFL

Screen Shot 2017-03-30 at 16.24.46.pngLast friday I had the opportunity to give a quick workshop at EPFL about Blender and its basic functions for object manipulation and creation, followed by an intro to Python and its use inside Blender in the afternoon.

In the morning we saw how to orbit the view, move objects, scale, rotate them, as well as edit mode, and the wave modifier (!), which is always a fun thing to show. Another favorite moment is when they start modeling faces, extruding and you show them the CTRL-2 shortcut for applying the subdiv modifier. Instant Magic!

After lunch we started digging into Python and the bpy module. The participants where IT-guys and apprentis (professional students) all of them had programming background, so the Python part was the easy one. Here are the few slides I used as a visual support to my explanations : https://docs.google.com/presentation/d/1HMRJStTcLKBWT84rSDiCxXvTyMrzAh8NehbgYxc6Elk/edit?usp=sharing

We then had an in-depth look into the random character generator script (pasteall here). It creates a char by creating a body object, assigning a mesh data taken randomly between all available mesh datas that start with “body_”. It then does the same with “head_” , “eye_” and “mouth_” by placing them to a specified height.
Instead of creating a material for each character and assigning a random color value, I opted instead for assigning a random object pass index beetween 1 and 10, and then use this pass_index in a node tree to drive the fac of a colorramp. This not only gives opportunity to show to the participants another way of doing things, but also would allow for easier color scheme choosing if one wanted to change colors of all characters (we only need to tweak the colorramp)

Here are some of the body, head, mouth components used to generate the random characters.

Screen Shot 2017-03-30 at 11.23.12.png

All the parts need to have a correct origin. You can find them on layer 2 in the final file. The script and files are free to download and thinker with. Possible improvement would be to add a bpy.app.handlers.frame_change_pre.append(main) to render out an animation with a myriad of avatars. Or we could generate avatars according to an input name or text.

Ressources:
You can download the final .blend file here :
https://www.dropbox.com/s/z0x4orvf5p9gn7x/dojo_avatars_final.blend?dl=0
Just press the Run Script to create a random character

Here is the A4 cheatsheet of basic shortcuts I give out to participants :
https://drive.google.com/open?id=1Nf7E-I76YJslPlmIwRymCXqfEYsLt8ggfcmMu-08sfo

 


Categories

Flickr Photos

Darth Vader menacing Imperial Officer - Lego

Maranola, Cinque Terre, Italy

Kids at sunset in Cinque Terre, Italy

More Photos

@oenvoyage latest Twitter


%d bloggers like this: