Friday, 31 December 2010

LESS THAN THREE


LESS THAN THREE is for Rhiannon, Who has never thrown a snowball at me! (and took kindly to being portrayed as a rather rotund 'Christmas Pudding' eskimo)

Two weeks start to finish in Blender 2.5.  Animating took just over 4 days.  I felt like I was on a bit of a haptic path trying to get this finished... the characters probably are as well!  I watched a lot of Ivor Wood stop motion before starting the animating and tried out (and broke) every gag in the book.  I manage to re-target my 'disco guy' rig fairly successfully but uncovered a new problem (this time with the eye tracking).  One of my big aims was to get smooth motion without falling back on the crutch of motion blur (which I used in only one shot - the flying snowball) and to compose strongly enough and texture well enough so I wouldn't need depth of field to hide the mistakes (used only in one shot where I went for a slight dutch angle and the dropped camera look).

Thanks to my little brother George the ad-hoc stuntman who happily dressed up in 20 T-shirts, jumpers and hoodies, multiple tracksuits, scarves, hats and a balaclava and stumbled round the garden like a padded eskimo while I threw snowballs and a giant physio ball at him for reference footage.  I re-timed a lot of the reference in After Effects for comic effect and over exaggerated the poses in the animation stage.

Thanks also to all the freesound.org users whose clips were used, and to archive.org for providing the Public Domain Songs Ragtimers' "Shimmy Like My Sister Kate" and Johnny Johnson's "Raggedy Ann" from Stepping Stones.

Batch Texture Processing: GIMP and IrfanView
Texture Painting: Photoshop
Bump and Normal Maps: SSBump
Modelling Shading Animation Rendering Compositing: Blender 2.5
Skating Tracks: Jahka's Animated Texture Bake
Final Grade, Animated Textures and Reference Processing: After Effects
Edit: Premiere Pro
Sound: Reaper

Sunday, 19 December 2010

Smooth Vertex Group Weights in Python

I had to do some weight painting this morning in blender (for masking displacement textures and wave modifiers, not skinning bones for once!) and was faced with the usual problem of having to smooth out vertex group weights.  It struck me that I was painting all the way along one of my edge loops, and instead of laboriously going up and down the edge loop with the blur brush trying ever so hard not to paint bits of mesh in the background, I could select those edge loops quickly and easily in edit mode and write an operator to smooth out the weights of the active vertex group.

Before and After

I've bundled this into the tube project's 'Edge Tools' which I wrote back in the summer.  The latest release is available here: http://www.pasteall.org/17726/python just copy and paste into a text file and run from the script editor or save it as a .py and install from the add-ons menu.  Its in the Ctrl-V menu or Spacebar>Smooth Vertex...

Thursday, 16 December 2010

Controllers Implemented in Pythonic Boids for Blender

While college was on I hardly had any time at all to work on this.  I found a spare three hours this morning and implemented 'controllers'.  Currently you can instruct the boids to follow or to be attracted/repelled/directed by controllers.  I also implemented a way of detecting the orientation of the ground plane from the cross product of the last two direction vectors (with necessary error checking, direction flipping etc) and replaced all of the orientation interpolation code with quaternion slerp.  This will obviously need some more careful coding to make sure that the boids don't suffer from quaternion flip - hopefully I can get the smooth interpolations of quats with the twistability of eulers (i.e. >360 degree angles).



I've also been messing with low-poly stuff seeing as that seems to be in vogue this year what with 'Between Bears' rocketing up the vimeo charts.  After walking in the woods this evening in low light I was trying to work out how to get the sense of a curved ground plane from only the striation of the tree trunks.  Kept running into anti-aliasing issues though - the opposite type from usual - smooth fades from black to white wasn't quite what I had in mind.


 

Tuesday, 14 December 2010

Jump Cuts Summer 2010


Two reels of Kodachrome and one of Ektachrome back from Dwayne's Photo USA.  Point and hope film-making meets Dada-ism when I get behind a Sankyo MF404 with a shorting out power pack, focus marks that don't match and a wonky reflex mirror.  Its sad to think that in 16 days time no-one in the entire world will be able to develop such a vivid and reliable film stock - this was shot on 19 years out of date K40 and the weakest link in getting it on the net is my brother's HD handycam I used for the telecine not the ageing AGFA Family Projector Set.   Video's in the processing queue on Vimeo - fingers crossed it will be up this afternoon - codecs kill the grain though.

