Search This Blog

Monday, November 24, 2014

Caricature drawn from memory

Hi and welcome to this sunny monday afternoon (at least here)...

The last night I did this caricature drawn from memory using Manga Studio Debut 4, running on a Macbook Pro Retina Display (Mavericks OS X), with a Wacom Bamboo tablet.

I am not sure he actually looks like the original person but he reminds me him. :-P

Saturday, September 13, 2014

Vector logo WIP for the a friend's inn

If you like to travel and are interested in visiting a particular place, I would like to suggest you my Triest.

And you would probably enjoy to have a dinner in the "Hostaria G. Strehler", a couple of months ago, a friend of mine, Alexia, opened a inn where they cook Triest and surroundings typical food.

I am currently working to their brand and visual for communication and this is a WIP of the upper part of their vintage logo for a flyer.

Sunday, August 31, 2014

Blender Python script: how to position a plane to apparently fit camera frame

In the past days I faced another challenge while working to my Blender 3D experiments.
An idea came to me when I asked myself: « Which is the optimal resolution of a texture, depending on the distance of an object from the camera? » and I started to split the problem in smaller tasks.

The first answer was: « Assume that we are watching a square plane, which dimensions apparently fit the frame of the camera. And assume that the texture perfectly fits the borders of the plane (a common situation, obtained by executing "Unwrap" command, in "Editing" mode). The condition, required to obtain such result, is to place the plane at a "special" distance from the camera (distance that I will call Critical Distance). At that distance the plane texture can have exactly the same resolution of the final render frame. Beyond the Critical Distance, the texture resolution can be lower. At distances lower then the CD, texture must have higher resolution then the render frame. ».

By default, Blender 3D render frame output resolution is configured at 1920 * 1080 px. Therefore, the texture of our plane can be (for example) the nearest power of 2 square: 2048 * 2048 px.

So, my first challenge was to find the Critical Distance and (why not) to place the plane at that distance in front of the camera.

Critical Distance is obtained by de formula:

cos ( α 2 ) l 2 sin ( α 2 ) {{cos(%alpha over 2)} cdot {d over 2}} over {sin(%alpha over 2)}

Where alpha is the FOV of the camera along X direction and l is the width of the object.

So I coded a simple add-on for Blender (still early alpha: to run it use ALT-P in the Text Editor).

# Apparent Dimension To Camera Frame Add-On for Blender 2.70 # Author: Marco Frisan # Author can be found at:,, import bpy import mathutils import math def main(context): for ob in context.scene.objects: print(ob) class ApparentDimToCamFrame(bpy.types.Operator): """Move or scale and rotate selected object to fit the camera frame with its apparent dimensions.""" bl_idname = "object.apparent_dim_to_cam_frame" bl_label = "Apparent Dimension To Camera Frame" @classmethod def poll(cls, context): return context.active_object is not None def execute(self, context): # Get the active object. obj = context.active_object # Get the active object dimensions. objDim = obj.dimensions print('Object name: ' + repr( + ';\nObject dimensions: ' + repr(objDim)) # Get the object transformation matrix in world coordinates. objWT = obj.matrix_world print('Object transformation matrix:\n' + repr(objWT)) # Get the components of the object transformation. objLoc, objRot, objSca = objWT.decompose() # Get the active camera. # The attribute returns the camera # as an object of type Object. To get Camera type # properties you have to get the data block of this # object. See later. cam = print("Camera type: " + repr(cam.type), ";\nCamera name: " + repr( # Get the camera transformation matrix in world coordinates. camWT = cam.matrix_world print('Camera transformation matrix:\n' + repr(camWT)) # Get the components of the camera transformation. camLoc, camRot, camSca = camWT.decompose() # Create a tranlation matrix with the location vector of the camera. locM = mathutils.Matrix.Translation(camLoc) print('Camera location matrix:\n' + repr(locM)) # Create a rotation matrix with the rotation quaternion of the camera. rotM = mathutils.Matrix.Rotation(camRot.angle, 4, camRot.axis) print('Camera rotation matrix:\n' + repr(rotM)) #print(rotM) #print('Camera rotation matrix, pick values:\n') #print('[0][0]:', rotM[0][0]) #print('[1][1]:', rotM[1][1]) #print('[1][2]:', rotM[1][2]) #print('[2][1]:', rotM[2][1]) #print('[2][2]:', rotM[2][2]) # Object must keep its original scale, then we create an identity matrix and set scale values directly. scaM = mathutils.Matrix.Identity(4) scaM[0][0] = scaM[1][1] = scaM[2][2] = 1.0 print('Camera scale matrix:\n' + repr(scaM)) resultT = locM * rotM * scaM #print(cam.type) #print( #print( #print( # Get the camera data block. camData = # Get the camera FOV angle in X direction and divide it by 2. fovXHalf = camData.angle_x * 0.5 # Get the X dimension of the object. dimXHalf = objDim[0] * 0.5 # Get the distance at which the object (apparently) fits camera frame. d = (math.cos(fovXHalf) * dimXHalf) / math.sin(fovXHalf) print('Critical distance: ' + repr(d)) # Create a vector of magnitude equal to critical distance. # Since camera always face -Z, the critical distance is the # third component of the vector. dV = mathutils.Vector((0.0, 0.0, -d)) print('Critical distance vector: ' + repr(dV)) # Orient the vector like the camera. dV.rotate(camRot) print('Critical distance vector aligned to camera: ' + repr(dV)) # Create a translation matrix with the vector. # NOTE: I think we could use directly a matrix, setting the [3][2] to -d. # But it works, for now. dT = mathutils.Matrix.Translation(dV) print('Critical distance translation matrix:\n' + repr(dT)) # Apply the critical distance to the result transformation. resultT = dT * resultT print('Result transformation:\n' + repr(resultT)) obj.matrix_world = resultT return {'FINISHED'} def register(): bpy.utils.register_class(ApparentDimToCamFrame) def unregister(): bpy.utils.unregister_class(ApparentDimToCamFrame) if __name__ == "__main__": register() # test call bpy.ops.object.apparent_dim_to_cam_frame()

This is the Blender 3D file: texture_size_&_camera_distance.blend.

Wednesday, August 27, 2014

How does tile size affect Cycles render performances in Blender 3D?

While working on my pseudo-minion WIP model, about one month ago, I decided to test how tile size settings affect Cycles render performances in Blender 3D.

I launched five render tests using square tiles of 16, 32, 64, 128 and 256 pixel. The results are summarized in this table.

Tile Size Render Time
16 px 00:10.59
32 px 00:10.37
64 px 00:10.52
128 px 00:10.68
256 px 00:11.74

Friday, April 11, 2014

The Zyklon Girls recruiting video: early tests

I and the staff of the Muzik! Zyklon have started to work on the new promo video for recruiting the Zyklon Girls (or zZ Girls).

Yesterday night I started producing some quick reference scenes in Blender 2.70 that I will use for animatics to have a first idea of how cut should be and what shots we will need to take. Though I already prepared the scenes for further editing to get the final result: the clock and the door frame are almost final except for textures.

I hope that this approach will help us to work at a faster pace.

I rendered three images of the clock with different settings. The presence of more lights causes a lot of noise. So, the second image was rendered with just one light and it is less noisy but darker. I think that I will try using a single brighter light for the clock scene, to reduce noise, get a brighter image (as if it were influenced by more lights) and get a reasonable render time.