Monday, 13 December 2010

Motion Paths / Arcs Animation Reference

Here's a couple of Muybridge sequences (public domain) which I motion tracked and ghosted.  I often turn on arcs and ghosting in Blender and Maya, but occasionally I'm not sure what I'm meant to be looking for.  Neither my tracking nor the Muybridge sequences are perfectly synced but you get the rough idea.




This one was a pain to even out - There's almost certainly a mis-shoot in the original Muybridge photos.



Both of these are based on public domain material so you can download them for free and use them for commercial or non-commercial purposes.  For what its worth my addition to the Muybridge images is licensed as CC-0.

Sunday, 12 December 2010

Doing the Right Thing

I spent a few hours earlier today filing bug reports for things that cropped up over the course of the last few mini-projects and tidying up some of my model files and sticking them on blendswap for the perusal of the masses.  Hopefully the few improvements to the rig will make it harder to break in future (I unearthed a few problems as the animation work progressed).  I plan to retarget my basic biped rig to a few other character models I'm working on.  Nothing exciting to show for them now - spent the whole evening pushing triangles out of the face topology!

Friday, 10 December 2010

One Almost Sleepless Night and a Mood Change Walk

Wow, that's pretty much the first full project I've run from start to end through the blender 2.5 pipeline.  Its not bugless yet, but its getting there.  Automerging keyframes still seems to have a few problems on the animation front, and I encountered one or two armature bugs along the way - all thankfully now fixed in the SVN builds.  Hair sim seems a little crazy at times - It was adding a humongous amount to my render times in the calculating vector pass (probably a bug?) and getting blender to render from the same particle cache which is on display in the viewport takes some persuading. Much fewer crashes than I was used to last time I tried to render a complex scene in 2.5 but I still had to do the late night babysitting to restart the render when I hit an occasional glitch.  Hopefully I'll get some time to do some bug reporting over the weekend.



Thanks to some help from Jahka on #blendercoders I've now fathomed what the cache buttons do and a few other options relating to hair dynamics:

Cache Step:  This affects how often results are saved and as a result the accuracy of the played back simulation cache/bake.  When you run a simulation each frame (and any subframe steps if you have them enabled) gets calculated, but if your cache step is set at 10 then only every tenth frame is actually saved for playback.

Quick Cache: With this on the cache step is used for the simulation.  If cache step is at 10 then only every 10th frame is simulated and only every tenth frame is saved.

Effectors and Hair Dynamics: If you have hair dynamics off then effectors (objects with force fields etc) get used to shape/twist/curve the hair in all sorts of interesting and exciting ways.  You can use empties with forces on (on the same layer) to fake the effect of the wind/follow-though etc or curve guides to change the hair style.  If you switch on hair dynamics suddenly all these forces have a different meaning.  They are now used to effect the dynamic simulation of the hair rather than to effect its grown shape.

Saturday, 4 December 2010

Opening Shot Render Test


Set for the Mood Change Walk: Going for a 'Night on Earth' Feel.
Still got some AA problems - will have to play with texture settings.

Wednesday, 1 December 2010

Python for Exaggerating and De-intensifying Poses

Sometimes my poses are just too strong and the animation ends up being very exaggerated and hard to follow, and sometimes they're too weak and need amplifying.  Joshua Leung's new push and relax features for pose bones in blender do a great job of handling in betweens and making them more or less similar to the neighbouring keys.  Often I find that before I even get to the inbetweening phase of animation I want to edit my key poses in a similar manner.  Especially with the spine and neck I want to be able to relax the bone's locations and rotations towards the rest pose (the same way I would smooth vertices when I'm modelling).  Here are two more python scripts I threw together this morning while working on another walk cycle...

Smooth Pose


import bpy,mathutils


amount=0.05


a=mathutils.Quaternion((1,0,0,0))
for each_bone in bpy.context.selected_pose_bones:
    each_bone.location=each_bone.location*(1-amount)
    if each_bone.rotation_mode=='QUATERNION':
        each_bone.rotation_quaternion=each_bone.rotation_quaternion*(1-amount)+(amount*a)
    elif each_bone.rotation_mode!='AXIS_ANGLE':
        each_bone.rotation_euler[0]=each_bone.rotation_euler[0]*(1-amount)
        each_bone.rotation_euler[1]=each_bone.rotation_euler[1]*(1-amount)
        each_bone.rotation_euler[2]=each_bone.rotation_euler[2]*(1-amount)

Exaggerate Pose


import bpy,mathutils


amount=0.05


a=mathutils.Quaternion((1,0,0,0))
for each_bone in bpy.context.selected_pose_bones:
    each_bone.location=each_bone.location*(1+amount)
    if each_bone.rotation_mode=='QUATERNION':
        each_bone.rotation_quaternion=each_bone.rotation_quaternion*(1-amount)-(amount*a)
    elif each_bone.rotation_mode!='AXIS_ANGLE':
        each_bone.rotation_euler[0]=each_bone.rotation_euler[0]*(1+amount)
        each_bone.rotation_euler[1]=each_bone.rotation_euler[1]*(1+amount)
        each_bone.rotation_euler[2]=each_bone.rotation_euler[2]*(1+amount)

At the moment the scripts only support quaternions and eulers as that's all I use in my rigs.  If you're an axis angle person please enlighten me as to what on earth its for!  Here's the walk cycle (crits welcome):



On another note I started hacking away at blender's source code last night trying to code smoother deforms for b-bones, which in my opinion look great until you turn on mesh display when it somehow manages to fold up the mesh in all sorts of nasty ways if you're using it for something wide (like a torso) rather than something skinny (like an arm).  While I haven't made much useful progress yet (other than beginning to understand the built in math libraries) I did stumble upon this very nice explanation of matrices, vectors and coordinate systems which I wish I'd found ages ago when I started diving into python in blender.

Tuesday, 30 November 2010

Quick Walk Cycle and Python to Mirror a Cycle



I started out aiming for John Travolta's Saturday Night Fever walk to staying alive but I quickly ended up with far too many keys and too snappy and exaggerated an action for a cycle.  I realised I needed to change the rig a bit to get the movements I needed so I stripped it right down and worked up this basic walk cycle just to test the changes work.

I also wanted to work with only half a cycle and be able to have a script mirror it for me.  I coded this quick python timesaver.  Basically just select all the bones you have animation on and enter the start and end frames into the script.  Eg. You have a stride on frames 1 to 21 and you want the mirrored stride to be placed on frames 21-41 so you enter start_frame=1 end_frame=21.  Be warned the script will purge any modifiers you have on fcurves (its lazy at the moment) and replace them with a simple cycle modifier so your pair of strides (on 1-41 in the example) continue looping forever.

import bpy

start_frame=1
end_frame=21


def set_frame(sf):
    bpy.context.scene.frame_set(frame=sf)
    bpy.context.active_object.update(scene=bpy.context.scene)
    bpy.context.scene.update()


for each_fcurve in bpy.context.active_object.animation_data.action.fcurves:
    for each_modifier in each_fcurve.modifiers:
        each_fcurve.modifiers.remove(each_modifier)

each_frame=start_frame
while each_frame<=end_frame:
    set_frame(sf=each_frame)
    bpy.ops.pose.copy()
    set_frame(sf=each_frame+(end_frame-start_frame))
    bpy.ops.pose.paste(flipped=True)
    print('copying '+str(each_frame)+' to '+str(bpy.context.scene.frame_current))
    bpy.ops.anim.keyframe_insert_menu(type=-4, confirm_success=False, always_prompt=False)
    if each_frame==end_frame:
        break
    set_frame(sf=each_frame)
    bpy.ops.screen.keyframe_jump(next=True)
    each_frame=bpy.context.scene.frame_current

#kill fcurve mods and add a cycle mod
for each_fcurve in bpy.context.active_object.animation_data.action.fcurves:
    each_fcurve.modifiers.new(type='CYCLES')       

Saturday, 27 November 2010

Au Soleil at the London Underground Film Festival (LUFF)

I'm really happy to have heard from the London Underground Film Festival that my short 'Au Soleil' will be screening at the Horse Hospital next Saturday the 4th December, as part of their programme Around the Compass Rose: Human Geographies on Film.  'Au Soleil' was nominated for the technical achievement award at CAM*ERA earlier in the year.  It seems like ages since I finished work on this film, and though with hindsight some of the technical work isn't as strong as I would have liked, I hope it goes some way to proving that as a medium animation has more to offer than just tired/banal overworked childrens' entertainment.  Tickets available here £5 or £3 concessions, showing with 'Wild West', 'Faith Hope and Greenland', and 'Those Who Live Off the Dead'.

In completely unrelated news, Campbell Barton did a terrific job last week of bringing blender's rigging tools slightly further out of the stone age by fixing the infamous bone roll bug (which has been in blender for nearly as long as I can remember).  It seems that all of the devs have been completely oblivious to it, and no riggers have ever got round to reporting it as it was fixed just hours after I reported it!  Not only that, but Campbell has also added a few more options to the menu giving a choice of which axis to align to (+Y for  a leg IK chain for example).  Commit notes are here for anyone interested: 1 2 3.

Friday, 26 November 2010

Rigging the Sidewinder Desert Snake


The desert snake basically has a continuous sine wave running throughout its body, apart from the tail and the head which are partially free - the head tends to stay fairly level but still inherits some of the rotation from the body wheras the tail flips loose.  For the continuous sine wave, rather than using a wave modifier on a curve and relying on keying the speed (clumsy at best - I'd rather key the offset but then with speed set to 0 the wave disappears and further adjusting wave width during the animation isn't possible, unless you choose to scale the curve to change the wave width but then you get into more problems!) I drew a simple sine wave with a path, arrayed it many times, curve deformed it into a circle then applied the circular curve deform and set the path to be cyclic (on U).  I then converted my circular wavy path to polygons and extruded it out (with shift-Z to constrain scale to X and Y only).  I built a simple FK armature each of whose bones began and ended on the wavy surface, running round with a slight circular bend.  Below the start and end of each bone I put an empty which was shrinkwrapped with Z project to the wavy surface.  Each bone then has a track to constraint aimed at the empty nearest its tail.

I then use a second of chains of bones to convert this wavy (but curved) motion into a wave in a wave in a leaning plane (roughly the XZ plane rotated 45 degrees about Y) by copying only their local X rotation and making sure the bones in my second chain have their Z axes pointing towards the vector (0,1,1).  Then a third chain of bones tracks to the tail of its double in the second chain with maintain Z up set.  A fourth chain is used to add a user specified rotation in the world Z to each bone (for example a curve in the snake).  This has to be done in a separate chain containing copies of the third chain's bones rotations as rotating any bone in the third chain disrupts all of its children's track to constraints!)

A final few bones are used to add non-automated animation to the head and tail.  The width and height of the waves can be controlled by scaling (the parent of) the large rotating wavy disk in the world X or Z axis (there are some empties in between with maintain volume constraints to move the chain of empties which the first chain tracks to into the right position), and the rate of progress of the wave down the snake's body is controlled by rotating the wavy disk.

Now down to animating, at long last.


Wednesday, 24 November 2010

Birds and Fish



Quick Crow Flight Cycle


Might give it another go with a simpler setup when I get a moment.  Its still a struggle to get the wings completely folded up.  Rerigged the shark with a much simpler setup to get the simple sine wave propagating nicely, he's still a little dead for now though!



Updated - thanks to Frankie Swan for some great tips.

Monday, 22 November 2010

Bone Roll in Blender

It's well known that setting bone roll to Z-axis up in blender often doesn't work well, if at all.  If you find yourself having to set bone roll manually using Ctrl+R then this script might help you out.  Tab into bone edit mode, select the bones you want to roll, copy and paste the below script to a text editor, set your target roll vector as new_z_axis_vector in the script below (at the moment its set for z up) and hit run script.

import bpy,mathutils,math

new_z_axis_vector=mathutils.Vector((0,0,1))

for each_bone in bpy.context.selected_bones:
    new_x_axis=each_bone.y_axis.copy().cross(new_z_axis_vector)
    if new_x_axis.copy().angle(each_bone.x_axis)>90:
        new_x_axis=(-1)*new_x_axis
    previous_z_angle=each_bone.z_axis.angle(new_z_axis_vector)
    roll_adjust=each_bone.x_axis.angle(new_x_axis)
    each_bone.roll+=roll_adjust
    if each_bone.x_axis.angle(new_x_axis)>0.01:
        each_bone.roll-=2*roll_adjust


Of course the correct rigging practice is to make sure the bone roll of all the bones in a chain is such that the z axes vectors of all the bones are in the same plane so you might want to set new_z_axis_vector to something other than (0,0,1) or world z, for example a leg IK chain might need a value of (0,1,0) to make all the bone z-axes point forward.

Saturday, 20 November 2010

Getting Renderman Shader Editing on Windows

With renderman exporters for blender 2.5 on the horizon I thought I'd get a head start by learning the renderman shading system.  Sadly on windows its not quite as easy as it should be get a shader editor going.  The original Shaderman runs fine but its a little dated, and I'd previously tried getting shaderman.next to run to no avail.  Instead I tried Sler which like shaderman.next is written in python.  Some of the links to sler's dependencies are  broken so I tried searching around the internet and installed the dependencies as listed on sler's download page. Sadly, according to this blog post on superjazz it seems that many of the recent compiles of gtk are incompatible with recent compiles of python.  If you're getting lots of these errors you've probably hit the same problem I did:

ImportError: DLL load failed: The specified module could not be found.

To get round this you need to install an older version of python.  On top of that you need GTK with glade (which for some reason doesn't always seem to be included) - if you're getting errors about a missing libglade-2.0-0.dll then you've only got plain GTK without the glade.  The exact files which worked for me are:

Sler-v0.2beta
python-2.5.4
gtk-dev-2.12.9-win32
pygtk-2.12.1-3.win32-py2.5
pygobject-2.14.2-2.win32-py2.5
pycairo-1.4.12-2.win32-py2.5
aqsis-setup-1.6.0 - for preview rendering

Just unzip Sler to a clean folder then inside the bin subfolder create a new batch file with something like the following to set your path and start sler:

set PATH=C:\Program Files\GTK2-Runtime\bin;C:\Python25;C:\Program Files\GTK2-Runtime\lib;C:\Program Files\GTK2-Runtime\;C:\Program Files\Aqsis;C:\Program Files\Aqsis\bin
@set GTK2R_PREFIX=G:\Program Files\GTK2-Runtime\bin
@echo set PATH=%GTK2R_PREFIX%;%%PATH%%
@set PATH=%GTK2R_PREFIX%;%PATH%
python runsler.py
pause

Best of luck, let me know if you have any problems.


Thursday, 18 November 2010

Disco Guy - Character for the mood change walk exercise

Disco Guy: Rig and Wire

Some of the texture painting's not perfect but in the end I was pretty happy with how the rig turned out.  I have IK/FK switching on arms and legs, free/fixed hip choice, stretchy IK body with volume preservation and a nice B-bone torso, as well as clavicle deformers to keep the chest shape.  On the hands I have palm fan controls and finger spread/fist controls as well as individual finger curls.  Not too bad for half a days rigging and weighting.

Shape keys yet to come, only the eye controls are done for the face so far.  Not sure if I'll bother with custom bones as I know the rig inside out and spent a while sorting out layers.  Sadly the 32-bit PC in the studio can't cope with deep shadow buffers and hair without running out of RAM very quickly.


Saturday, 13 November 2010

Boundaries for Python Boids and Using the NLA for Animation Layers



Thanks to Campbell's bug fix for the shrinkwrap constraint, my python coded boids (not blender's built in types) can now stay constrained to a surface, albeit very slowly.  The execution of my python code is pretty rapid, considering the number of adjacencies which need to be taken into account, and I have some tidy ups planned which should make it even faster.  The downside is that I need the code to know the visual location (not actual location) of each boid after shrinkwrapping, and then apply this to the actual location.  Logically if I did object.location=object.matrix_world.copy().translation_part() you would expect this to update the visual location.  However it seems that (somewhat sensibly) blender doesn't always update constraints after every line of python which could make the visual location of an object differ from its actual location.  Trying to tell blender to update the world matrix to reflect changes in the object's location seems to be the main problem, especially when the object has keys (so just setting the current frame won't work).  The best option seems to be to key the location (and oddly enough using object.keyframe_insert('location') doesn't update the matrix, but ops.anim.keyframe_insert(....) does, but is much much slower) then read back the matrix.  This unfortunately is extremely slow, but does seem to work.

UPDATE: documented a workaround inspired by some of Bassam's suggestions.

Some python work which on the other hand has been more successful is a workaround to use NLA strips as animation layers (in the same way they would work in maya).  To use the script key the base animation in and then snowflake the action in the NLA window.  Then add a new NLA strip on a higher layer and set the mode to additive (to do this you'll probably have to create an action with a garbage key which you can later delete, link the action to the object then snowflake it).  Set your new top layer NLA strip to add mode then tab into it (tweak mode as its now called).  Start posing and whenever you want to insert a key use this script http://www.pasteall.org/16791/python instead of the 'I' key.  This makes sure that the new keys are relative to the layer below.  In good news aligorith confirmed that this behaviour will soon be built into blender and you won't need my script for much longer!

Friday, 12 November 2010

Shark Swim Cycle



Tried to get layered animation working in blender but the NLA didn't seem to work the way I wanted it to (like animation layers in maya) so I gave up for the morning and tried to animate a swim cycle.  That didn't go too well either - I'd build the flippers on the model far too low down and they looked unnatural in what should have been their rest pose by their side.  My spline IK rig which was meant to make animating the sine wave easier ended up making it harder as I had far too few bones controlling the spline to get a smooth enough wave.  Added to that the tail could have done with a few more bones to smooth out the motion.  The looping destroys the effect of the fake caustics and volumetrics somewhat, but never mind, I hate default grey (or 'Material.001' as its otherwise known).

Fear and Loathing Fish Animation



The brief was to animate a fish as if it had the character of a celebrity/famous person etc.  I picked Johnny Depp as Hunter S. Thompson in Fear and Loathing in Las Vegas.  I'm not sure if the neuroses just comes across as bad animation?  Took from 10am yesterday to 6pm to animate this short clip.  Still not 100% happy with the rig.  Lets hope the shark goes better!

Wednesday, 10 November 2010

Painting the Fear and Loathing Fish

slowly going insane...

Spent the last 3 hours painting seamsless textures and bone weights (this ones an FK only rig... I'm running out of time).  At least the fish can now deform into shapes like this, and blow bubbles thanks to instanced metaballs on a particle system emitting from his cigarette!  He has a nice irradescent glow which changes colour as he turns round courtesy of blender's underused 'magic' texture mapped to the reflection channel.  Animation starts tomorrow!

Tuesday, 9 November 2010

Fish Modelling

Hunter S Thompson Herring
4 hours modelling

Great White Shark
3 hours modelling
(incl 1 hour of teeth vertex pushing!)
2 hours texture painting
(incl 1 hour of messing around with Photoshop 3D)
2 hours rigging and weighting

Some half cooked models I built in a rush for this weeks anim exercise (fishes with character).  The shark's got a nice spline IK rig (a spline for the back and for each of the big flippers), but thanks to blender's outgrown deps graph, it has more than twice the number of bones it would need in maya.  At least the modelling and texture painting in blender kicks the socks off maya.


Saturday, 6 November 2010

Python Boids in 3D



I'd only tested my code out in 2D up till now, even though I'd been coding all the vector maths in a way I hoped would work in 3D.  I ran a simulation above and to my pleasant surprise it worked perfectly first time.  Sadly trying to shrinkwrap/constrain the boids to a surface (a mesh marking the limits of where they are allowed to wander) I ran into a new bug in blender.  Its in the tracker, fingers crossed that by the next time I have a moment to work on the code all will be resolved!

Escape Route Searching in Python Boids






Yey! after some more coding this morning I got escape route searching working.  In this example the boids just give up when they collide as there are no controllers (or boid brains) yet to tell them to do anything other than that.

Friday, 5 November 2010

Boids in Python



Coding boids in blender's python API might seem like a lot of unnecessary work, but when the built in simulation system doesn't offer quite the options you need there really isn't much choice!  At least there's the hope that the python prototyping I'm doing might inspire a competent coder to leap to the mantle and take on the hard work.  Boids generally work in 3D space without stable collisions and don't have the ability to be constrained to a surface/mesh (ie a mesh offset from the ground plane which represents the translational limits of say their torso/root bone).  On the tube project we'll soon be starting work on a scene which requires a large scale crowd simulation.  Over the last 4 days I've put down the foundations of an almost-stable collisions system in python with some basic flock awareness.  More importantly I've implemented some important optimisations which make slow python less painful than it otherwise would be.  Black specks on a grey background might look pretty boring, but this is a big milestone (almost) successfully reached in implementing my half typed up design docs!

Mood Change Walk

First attempt at a mood change walk with the Ludwig Rig (and some special FK/IK adaptations) in blender 2.5.  Background flies are boids with a vortex field.



Talking of boids I've been working on some python code for boid like crowd simulations, the difference being they're slightly less flock like, constrained to a 'ground' geometry and they can't collide or pass through each other.

Thursday, 4 November 2010

Week 4 Line Test and Maya

Week 4 - pushing and pulling and last week's bouncy ball with a mesh deform to vertex color based shader I coded in MEL.




code...

int $numberOfVertices[]=`polyEvaluate -vertex pSphere1`;
string $neighbouredges[];
string $neighbourverts[];
float $edge_start_original[3];
float $edge_end_original[3];
float $edge_start_deformed[3];
float $edge_end_deformed[3];
float $diff_original[3];
float $diff_deformed[3];
float $total_length_original;
float $total_length_deformed;
float $stretch_amount[];
int $edges[];
int $i=0;
for($i=0;$i<$numberOfVertices[0];$i++)
 {
 //find neighbour edges
 $neighbouredges=`polyInfo -ve pSphereShape1.vtx[$i]`;
 string $buffer[];
 int $num_tokens = `tokenize $neighbouredges[0] $buffer`;
 $num_tokens-=2;
 for ($k=0;$k<$num_tokens;$k++)
  {
  $edges[$k]=(int)$buffer[$k+2];
  }
 //now convert the edges to lengths

 $total_length_original=0;
 $total_length_deformed=0;
 for ($l=0;$l<$num_tokens;$l++)
  {
  $neighbourverts=`polyInfo -ev pSphereShape1.e[$edges[$l]]`;
  tokenize $neighbourverts[0] $buffer;
  int $verts[2];
  $verts[0]=(int)$buffer[2];
  $verts[1]=(int)$buffer[3];

  //get edge lengths
  $edge_start_original=`xform -ws -q -t pSphereShape1Orig.vtx[$verts[0]]`;
  $edge_end_original=`xform -ws -q -t pSphereShape1Orig.vtx[$verts[1]]`;
  $edge_start_deformed=`xform -ws -q -t pSphereShape1.vtx[$verts[0]]`;
  $edge_end_deformed=`xform -ws -q -t pSphereShape1.vtx[$verts[1]]`;
  $diff_original[0]=$edge_end_original[0]-$edge_start_original[0];
  $diff_original[1]=$edge_end_original[1]-$edge_start_original[1];
  $diff_original[2]=$edge_end_original[2]-$edge_start_original[2];
  $diff_deformed[0]=$edge_end_deformed[0]-$edge_start_deformed[0];
  $diff_deformed[1]=$edge_end_deformed[1]-$edge_start_deformed[1];
  $diff_deformed[2]=$edge_end_deformed[2]-$edge_start_deformed[2];
  $total_length_original+=sqrt(pow($diff_original[0],2)+pow($diff_original[1],2)+pow($diff_original[2],2));
  $total_length_deformed+=sqrt(pow($diff_deformed[0],2)+pow($diff_deformed[1],2)+pow($diff_deformed[2],2));
  }
 $stretch_amount[$i]=($total_length_deformed/$total_length_original);
 }

//find max and min
float $max_stretch=-1;
float $min_stretch=-1;
for($i=0;$i<$numberOfVertices[0];$i++)
 {
 if($max_stretch==-1 && $min_stretch==-1)
  {
  $max_stretch=$stretch_amount[$i];
  $min_stretch=$stretch_amount[$i];
  }
 if($max_stretch<$stretch_amount[$i])$max_stretch=$stretch_amount[$i];
 if($min_stretch>$stretch_amount[$i])$min_stretch=$stretch_amount[$i];
 }

for($i=0;$i<$numberOfVertices[0];$i++)
 {
 if($min_stretch!=$max_stretch)$stretch_amount[$i]=($stretch_amount[$i]-$min_stretch)*(1/($max_stretch-$min_stretch));
 else $stretch_amount[$i]=0;
 polyColorPerVertex -colorR $stretch_amount[$i] pSphereShape1.vtx[$i];
 polyColorPerVertex -colorG $stretch_amount[$i] pSphereShape1.vtx[$i];
 polyColorPerVertex -colorB $stretch_amount[$i] pSphereShape1.vtx[$i];
 }

Wednesday, 27 October 2010

Week 3 Line Test

Nothing exciting came out of maya this week, though I did work out how to autorotate my bouncing balls with MEL, mix lattices and joints and driven keys, and write an expression to set vertex colors based on the stretch caused by the deformers, the result of which I fed into a mental ray shader - script and video coming next week, in the mean time, here's some more pencil.



I'm off to the blender conference tomorrow to see the tube team present some of the work I did with them over the summer!

Saturday, 16 October 2010

Week 2 Line Test



Week 2 was bouncing balls of various types.

Week 1 Line Test



Week 1 was a free brief.  Here's a man trying to catch a crow, from the end of the week to the start of the week, every line test in reverse order!