YORIK’S COFFEE CORNER

Hi, this is my blog, and also a guestbook. I publish stuff I do from time to time. Be welcome and feel at home, have a coffee and don't hesitate to drop me a line or two. All languages are highly welcome, especially the most exotic ones (nederlands, bij voorbeeld...).

You are currently viewing only posts tagged as blender in this guestblog.

Click here to go back the blog home page, or browse by tag: firefoxos, opensource, bede, sketches, freecad, architecture, idsampa, projects, linux, works, 3d, blender, Works, detail, photo, webdesign, wordpress, animations, inthepress, cooking, trilhas, orange, Architecture, gaming, or search the 2013, 2012, 2011, 2010, 2009, 2008, 2007 or 2006 archives.


in categories  works  3d  blender  permalink:  191   posted on 26.11.2014 23:18
From Yorik

Restaurant



Images for an interior project by Osmose Architecture.




in categories  works  3d  blender  permalink:  189   posted on 26.11.2014 23:11
From Yorik
Misc images...




in categories  works  3d  blender  permalink:  187   posted on 26.11.2014 23:03
From Yorik

Urban transformation



Images made for Osmose Architecture.




in categories  works  3d  blender  permalink:  186   posted on 26.11.2014 23:00
From Yorik

Space Planning



Images we have been developing for a space planning project by Exode Architecture.
















in categories  works  3d  blender  permalink:  184   posted on 26.11.2014 22:50
From Yorik

osmose series 4



A series of images made for Osmose Architecture.
















in categories  works  3d  blender  permalink:  183   posted on 26.11.2014 22:48
From Yorik

osmose series 3



A series of images made for Osmose Architecture.
















in categories  works  3d  blender  permalink:  182   posted on 26.11.2014 22:46
From Yorik

osmose series 2



A series of images made for Osmose Architecture.
















in categories  works  3d  blender  permalink:  181   posted on 26.11.2014 22:44
From Yorik

Osmose series 1



A series of images made for Osmose Architecture.
















in categories  Works  3d  blender  permalink:  180   posted on 26.11.2014 22:38
From Yorik
A couple of quick images we did for an interior design project...




in categories  works  3d  blender  permalink:  57   posted on 06.06.2014 15:55
From Yorik

Images of an heliport project



Recent 3D images we've been doing. Project by Coltro Ferrari, for Allta.






in categories  works  3d  blender  permalink:  56   posted on 06.06.2014 15:52
From Yorik

Industrial facility images



These are images extracted from a video we have been doing recently, that we cannot share yet. All the modeling is done with blender, rendered with the internal engine on my new favorite renderfarm, Fox renderfarm. I was until now using terrain topology from google earth, since sketchup was able to download it. Now using the latest version of sketchup on wine that functionality doesn't work anymore. So I turned to another, much better solution: Satellite-generated heightmaps. I tried first with landsat imagery, that you can find a bit everywhere (on the IBGE website for Brazil, for example). But my brother showedme something much better: Landsat satellites have only a precision of 90x90m. NASA's new Aster satellite have a precision of 30x30m, and the whole dataset is available for download at http://earthexplorer.usgs.gov/ (datasets->elevations->aster). You need a bit of work to convert and make the heightmaps match the imagery, but once that is done, you have you r terrain topology quickly and accurately done.








in categories  works  3d  blender  permalink:  55   posted on 06.06.2014 15:37
From Yorik

Private house renderings


A couple of images from an animation we have been doing this year. Unfortunately we cannot share the final animation yet.






in categories  works  3d  blender  permalink:  360   posted on 30.10.2013 21:55
From Yorik

Office images

A couple of images for a project developed by Exode... Rendered with cycles.










in categories  blender  3d  works  permalink:  337   posted on 02.10.2013 22:45
From Yorik

Fillsete animation - stills


A couple of still images from the animation below...








in categories  blender  3d  animations  works  permalink:  336   posted on 02.10.2013 22:39
From Yorik

Fillsete animation


The latest animation we made, all modelled and rendered with blender. Project by Espaço Projetos.



See still images here.

in categories  linux  blender  opensource  permalink:  331   posted on 18.09.2013 17:05
From Yorik

Update on building Luxrender



This is more a note for myself. This is an update of my original post about building Luxrender on debian:
http://yorik.uncreated.net/guestblog.php?2012=141

The original instructions are still valid, with the following changes:

- instead of "make luxrays", we can now do only "make" (needed because smallluxgpu will also be built then)
- no need to add the deprecated opencl directive anymore
- install package ocl-icl-opencl-dev (will remove nvidia opencl libs)
- set path to libluxrays.a and libsmallluxgpu.a with cmake-gui when building lux

in categories  animations  blender  permalink:  322   posted on 11.09.2013 20:48
From Yorik

Costa do Ipê - remixed video

A remix I made of the Costa do Ipê video we made some time ago. Better colors, and an experimental soundtrack...

in categories  works  3d  blender  sketches  permalink:  316   posted on 06.09.2013 2:10
From Yorik

More hand + cycles images


A couple of new images, rendered with cycles with very basic volumes and materials, and finished by hand with the gimp. The project is by Adriana Furst.




in categories  blender  opensource  permalink:  314   posted on 04.09.2013 22:38
From Yorik

Python for architects - Part 2: Blender

This is a series of 3 tutorials for architects who wish to use opensource 3D tools (mainly Blender and FreeCAD more effectively, or simply who are curious about programming, and would like a gentle introduction. This is the second tutorial, explaining how to use python inside Blender. Read also the Part 1: introduction. The third part (about FreeCAD) is yet to be written.

This second part assumes you read the first one, or that you have at least a very basic understanding of the Python language. It will focus on Blender, and show with simple example how python can be useful, and what you can do with it in Blender. This tutorial doesn't assume that you have any experience with Blender, but if you haven't any at all, be prepared to need to go look elsewhere for reference, specially on the Blender wiki, since most trivial steps won't be explained here.

The Blender Python editor

Blender, like FreeCAD, is a python beast. Although it is mainly programmed in the C language, since version 2.5, the python API (which is basically the python tools that blender provides) allows you to access and modify almost anything in Blender, including all the data of your model (scenes, objects, mesh data, lights, materials, textures, nodes, animation, etc...) and the blender interface itself (3D view, buttons windows, menus, etc...). In fact, today, many of the features of Blender are entirely programmed in python. So you can basically modify objects, create objects, and create tools with your own controls that will appear wherever you want in the Blender interface. And finally, if you do something awesome, you can pack your script as an addon, and distribute it to other blender users.

The very first thing to do to start playing with python in Blender, is to open the python console, by subdividing one window and setting it to "Python Console":

This is a python console that behaves exactly like the standard python terminal we used in the Part 1 : Introduction. Except that it has a few more goodies: Special keyboard shortcuts, like it is written when you start the console, and some modules are already conveniently imported for you (remember about importing modules in Part 1?), especially the module called "bpy", which contains about all that blender offers to python. So normally you should start any blender python script with:

import bpy

But in this console it is not necessary. Another very important window is the text editor:

This one serves to write text (or python scripts of course), and behaves a bit like any text editor like notepad, except that it can show line numbers (useful when python tells you there is an error on line X) and can paint special python words in another color, very comfortable to read your script.

When writing python scripts, have always both windows open, so you can test stuff in the python console, and copy/paste it (and save it) to the text window when you are sure that it works.

The python scripts you write in the text editor stay saved inside the blender files when you save them, but can also be saved in separate .py files. Usually I keep my scripts inside a blender file while I am developing them, and when they work perfectly I export them as .py files.

A last cool trick, CTRL + wheel mouse will zoom the text inside both python console and text editor, like most other blender windows.

Accessing and modifying existing objects

One of the first uses you'll want to do with python is to manipulate existing objects, that you have been drawing with the user interface controls. Let's for example, access the contents of our 3D scene, and list the objects contained in it. For this, we'll use the primary and most used element of bpy: the context.

The context means basically: "What is currently on stage". It will contain the current scene, the current selected object, the current view, the current state of the interface, etc. You got the picture. Remember you can always explore the contents of any python object with the dir() function. Here we'll take our current scene, and list the objects inside:

scene = bpy.context.scene
for o in scene.objects:
    print o

And it gives you this:

Now we know we want the cube. There are several ways to access it inside the current scene. The easiest is to get it by name:

cube = scene.objects.get("Cube")

But we could also select it with the mouse, then simply get the active object :

cube = bpy.context.active_object

There are always many ways to achieve something in Blender, just for the fun let's try, for example, to take all the objects of the scene and filter out those which are not meshes (the lamp and the camera):

for o in bpy.context.scene.objects:
if o.type == "MESH":
    cube = o

Remember, dir() is your friend, for example it showed me what's inside objects, so I could find the "type" property. It is also very common practice in python to document classes and functions, so you can normally expect that everything has a __doc__ (that 2 x 2 underscores) that tells you what that thing serves for and hopefully how to use it. For example:

print(cube.is_visible.__doc__)

You might have noticed that the Python console also has an autocomplete system, so when you are in the middle of typing the above command, you can at any time press Ctrl + Space to show possible completions of what you're typing. If you use that just after the "visible" word, you'll see that autocomplete shows you the contents of the __doc__.

Also don't forget there is always the complete API documentation online.

But let's get back to our example. Now that we got our cube, let's examine the contents of its Mesh (remember the len() from Part 1?):

me = cube.data
print (len (me.vertices) )
print (len (me.edges) )
print (len (me.polygons) )

Nice, isn't it? Let's see the coordinates of each vertex:

for v in me.vertices:
    print (v.co)

If you know Blender well, even without knowing Python, you already know that mesh-based objects contain mesh data, which contains vertices, edges and faces, and you know that vertices have coordinates. All this helps you when exploring the contents of the python structures inside the bpy module.

Now let's be bold and try something audacious:

v = me.vertices[0]
print (v.co)
print (v.co.x)
v.co.x = 5

"Amazing", you must be thinking. Indeed Python allows you to change about any property of anything in Blender, in real-time, no further operation required. In older versions you had to work on a copy of the mesh, then replace the mesh by its copy. Thanks to the big python-friendly recode that occured in version 2.50, things are now much easier.

Now let's study a bit better how Blender mesh are structured in python. We already saw that our mesh data contains subelements called vertices, edges and polygons. These elements can also inform you of their vertices. But instead of giving you a vertice object, they give you the index number of those vertices in the general list of vertices of the mesh:

face = me.polygons[0]
for v in face.vertices:
    print (v)

The above code shows you 4 numbers, which are the index numbers of the 4 vertices of that face. With those numbers, we can get the actual vertices from the vertices table:

for v in face.vertices:
    print me.vertices[v].co

The reason why things are like that is obvious: A same vertex can be shared by several edges or faces. So it is easier to have them stored at one central place, and then reference them as needed inside the mesh structure. Most mesh-based 3D applications do that. If we want, for example, to move a face, we actually move all its vertices:

for v in face.vertices:
    coordz = me.vertices[v].co.z
    coordz = coordz + 1
    me.vertices[v].co.z = coordz

A note about vectors

You already know that points in the 3D space have x, y and z coordinates, right? In mathematics, such group of 3 numbers (or more) is called a vector. You certainly heard about that at school (I know, you forgot)... Anyway, when dealing with programming in 3D, vectors are everywhere. You can do awesome things with vectors, multiply them, add them, find perpendicular directions, etc...

If you want to refresh your vector math skills, have a look for tutorials on the internet (I might try to do one too one day), it will be precious when you need to perform more complex operations on vertices. Blender also has a special module with tools to help you to perform operations on vectors (cross products, etc...):

from mathutils import Vector
dir(Vector)

Operators

The tools that Blender offers you to manipulate objects go far further than simply allowing you to access their components. Almost all the tools available on the User Interface are also available to the python scriptwriter. The python version of those tools is called -in Blender slang- an Operator. So all usual things such as moving an object, performing boolean operations, etc... are available in a compact, single-line way. Most of them behave the way their corresponding GUI tool behave, that is, they act on what is currently selected. That is, our famous context.

Operator are all stored inside bpy.ops, and they are grouped by category, such as object or mesh, depending on what they act on, being whole objects or their subcomponents.

For example, this moves the selected object(s) 2 units in the X direction:

bpy.ops.transform.translate(value=(2,0,0))

This scales it 2 times in the X direction:

bpy.ops.transform.resize(value=(2,1,1))

This enters edit mode, goes into face select mode, and selects a face of our cube:

bpy.ops.object.mode_set(mode="EDIT")
bpy.ops.mesh.select_mode(type="FACE")
me.polygons[0].select = True

This deletes the selected face:

bpy.ops.mesh.delete(type="Face")

I suppose now you saw how it works and how useful it can be. And also how much you need to know in order to use them! Don't worry too much, though, it is fairly easy to find your way between all the operators, and how exactly they must be used, thanks to the Blender python console's autocomplete feature (Ctrl+Space). Try for example writing this, then pressing Ctrl+Space after ops. , after object. , and after mode:

bpy.ops.object.mode

Adding data

Now that you begin to see how things work, adding basic objects can be as simple as this:

bpy.ops.mesh.primitive_cube_add()

In the mesh section you'll find other default primitives to add. But this is a bit too simple, isn't it? We would like to have more control over the object we want to add. A better path would be to respect the way Blender objects are constructed: First we add the data, then we create an object to contain the data, then add (link) the object to the current scene:

scene = bpy.context.scene
lamp_data = bpy.data.lamps.new(name="New Lamp", type='POINT' )
lamp_object = bpy.data.objects.new(name="New Lamp", object_data=lamp_data)
scene.objects.link(lamp_object)
lamp_object.location = (5.0, 5.0, 5.0)
lamp_object.select = True
scene.objects.active = lamp_object

The code above (borrowed from here) shows very well how things work internally. You can do exactly the same with a mesh instead of the lamp:

mymesh = bpy.data.meshes.new(name="New mesh")

We now have an empty mesh (no vertices, no faces), that is not bound to any object,but it exists in memory. We can for example add geometry to it, then when it is ready, we'll add it to the scene. What about constructing a pyramid? Let's make a pyramid that is centered on the origin point (0,0,0). Its base would be a square of 4x4 units, and its top would be at a height of 3 units:

# first we define the 5 points of our pyramid: the 4 corners of the base, and the top point
p1 = [-2,-2,0]
p2 = [2,-2,0]
p3 = [2,2,0]
p4 = [-2,2,0]
p5 = [0,0,3]
verts = [p1,p2,p3,p4,p5]
# no need to define the edges, they will be created automatically
edges = []
# then we define the 5 faces: the base, and the 4 triangles. 
# We need to give the position of each vertex in the list:
f1 = [0,1,2,3]
f2 = [0,1,4]
f3 = [1,2,4]
f4 = [2,3,4]
f5 = [3,0,4]
faces = [f1,f2,f3,f4,f5]
mymesh.from_pydata(verts, edges, faces)
# we always need to do this after adding or removing elements in a mesh:
mymesh.update()

The from_pydata method is a very convenient way to create a mesh from scratch in one sole operation, but you can also do it a more detailed way by adding the verts to mymesh.vertices, and the faces to mymesh.polygons (see here). When our mesh is ready, the last thing to do is to create an object from it, and add it to the scene:

obj = bpy.data.objects.new("Pyramid", mymesh)
scene.objects.link(obj)

Removing data

Removing data is even easier than creating. To delete an object, you just have to unlink it from its scene. Next time Blender will save the file, the unused data (in this case, our object, if it is not linked by any scene), will be deleted automatically (this is the same behaviour as when you delete an object from the GUI):

scn = Scene.GetCurrent()
myobj = Object.Get("Pyramid")
scn.unlink(myobj)

When we want to removing subelements (vertices, faces) from an object, we face a bigger problem, the same as when modifying something: How to know which face to delete? We saw that the faces in the list of faces can be accessed by index number, but how do we know which number corresponds to which face in the mesh?

The blender API itself responds this question: If we explore the contents of the mesh data, we notice that vertices and polygons have add() functions, but no delete() functions. You don't delete subelements like that in Blender. You select them first, then delete what is selected, all with operators:

First, we deselct everything in the scene, and set our object as the active object:

bpy.ops.object.select_all(action="DESELECT")
obj = bpy.context.scene.objects['Cube']
obj.select = True
bpy.context.scene.objects.active = obj

Then we deselect everything (because some faces might be selected already), and select the first face. Warning, in Blender you HAVE to be in object mode to mark subcomponents as selected. I know, it seems very illogical, but it's the way it works...

bpy.ops.object.mode_set(mode = 'EDIT' )
bpy.ops.mesh.select_all(action="DESELECT")
bpy.ops.object.mode_set(mode = 'OBJECT' )
obj.data.polygons[0].select = True

Then, all we need to do is enter edit mode again, and delete (using Face mode, of course.)

bpy.ops.object.mode_set(mode = 'EDIT' )
bpy.ops.mesh.delete(type="FACE")
bpy.ops.object.mode_set(mode = 'OBJECT' )

But as I wrote above, the big difficulty is to know which one is polygon[0]. So in a real-world case, probably you will already have the faces to be deleted selected, so you would only use the 3 lines above to delete them.

Making an operator

Now that we are quickly becoming experts at manipulating Blender data, let's imagine we have an operation we repeat often, and want to create an operator with it, so we don't need to retype all the sequence everytime, we can just call our operator, one line of code, and it's done!

To make an operator is not difficult when we already know what it will do and how to do it. For example, let's say we want to make an operator that deletes the first face of a selected object. Easy, we just did this above, right? Then, to define an operator with it, we'll just need to pack the above code in a special structure. For this, it is better to use the text editor (see above), because we don't want to execute the code line by line, we want to save it and execute it in one block later (yes, I'm already also thinking to use it as an addon later!)

First, don't forget that the bpy module is only imported by default in the console. Everywhere else, we need to import it:

import bpy

Then we can create our operator:

class Delete_first_face(bpy.types.Operator):
    bl_idname = "mesh.delete_first_face"
    bl_label = "Deletes the first face of the active object"
    
    def execute(self, context):
        obj = bpy.context.active_object
        bpy.ops.object.mode_set(mode = 'EDIT' )
        bpy.ops.mesh.select_all(action="DESELECT")
        bpy.ops.object.mode_set(mode = 'OBJECT' )
        obj.data.polygons[0].select = True
        bpy.ops.object.mode_set(mode = 'EDIT' )
        bpy.ops.mesh.delete(type="FACE")
        bpy.ops.object.mode_set(mode = 'OBJECT' )
        return {'FINISHED'}

Simple, no? With the keyword "class", we defined a python class. I won't enter the details (read here to know more), but think of it as a kind of blueprint that can be used to create objects (python objects, not blender objects). Those objects inherit what we define inside the class. Here, the important parts to understand is that we create a custom class that we called "Delete_first_face", and it is a modified copy of another existing class, called bpy.types.Operator. The blender developers have created that class exactly for that purpose, to be used by scriptwriters like us as a base for their own operators.

So we really need to add very few info to such class: define a couple of parameters, such as bl_idname, which is the name of the operator (where it will live inside bpy.ops), and a more human-friendly description of what it does. Then, one last piece has to be defined, the most important, what will that operator do? That is what goes inside the execute() function. All operators have that function, it gets executed when the operator is called somewhere. So all we need to do is put our code inside, and finish with return {"FINISHED"}.

Now that we have our operator, we need one last bit: add it to the list of Blender operators. For that, we do this:

bpy.utils.register_class(Delete_first_face)

After that, simply run the script inside the text editor (Alt+P), and our operator will be available in the console:

Of course this is a very simple example. If you close blender, the operator is gone, and we'll need to run this code again. But that is why addons exist, we'ĺl come to that now.

One last thing, the blender text editor has several easy-to-use templates to create such operators quickly. Look in the "Templates" menu of the text editor...

Making an addon

Making an addon can be something very complex. Here is a very good tutorial on creating a more complex one. Here, we will do simple: We will just reuse our operator above, transform it into an addon, and add an item to the "Object" menu in Blender. I realize now that we should have called our operator object.delete_first_face instead of mesh.delete_first_face, so we will correct that too. To turn our script above into an addon, we first need to add a header with some info:

bl_info = {
    "name": "Delete first face",
    "author": "Yorik van Havre ",
    "description": "Deletes the first face of the active object",
    "version": (0, 1),
    "blender": (2, 5, 8),
    "category": "Object",
    "location": "Object > Delete first face",
    "warning": "",
    "wiki_url": "",
    "tracker_url": ""
    }

If we are going to distribute our addon, it's a good idea to also include a license text. GPL is a good choice. it is the license used by Blender itself. Then we add our operator itself, and a couple of additional functions to register it and add a menu entry. Also I modified the class name to respect the convention that other blender addons are using. The complete code looks like this:

bl_info = {
    "name": "Delete first face",
    "author": "Yorik van Havre ",
    "description": "Deletes the first face of the active object",
    "version": (0, 1),
    "blender": (2, 5, 8),
    "category": "Object",
    "location": "Object > Delete first face",
    "warning": "",
    "wiki_url": "",
    "tracker_url": ""
    }
    
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See th
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****

import bpy

class OBJECT_OT_delete_first_face(bpy.types.Operator):
    bl_idname = "object.delete_first_face"
    bl_label = "Deletes the first face of the active object"
    
    def execute(self, context):
        obj = bpy.context.active_object
        bpy.ops.object.mode_set(mode = 'EDIT' )
        bpy.ops.mesh.select_all(action="DESELECT")
        bpy.ops.object.mode_set(mode = 'OBJECT' )
        obj.data.polygons[0].select = True
        bpy.ops.object.mode_set(mode = 'EDIT' )
        bpy.ops.mesh.delete(type="FACE")
        bpy.ops.object.mode_set(mode = 'OBJECT' )
        return {'FINISHED'}
        
def add_operator(self, context):
    # Register our operator
    self.layout.operator(OBJECT_OT_delete_first_face.bl_idname, text="Delete first face", icon='PLUGIN' )

def register():
    # Add our operator to the "Object" menu
    bpy.utils.register_class(OBJECT_OT_delete_first_face)
    bpy.types.VIEW3D_MT_object.append(add_operator)

def unregister():
    # Remove our operator from the "Object" menu
    bpy.utils.unregister_class(OBJECT_OT_delete_first_face)
    bpy.types.VIEW3D_MT_object.remove(add_operator)

if __name__ == "__main__":
    # This allows us to import the script without running it
    register()

Then, we can run that script from the text editor (Text -> Run script, or Alt+P). It will not be permanent, but we can check if all went okay. If no error arises, and if the script does what it is meant to do, then we can consider it finished, and install it permanently, from the Preferences screen (addons -> from file...)


Conclusion

That's about it for this tutorial, I hope you liked, don't forget to leave a comment! Next one will be about FreeCAD!


in categories  blender  opensource  3d  gaming  permalink:  282   posted on 17.07.2013 21:08
From Yorik

Hiking day game


Work gave us a little break these last days, so I have been tinkering again with the blender game engine, and managed to get a finished game, my first game ever! It has been made with the Blender game engine, in 5 days (plus a couple of more days for testing, optimizing and bug-killing), so please excuse the poor finishes....

It is a first-person adventure game, set in a mountains environment. I will not reveal the plot, but it begins like this: You were hiking in the mountains, by a fair summer day, when suddenly...











The game is totally opensource and the files are available on github. There are also ready-to-play versions of the game:

Enjoy, and if you happen to try it please tell me what you thought, I am very new to game making and critics are highly welcome...

in categories  blender  3d  works  animations  permalink:  253   posted on 15.04.2013 22:33
From Yorik

Casa Lagoa do Banana


This is an animation we made for a project by Espaço Projetos. See also still images and the storyboard. All was made with blender and rendered with the internal engine...


in categories  blender  3d  works  permalink:  252   posted on 15.04.2013 22:20
From Yorik

Images Lagoa da Banana


These are still images from an animation we did recently for a project by Espaço Projetos

















Also check the storyboard here...

in categories  blender  3d  sketches  permalink:  251   posted on 15.04.2013 22:09
From Yorik

Storyboards always


I realized how important storyboard were when I saw David Revoy's amazing work on the Tears of Steel movie. Until then I hadn't realized this was something actually doable, draw the whole movie before doing the 3D. I discovered it is not only perfectly doable, but also incredibly useful.

This is the storyboard we did for a recent work. If you do animations, always do a storyboard before, no matter how good your drawing skills are. The time you'll save later and the understanding between you and your client will raise tremendously. It also serve you as a guide throughout the job, when you were able to build a scene that produces the corresponding image from the storyboard, you can mark it as done, and you have a clear view of your progress.

Also try to do bring most of the discussions at storyboard time, and you'll have very little to change to the scenes structure later on.

This is the complete storyboard:



And this is the content of our "final images" folder. Some sequences changed after the storyboard, but the general shape of the animation stayed the same.



See bigger images here.

in categories  opensource  blender  permalink:  217   posted on 21.02.2013 22:33
From Yorik

Blender cross section script ported to 2.6x


This was long, long overdue, but the cross section script I and a couple of others wrote for blender 2.49 has finally been ported to 2.6x, thanks to the efforts of @Ejnaren who did most of the job.



The script works basically the same way as the 2.49 version, you select objects to cut, then (as the last object of the selection) a planar object (it must contain only one face) that defines your cut plane, and press the button. The controls - once the addon is installed - are in the tool shelf, and there is an option to fill closed paths with faces, like in the example above.

The addon is currently available via the blender project tracker or directly from here.

in categories  3d  works  blender  animations  permalink:  214   posted on 18.02.2013 15:54
From Yorik

Loja Maresia


This is a short animation we recently did for a shop designed by Espaço Projetos. All modeled and rendered with blender (internal renderer).



And a couple of still images extracted from it:








in categories  3d  works  blender  permalink:  213   posted on 18.02.2013 15:43
From Yorik

Boats animation


This is a short glimpse at an animation we did recently. Unfortunately I cannot reveal more because we are bound by one of those NDAs, but suffices to say it is about sea and boats, and I did a whole storyboard by hand before animating, which was a tremendously enlightening exercise, since, while it only cost us a small amount of time, it allowed us to gain very much control over the whole process, including the discussion with the client (everything is "decided" before the real work begins), and the animation itself. We never really thought much about film sequencing before (archviz walkthroughs being very "straightforward"), and this allowed us to really plan and think about scenes beforehand.

In short, if you work with animations, never do it without a storyboard...




in categories  linux  opensource  blender  permalink:  201   posted on 18.01.2013 15:41
From Yorik

About Clevo, Avell, Debian and Cycles





I got myself this new toy: An Avell G1511 notebook. It is a very good machine, with a recent generation I7 CPU, an Nvidia GTX660m GPU with a 1920x1080 display, and an hybrid HDD+SSD hard drive, which boots debian in less than 7 seconds from grub to fully loaded desktop.

This notebook is what is called a "barebook", or "whitebook", or "barebone notebook". It is actually a Clevo W350, which sells with only the shell, the motherboard and the GPU. The guys at Avell add the other components (Avell only sells in Brazil, but there are similar brands in the USA and in Europe, like Sager or Schenker, more here ). As a result, it is very configurable, and you can choose between many types of CPUs and hard disks. You can even choose the color of the shell... And a very remarkable detail, all Avell notebooks have a 3-year warranty.

There is quite some time I wanted to put my hands on such a barebook, and it is really a very good machine. First advantage is the very low price, a notebook with the same setup costs about the double if it comes from Dell/Alienware or Asus, and triple if it is a Mac... Basically you can get yourself a pretty powerful machine at the cost of a very mid-range one. The I7 + GTX660 allows you to run any recent game, and the 2 games I installed until now (Oil Rush and Serious Sam 3) both run with all settings at maximum in 1920x1080...

I also discovered that between all notebook vendors, only Asus makes its own shells. All others (Dell, HP, Sony, etc...) also buy their shells from a third-party manufacturer. So not only there is no difference with Avell/Clevo, but also Clevo is a very well-known one, and really the W350 shell is excellent: It is solid and the thermal design is very good. The ventilator can spin quite hard when doing CPU-intensive jobs, but doesn't even need to run when gaming in high-resolution... And the design is actually far from ugly, differently from what I expected...



Since this notebook comes without operating system, I started by installing my favourite operating system, debian (testing release). I made a coupe of technical questions to Avell before buying and the guys were very professional, they dug all the answers I needed, etc. Even so, I wasn't sure some smaller parts would work out-of-the-box. Good news, 100% of the hardware is supported. Not totally out-of-the-box, though, but everything was very easy to solve. Basically I had to do this:
  • The Ivy-bridge architecture this I7 CPU is based on is only well supported from kernel 3.6. Debian testing ships with 3.2, which makes the system freeze from time to time, but 3.7 is available form the repos, so it is very easy to fix
  • The Nvidia GPU is an Optimus-based one (a system to switch automatically between the I7 integrated GPU and the Nvidia one, to save power), and optimus is still not officially supported on linux (Fuck you Nvidia! said Linus Torvalds about that problem). Fortunately, the opensource community came with a solution that is now extremely stable, and I would say almost better than the official driver, called bumblebee, and its new indispensable add-on called primusrun. On Ubuntu all this is easily installable via PPA, on debian you need to compile them yourself, but if you use debian, you surely like to compile stuff yourself... With bumblebee and primusrun, you simply force any application to use the Nvidia GPU, while the rest runs on the I7. The performance is smooth and perfect.
  • All the peripheral hardware is from Realtek. The network adapter works out-of-the-box, the wireless adapter not, but already has a linux driver available from realtek, which you can compile yourself now, but will be included in the kernel 3.8, and the card reader needs an additional package called rts-bbp.

After that, everything runs perfectly. I like to use debian testing because you can install it bit by bit, starting from a very bare minimal installation, and add pieces as you need them. Definitely debian is not a distribution for you if you don't like to configure your own stuff. Only to make a bootable USB stick you need to read several instructions pages... But on the other hand, you end up with a blind-fast system, where you know every piece and every process.



After the system was up, one of the most important things I wanted to test is Blender's GPU-enabled renderer, cycles. I compile blender myself (I can't wait to get the new features), and fortunately, at this date, all the dependencies you need are in the debian repositories (except opencolorio and opencollada, but they are both optional). You must just be very careful to get all the Nvidia stuff (nvidia driver, cuda libs and cuda toolkit) with the same, matching version numbers (in my case they come all from the debian experimental repo, driver 313.18 and cuda 5.0), otherwise Blender won't detect your card. And you don't even need bumblebee to run cycles!

Much has been said (specially by our friend Ivan ) about Nvidia 600-based GPUs and their poor performance in cycles (namingly, even being more recent, they behave much worse than 500 series). This proves out to be quite true unfortunately, the Mike Pan's BMW benchmark renders in 3'06" (against 3'20" when rendering with the CPU), and on the benchmark page you see older GPUs rendering the same scene in about 1 minute.

But there are several other considerations to take into account: The Nvidia 600 series (also called Kepler) is pretty new, so cycles might still not use them with full potential (cycles is still in heavy development), and benchmarking sites usually place the 600 series quite above the 500 series, so they perform better in other areas (gaming especially). This is also because they use a much faster memory than the 500 ones. And my notebook is not meant to become a cycles rendering node, we always use render farms for heavy work. And, as Saint Mango teaches us, life is meant to do hard work and play good videogames in equal parts...

in categories  works  3d  blender  permalink:  190   posted on 11.12.2012 16:04
From Yorik

Shopping mall images



A couple of images (blender internal renderer) of a shoppjng mall. Project by Renato Bianconi.








in categories  blender  sketches  works  3d  permalink:  186   posted on 05.12.2012 16:29
From Yorik

cycles + hand renders



More of those images made in gimp on top of a cycles render... Project by Adriana Furst. The last one is a garden design made 100% in gimp. Why use autocad anymore?






in categories  linux  blender  opensource  permalink:  183   posted on 04.12.2012 13:46
From Yorik

Checkframes utility


A little python utility to check that frames series you download from a render farm are okay (no frame missing, no frame with 0 byte size). Made on Linux, but should work on any platform. On Linux, place this script in your /home/$USER/bin folder (or any other that is in your $PATH), make it executable, then just run this script from a folder containing frames, or a folder containing subfolders. Enjoy!

#!/usr/bin/python

#***************************************************************************
#*                                                                         *
#*   Copyright (c) 2012                                                    *  
#*   Yorik van Havre                                  *  
#*                                                                         *
#*   This program is free software; you can redistribute it and/or modify  *
#*   it under the terms of the GNU Lesser General Public License (LGPL)    *
#*   as published by the Free Software Foundation; either version 2 of     *
#*   the License, or (at your option) any later version.                   *
#*   for detail see the LICENCE text file.                                 *
#*                                                                         *
#*   This program is distributed in the hope that it will be useful,       *
#*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
#*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
#*   GNU Library General Public License for more details.                  *
#*                                                                         *
#*   You should have received a copy of the GNU Library General Public     *
#*   License along with this program; if not, write to the Free Software   *
#*   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  *
#*   USA                                                                   *
#*                                                                         *
#***************************************************************************

"""This utility checks the current folder and any of its subfolders for jpg, png
or exr image sequences, numbered 0001.jpg, 0002.jpg, etc... and checks that no
frame number is missing, and that no image is corrupted (sero-size)."""

import os,sys
from PIL import Image

# keeping count of errors
errors = 0

# getting working paths
homepath = os.path.abspath('.')
subpaths = []
for p in os.listdir(homepath):
    ap = homepath + os.sep + p
    if os.path.isdir(ap):
        subpaths.append(ap)

subpaths.sort()

# add current path too
subpaths.insert(0,homepath)

# checking frames
for p in subpaths:
    print(" ")
    print("checking folder "+p)
    frames = []
    for i in os.listdir(p):
        if i[-4:].upper() in ['.JPG','.PNG','.EXR']:
            frames.append(i)

    if not frames:
        print("    This folder doesn't contain frames")

    else:
        # counting frames and checking numbers
        frames.sort()
        try:
            last = int(frames[-1].split('.')[0])
        except:
            print("    Error: couldn't parse frame numbers in this folder")
            continue
            
        if len(frames) != last:
            print("    Error: frame numbers differ from frames count in this folder: 
	last frame is "+str(last)+" but contains "+str(len(frames)))
            ext = frames[-1].split('.')[1]
            for i in range(1,last+1):
                fn = str(i).zfill(4)+'.'+ext
                if not fn in frames:
                    errors +=1
                    print("    Missing frame: "+fn)
    
        # displaying info of first image
        try:
            imf = Image.open(p+os.sep+frames[0])
        except:
            print("    Error: cannot open image "+p+os.sep+frames[0])
            continue
        else:
            print("    "+str(last)+" frames - format: "+imf.format+" - "+str(imf.size[0])+"x"+str(imf.size[1]))
    
        # checking size
        for f in frames:
            fp = p+os.sep+f
            s = os.path.getsize(fp)
            if s < 1024:
                print("    Error: zero-sized file: "+fp)
                continue
                
        # subdir succeeded
        print "    Everything ok"

# all tests are done
print(" ")
if errors:
    print(str(errors)+" errors found")
else:
    print("Success: All frames are ok")
    
sys.exit()

in categories  freecad  opensource  blender  permalink:  180   posted on 26.11.2012 20:37
From Yorik

FreeCAD Arch module how-to


In this article I'll try to describe you the new Arch module, that will be available in the soon-to-be-released version 0.13 of FreeCAD. I built a small model with it, in order to walk through the different components and tools currently available.

This project is based on a Blender model that I made during the first phase of the project. FreeCAD is a very precise tool, where things such as modifying objects takes much time. For that reason, when what you want is speed, you are definitely better with a faster, free-form modeler such as blender or sketchup. Nowadays, once you built a very imprecise model, it is fairly easy to make things straight and with the right dimensions in Blender, thanks to the very good snapping tools. You just need to build a couple of reference edges, that set things like external dimensions, roof height, and you can snap all your building to them.



Importing a blender model into FreeCAD is extremely reliable. You have several "transport" formats available (OBJ, STL, DAE), but i always prefer the OBJ format, because it is human-readable, it is well implemented in both Blender and FreeCAD, and it allows fairly complex concepts such as NGons (DAE relies on external components in both applications, and STL reduces everything to the most basic entities). All you need to do is select your objects to be exported in Blender, export to an OBJ file (a corresponding materials file will be created, but that one is not used by FreeCAD), and open it in FreeCAD. Due to the Z/Y orientation of OBJ files (the Z is not pointing "up" but "towards you"), you may need to give all imported objects a 90° rotation on X axis, with their placement property.

Once this is done, you can use that mesh as a base to build your model. You could transform your blender objects directly into Arch objects (Creating a wall or structure with a mesh selected automatically turns it into a wall or structure, provided it is solid an dnon-manifold), but in this case I wasn't too sure about the thickness of my blender walls, and I prefered to start from scratch. I started by drawign some guidelines, mostly to have something to snap to later on.



After that I used the wall tool on my line segments, mostly to check if all worked ok, and to see which wall I would align externally, and which one centrally.



I added two axes systems, and a column. By adding axes systems to a structural element, you turn it into an array. If you add one axes system, the structural element gets copied once on each line. If you add two systems, it gets copied on each itersection of the two systems. That is what I used here to place the columns at the appropriate locations.



Finally, I joined all my base lines with the upgrade tool into two objects, one for exterior walls and one for interior walls (they would have different thicknesses and alignment), and converted them into sketches. Then, I adjusted all the internal lines of the sketches, and rebuilt two new walls on top of them. By adding one wall to the other, you make them union (but they are kept as separated objects in the objects hierarchy). This is the big advantage of parametric modeling, all is undoable, modificable.





I then began to work on the bae slab, which in this case is pretty complex, features many different levels, stairs, etc. I basically worked by laying draft wires, then extruding them and turning them into structural elements. I also placed a couple of helper dimensions, to help me figure out how I would do the stairs.



The stairs are pretty simple, once I calculated the size of one element, I just duplicated it a couple of times.







I then added the windows and doors. Both windows and doors are made with the same window tool (after all, a door is only a special case of a window). If you have a face selected when you press the window tool, it enters in sketch mode, allowing you to draw the window directly on the wall. You can use all the sketcher tools such as importing external edges from the wall to place your window accurately. By default, if you draw your window with two closed wires, one inside the other, when you close the sketch, a defualt window will be created by extruding both wires and subtracting the inner one. But you can make about any combination you want, and the different components (the extrusion depth, which wire must be subtracted, etc) is all configurable in the window's edit mode. Just remember to always draw closed, non-overlapping wires.

Doors are made exactly the same way, only the base of the interior rectangle is aligned with the base of the exterior rectangle (the vertical distance between the two edges is 0).

Here I also added the brise-soleils by making a rectangle, another one smaller by offsetting the first one, then subtracting it from the first one, then extruding, the using the Draft array tool to make the serie of 8 brises.



I also made two beams, with a structural element to which I added one of the axes systems, and then added a roof slab, by extruding a rectangle, then adding a small wall on its border. The wall is then added to the slab.

I then added all the objects of the model to a floor object, which will be easier to make sections, since you can assign one floor object to a section, and it will automatically cut through everything that is inside the floor.



Time for a fist test of a plan view, by adding a horizontal section plane object:



I finally added the big window on the front, by building a rectangular block first, which would give me a face to support the window. I then built a sketch on it, with one exterior rectangle and several inner rectangles. As soon as you exit the sketch, the window is created.



The house is now complete, we can add a couple of other section planes, to make sections and elevations.





And here is the final result on the Drawing sheet, I used the wireframe rendering for plans and sections, and the solid rendering for elevations. You will of course see imperfectiosn here and there, but remember that the development of the Arch module is a work in progress, and it will still take a lot of time before things are perfect. Anyway, I think this already begins to give us a good base.



From our section planes, we can also extract flat shapes directly in the document, by making Shape2Dview objects with them selected. I made two for each section, one showing everything, and one (with thicker line) showing only the cut lines.



These flat objects export very wall to DXF, with absolute precision. You can then use them to build more complex 2D drawings.



That's about it, in the Arch module you will also find a couple of other helper tools, mainly made to help you to convert meshes to arch objects (split meshes, detect non-manifold ones, etc), and a roof tool, which is still pretty experimental, but already works fine for simple roofs. Remember that all this is still being developed, so don't expect to find the same workflow as in commercial applications. You will likely need to go back, try other methods, etc... several times during your work. But I hope I could demonstrate that the foundations are there, and that FreeCAD can begin to have its place in a productive workflow.

The final FreeCAD file can be downloaded here, but remember that until version 0.13 is released, you will need a development version to be able to open the file.

And don't forget, FreeCAD has a lot of documentation and a very cool community that can help you to get on tracks with it...

in categories  blender  permalink:  166   posted on 23.09.2012 18:19
From Yorik
Trying to make a decent sky gradient (it's harder than you would think...)



Blender file here: http://yorik.uncreated.net/scripts/horizonte.blend

in categories  blender  opensource  permalink:  141   posted on 02.08.2012 23:20
From Yorik

Building luxrender on linux



I wrote this little article mostly because I had to reinstall Luxrender (mostly to try Luke's work), and this will serve me as a memo for another time. The info below comes mostly from the official instructions.

First, you must install the dependencies listed on the official page above. Here luckily I already had all of them. Then, the luxrender system comes in 2 parts, luxrender and luxrays. So it's best to create first a containing folder, then clone the 2 repositories:

mkdir Luxrender-source
cd Luxrender-source
hg clone http://bitbucket.org/luxrender/lux
hg clone http://bitbucket.org/luxrender/luxrays
hg clone http://src.luxrender.net/luxblend25

Then, prepare for out-of-source build for luxrays:

cd ..
mkdir Luxrender
cd Luxrender
mkdir luxrays
cd luxrays
cmake ../../Luxrender-source/luxrays

Then, because of some bug between openCL 1.2 (which is the version I have here on debian wheezy) and 1.1 (which is used by lux), you must use the -DCL_USE_DEPRECATED_OPENCL_1_1_APIS option when compiling. The easiest way is to use cmake-gui:

cmake-gui .

Then add "-DCL_USE_DEPRECATED_OPENCL_1_1_APIS" to CXX_FLAGS and C_FLAGS. Press "Configure" then "Generate".

For me the luxrays library then compiles fine, but the benchmarks failed. But there is an option to compile the luxrays lib only:

make luxrays

If all went okay, let's do lux:

cd ..
mkdir lux
cd lux
cmake ../../Luxrender-source/lux

It will complain that luxrays was not found. Then, start cmake-gui:

cmake-gui .

And change the value of LUXRAYS_LIBRARY to the path of your luxrays/lib/libluxrays.a file. Also add the same compiler option as in luxrays above. Press "Configure" then "Generate". Then, build:

make luxconsole
make luxrender
make pylux

Now, go back to the luxblend folder and link pylux there:

cd ../../Luxrender-source/luxblend25
ln -s ../../Luxrender/lux/pylux.so

Then link the luxblend folder and the presets into your blender scripts folder:

cd ~/.blender/2.6X/scripts/addons
ln -s /path/to/Luxrender-source/luxblend25/src/luxrender
cd ../presets
ln -s /path/to/Luxrender-source/luxblend25/src/presets/luxrender

Then, all you need to do is open blender, activate the plugin, and set the path to /path/to/Luxrender/lux/ in the render options.

in categories  works  blender  sketches  3d  permalink:  139   posted on 01.08.2012 15:59
From Yorik

cycles + hand drawings


Two new images made with cycles (+ hand finish in gimp) for a project by Adriana Furst...




in categories  freecad  blender  opensource  permalink:  128   posted on 23.07.2012 20:59
From Yorik

FISL talks



This week I'll be giving a freecad talk (wednesday, 16h) (pdf) and a blender workshop (friday, 17h) (pdf) at the FISL in Porto Alegre. I'll post my impressions after the show here, and try to grab the video if it's filmed. See you there!




in categories  opensource  freecad  linux  blender  permalink:  96   posted on 04.06.2012 21:06
From Yorik

Python for architects - Part 1: Introduction

This is a serie of 3 tutorials for architects who wish to use opensource 3D tools (mainly Blender and FreeCAD more effectively, or simply who are curious about programming, and would like a gentle introduction. This is the first tutorial, presenting python in a general way. Read also the second part: about Blender. The third part (about FreeCAD) is yet to be written.

Why would I need to program? You might ask. There are a couple of reaons:

  • We architects are too dependents on big firms (Autodesk, Graphisoft, etc). They decide which tools, formats and standards we will use, and their decisions are in most cases dictated by commercial interests. We should be able to reflect and decide ourselves about how we want our work to be done, and have the power to craft our own tools if theirs are not good for us. Well, fear no more, yes we can!
  • Python is already included in many tools you know (or not): Blender, FreeCAD, Maya, Rhino, OpenOffice, and the crazy python fans everywhere even went much further, and you can now also use python in AutoCAD, 3ds Max or Revit, or Softimage. It also powers a very big part of Linux software. Python is everywhere. If you know one or another of those applications already, most of the work is already done. You'll just need a bit of python "sauce" to pilot them the same way as you already do with the mouse...
  • It is much easier than you would think. I'll try to demonstrate this below.

Why python?

Python is a programming language. It is free, open-source, multiplatform (Windows, Mac, Linux and many others), and it has several features that make it very different than other common programming languages, and very accessible to new users like yourself:

  • Python is a language described by its conceptors as "made for human beings", and is very easy to learn and understand. And even so (or, maybe, because of it), python is one of the most powerful languages available, principally because it can be (and is) extended almost infinitely, and is very, very widely used by people who are no computer scientists and never studied programming, like me.
  • It is interpreted, that is, unlike most other programming languages, it can be executed on-the-fly, as you write it. This has tremendous advantages for newcomers, for example it notifies you almost immediately when you make an error. You can start with very little knowledge, trying stuff, and in many cases it will teach you how to correct things and what to do next.
  • It can be embedded in other programs to be used as scripting language. Blender and FreeCAD have an embedded Python interpreter, so you can write Python code in them, that will manipulate parts of those programs, for example to create geometry. This is extremely powerful, because instead of just clicking a button labeled "create sphere", that a programmer has placed there for you, you have the freedom to create easily your own tool to create exactly the geometry you want.
  • It is extensible, you can easily plug new modules in your Python installation and extend its functionality. For example, you have modules that allow Python to read and write jpg images, to communicate with twitter, to schedule tasks to be performed by your operating system, etc. The list is endless. All this is easy to combine together, and use the power of one inside the other. For example, you can send tweets from blender, or create an openoffice sheet inside FreeCAD. You can even do incredible things such as running FreeCAD inside Blender (since FreeCAD is itself a python module too) and maybe the contrary too in the future...

So, hands on! Be aware that what will come next is a very simple introduction, by no means a complete python course. But my hope is that after that you'll get enough basics to explore deeper into the Blender and FreeCAD mechanisms, which will be in parts II and III of this tutorials serie.

Installing

Installing python present no difficulty at all, if you are on Linux there are 99% of chances that it is installed already, since it powers many parts of your system (try running "python" from a terminal to check), otherwise just install it from your system's package manager. On Windows and Mac, just download and install the latest version from the official python website. If you have Blender or FreeCAD installed, they already include an embedded python version, and you don't need to install anything.

When installing python, you might be able to choose between several versions. At the time of writing, the globally considered "stable" version is 2.7, but the latest version available is 3.2. I advise you to install the 3.2, or any higher version available. This tutorial is based on 3.2, but normally everything will work just the same with any other version.

The interpreter

Usually, when writing computer programs, you simply open a text editor (such as notepad on Windows) or a special programming environment which is in most case a text editor with several tools around it, write your program, then compile it (that means basically convert it into an executable application) and run it. Most of the time you made errors while writing, so your program won't work, and you will get an error message telling you what went wrong. Then you go back to your text editor, correct the mistakes, run again, and so on until your program works fine.

That whole process, in Python, can be done transparently inside the Python interpreter. The interpreter is a Python window with a command prompt, where you can simply type Python code, that will be executed on-the-fly, without the need to do anything else.

When Python is installed on your computer you will have a Python interpreter in your start menu (usually labelled "Python" or "Python console"). On linux and mac, you can also simply run "python" from a terminal window. Or, simply fire up Blender or FreeCAD, which both have an included python interpreter (also called "python console"). Below are images showing a standalone python console, and the python consoles embedded in FreeCAD and Blender:

The interpreter shows the Python version, then a >>> symbol, which is the command prompt, that is, where you enter Python code. Writing code in the interpreter is simple: one line is one instruction. When you press Enter, your line of code will be executed (after being instantly and invisibly compiled). For example, try writing this:

print("hello")

print is a special Python keyword that means, obviously, to print something on the screen. It is called a function, which means basically "it does something". Like in most programming languages, functions such as this one use parenthesis () that signify "do it with the contents of the parenthesis". So here the whole line means means "print the contents of the parenthesis". When you press Enter, the operation is executed, and the message "hello" is printed. If you make an error, for example let's write:

print(hello)

Python will tell us that it doesn't know what hello is: "NameError: name 'hello' is not defined".

The " characters specify that the content is a string, which is simply, in programming jargon, a piece of text. Without the ", the print command believed hello was not a piece of text but another special Python keyword. I'll explain better below. The important thing is, you immediately get notified that you made an error. By pressing the up arrow, you can go back to the last command you wrote and correct it.

The Python interpreter also has a built-in help system. Try typing:

help

It will tell us that help is a function, and needs to be used with parenthesis. For example, let's say we don't understand what went wrong with our print hello command above, we want specific information about the print command:

help(print)

You'll get a long and complete description of everything the print command can do. Press "Q" to exit the help message.

Now we dominate totally our interpreter (yes, there is no more to know than that), we can begin with serious stuff.

Variables

Of course, printing "hello" is not very interesting. More interesting is printing stuff you don't know before, or let Python find for you. That's where the concept of variable comes in. A variable is simply a value that you store under a name. For example, type this:

a = "hello"
print(a)

I guess you understood what happened, we "saved" the string "hello" under the name a. Now, a is not an unknown name anymore! We can use it anywhere, for example in the print command. We can use any name we want, just respecting simple rules, like not using spaces or punctuation. For example, we could very well write:

hello = "my own version of hello"
print(hello)

See? now hello is not an undefined word anymore. What if, by terrible bad luck, we choosed a name that already exists in Python? Let's say we want to store our string under the name "print":

print = "hello"

Python is very intelligent and will tell us that this is not possible. It has some "reserved" keywords that cannot be modified. But our own variables can be modified anytime, that's exactly why they are called variables, the contents can vary. For example:

myVariable = "hello"
print(myVariable)
myVariable = "good bye"
print(myVariable)

We changed the value of myVariable. We can also copy variables:

var1 = "hello"
var2 = var1
print(var2)

Note that it is interesting to give good names to your variables, because when you'll write long programs, after a while you won't remember what your variable named "a" is for. But if you named it for example myWelcomeMessage, you'll remember easily what it is used for when you'll see it.

Numbers

Of course you must know that programming is useful to treat all kind of data, and especially numbers, not only text strings. One thing is important, Python must know what kind of data it is dealing with. We saw in our print hello example, that the print command recognized our "hello" string. That is because by using the "", we told specifically the print command that what it would come next is a text string.

We can always check what data type is the contents of a variable with the special Python keyword type:

myVar = "hello"
type(myVar)

It will tell us the contents of myVar is 'str', or string in Python jargon. We have also other basic types of data, such as integer and float numbers:

firstNumber = 10
secondNumber = 20
print(firstNumber + secondNumber)
type(firstNumber)

This is already much more interesting, isn't it? Now we already have a powerful calculator! Look well at how it worked, Python knows that 10 and 20 are integer numbers. So they are stored as "int", and Python can do with them everything it can do with integers. Look at the results of this:

firstNumber = "10"
secondNumber = "20"
print(firstNumber + secondNumber)

See? We forced Python to consider that our two variables are not numbers but mere pieces of text. Python can add two pieces of text together, but it won't try to find out any sum. But we were talking about integer numbers. There are also float numbers. The difference is that integer numbers don't have decimal part, while foat numbers can have a decimal part:

var1 = 13
var2 = 15.65
print("var1 is of type ", type(var1))
print("var2 is of type ", type(var2))

Int and Floats can be mixed together without problem:

total = var1 + var2
print(total)
print(type(total))

Of course the total has decimals, right? Then Python automatically decided that the result is a float. In several cases such as this one, Python automatically decides what type to give to something. In other cases it doesn't. For example:

varA = "hello 123"
varB = 456
print(varA + varB)

This will give us an error, varA is a string and varB is an int, and Python doesn't know what to do. But we can force Python to convert between types:

varA = "hello"
varB = 123
print(varA + str(varB))

Now both are strings, the operation works! Note that we "stringified" varB at the time of printing, but we didn't change varB itself. If we wanted to turn varB permanently into a string, we would need to do this:

varB = str(varB)

We can also use int() and float() to convert to int and float if we want:

varA = "123"
print(int(varA))
print(float(varA))

Note on Python commands

You must have noticed that in this section we used the print command in several ways. We printed variables, sums, several things separated by commas, and even the result of other Python command such as type(). Maybe you also saw that doing those two commands:

type(varA)
print(type(varA))

have exactly the same result. That is because we are in the interpreter, and everything is automatically printed on screen. When we'll write more complex programs that run outside the interpreter, they won't print automatically everything on screen, (in fact, maybe they won't even have a screen to print to, if they run inside another application) so we'll need to use the print command. But from now on, let's stop using it here, it'll go faster. So we can simply write:

myVar = "hello friends"
myVar

Another cosmetic detail, you can insert blank spaces where you want, just to make your code easier to read. It's a matter of taste, python doesn't consider whitespaces (unless they are inside a string, of course, otherwise how would you print whole sentences?). For example, these two lines of code are totally identical to python:

print(type(varA+varB))
print ( type ( varA + varB ) )

Lists

Another interesting data type is lists. A list is simply a list of other data. The same way as we define a text string by using " ", we define lists by using [ ]:

myList = [1,2,3]
type(myList)
myOtherList = ["Bart", "Frank", "Bob"]
myMixedList = ["hello", 345, 34.567]

You see that it can contain any type of data. Lists are very useful because you can group variables together. You can then do all kind of things within that groups, for example counting them:

len(myOtherList)

or retrieving one item of a list:

myName = myOtherList[0]
myFriendsName = myOtherList[1]

You see that while the len() command returns the total number of items in a list, their "position" in the list begins with 0. The first item in a list is always at position 0, so in our myOtherList, "Bob" will be at position 2. We can do much more stuff with lists such as you can read here, such as sorting contents, removing or adding elements.

A funny and interesting thing for you: a text string is actually, internally, a list of characters! Try doing this:

myvar = "hello"
len(myvar)
myvar[2]

Usually all you can do with lists can also be done with strings. In fact both lists and strings are sequences of elements, and you can do much more with sequences, as we'll see further on.

Outside strings, ints, floats and lists, there are more built-in data types, such as dictionnaries, or you can even create your own data types with classes. Like everything in Python, the basics are small, but it is often extensible as far as your imagination allows.

Indentation & blocks

One big cool use of lists is also browsing through them and do something with each item. For example look at this:

alldaltons = ["Joe", "William", "Jack", "Averell"]
for dalton in alldaltons:
   print (dalton + " Dalton")

We iterated (programming jargon again!) through our list with the "for ... in ..." command and did something with each of the items. Note the special syntax: the for command terminates with : which indicates that what will comes after will be a block of one of more commands. Immediately after you enter the command line ending with :, the command prompt will change to ... which means Python knows that a :-ended line has happened and that what will come next will be part of it.

How will Python know how many of the next lines will be to be executed inside the for...in operation? For that, Python uses indentation. That is, your next lines won't begin immediately. You will begin them with a blank space, or several blank spaces, or a tab, or several tabs. Other programming languages use other methods, like putting everythin inside parenthesis, etc. As long as you write your next lines with the same indentation, they will be considered part of the same for-in block. If you begin one line with 2 spaces and the next one with 4, there will be an error. When you finished, just write another line without indentation, or simply press Enter to come back from the for-in block

Indentation is cool because if you make big ones (for example use tabs instead of spaces because it's larger), when you write a big program you'll have a clear view of what is executed inside what. We'll see that many other commands than for-in can have indented blocks of code too.

For-in commands can be used for many things that must be done more than once. It can for example be combined with the range() command:

serie = range(1,11)
total = 0
print ("sum")
for number in serie:
   print (number)
   total = total + number
print ("----")
print (total)

Or more complex things like this:

alldaltons = ["Joe", "William", "Jack", "Averell"]
for n in range(4):
   print (alldaltons[n], " is Dalton number ", n)

You see that the range() command also has that strange particularity that it begins with 0 (if you don't specify the starting number) and that its last number will be one less than the ending number you specify. That is, of course, so it works well with other Python commands. For example:

alldaltons = ["Joe", "William", "Jack", "Averell"]
total = len(alldaltons)
for n in range(total):
   print (alldaltons[n])

Another interesting use of indented blocks is with the if command. If executes a code block only if a certain condition is met, for example:

alldaltons = ["Joe", "William", "Jack", "Averell"]
if "Joe" in alldaltons:
   print ("We found that Dalton!!!")

Of course this will always print the sentence, because the stuff after "if" is always true ("Joe" is indeed foundin the allDaltons list), but try replacing the second line by:

if "Lucky Luke" in alldaltons:

Then the result of that line is false, and nothing is printed. We can also specify an else: statement:

alldaltons = ["Joe", "William", "Jack", "Averell"]
if "Lucky Luke" in alldaltons:
   print ("We found that Dalton!!!")
else:
   print ( "Such Dalton doesn't exist!" )

Functions

The standard Python commands are not many. In current version of Python there are about 30, and we already know several of them (print(), len(), type(), etc...). But imagine if we could invent our own commands? Well, we can, and it's extremely easy. In fact, most the additional modules that you can plug into your Python installation do just that, they add commands that you can use. A custom command in Python is called a function and is made like this:

def square(myValue):
    print ( str(myValue)+" square meters" )

print ( square(45) )

Extremely simple: the def() command defines a new function. You give it a name, and inside the parenthesis you define arguments that we'll use in our function. Arguments are data that will be passed to the function. For example, look at the len() command. If you just write len() alone, Python will tell you it needs an argument. That is, you want len() of something, right? Then, for example, you'll write len(myList) and you'll get the length of myList. Well, myList is an argument that you pass to the len() function. The len() function is defined in such a way that it knows what to do with what is passed to it. Same as we did here.

The "myValue" name can be anything, and it will be used only inside the function. It is just a name you give to the argument so you can do something with it, but it also serves so the function knows how many arguments to expect. For example, if you do this:

print ( square(45,34) )

There will be an error. Our function was programmed to receive just one argument, but it received two, 45 and 34. We could instead do something like this:

def sum(val1,val2):
   total = val1 + val2
   return ( total )

sum(45,34)
myTotal = sum(45,34)

We made a function that receives two arguments, sums them, and returns that value. Returning something is very useful, because we can do something with the result, such as store it in the myTotal variable. Of course, since we are in the interpreter and everything is printed, doing:

sum(45,34)

will print the result on the screen, but outside the interpreter, since there is no more print command inside the function, nothing would appear on the screen. You would need to do:

print (sum(45,34))

to have something printed.

Modules

Now that we have a good idea of how Python works, we'll need one last thing: How to work with files and modules.

Until now, we wrote Python instructions line by line in the interpreter, right? What if we could write several lines together, and have them executed all at once? It would certainly be handier for doing more complex things. And we could save our work too. Well, that too, is extremely easy. Simply open a text editor (such as the windows notepad, or gedit on ubuntu), and write all your Python lines, the same way as you write them in the interpreter, with indentations, etc. Then, save that file somewhere, with a .py extension instead of the usual .txt. That's it, you have a complete Python program. Of course, there are much better and much more comfortable editors than notepad (try notepad++ for example), but it is just to show you that a Python program is nothing else than a text file. Also note that on windows, python already comes with an editor named "IDLE", which is also a very comfortable way to write python code.

To make Python execute that program, there are hundreds of ways. In windows, simply right-click your file, open it with Python, and execute it. But you can also execute it from the Python interpreter itself. For this, the interpreter must find your .py file. The easiest way is to place your .py file in a place where python will search by default, such as the folder from where you started the python interpreter. On linux, by default it is your user home directory, on windows it is the folder where you installed python. If you use FreeCAD, you can simply place your .py file in the macros folder.

Here is a simple trick to find, from inside the python console, what is the current directory, which will be a good place to save our script (I'll explain later):

import os
os.path.abspath(".")

Then, let's fire our text editor, and write the following text:

def sum(a,b):
    return (a + b)

print( "test.py succesfully loaded" )

and we save it as test.py in the directory found above. Now, let's start our python console, and, write:

import test

without the .py extension. This will simply execute the contents of the file, line by line, just as if we had written it in the interpreter. The sum function will be created, and the message will be printed. There is one big difference: the import command is made not only to execute programs written in files, like ours, but also to load the functions inside, so they become available in the interpreter. In python, that kind of files, made to be imported into other files instead of being simply executed, are called modules.

Normally when we write a sum() function directly in the interpreter, we execute it simply like that:

sum(14,45)

Like we did earlier. When we import a module containing our sum() function, the syntax is a bit different. We do:

test.sum(14,45)

That is, the module is imported as a "container", and all its functions are inside. This is extremely useful, because we can import a lot of modules, and keep everything well organized. So, basically, everywhere you see something.somethingElse, with a dot in between, that means somethingElse is inside something. Now you should understand better what we did with our "os" module above. The os module is a standard module of python, and contains operating system-related functions, and a submodule (simply a module inside a module) named "path" which contains tools to work with files and folders.

We can also throw out the test part, and import our sum() function directly into the main interpreter space, like this:

from test import *
sum(12,54)

Basically all modules behave like that. You import a module, then you can use its functions like that: module.function(argument). Almost all modules do that: they define functions, new data types and classes that you can use in the interpreter or in your own Python modules, because nothing prevents you to import modules inside your module!

One last extremely useful thing. How do we know what modules we have, what functions are inside and how to use them (that is, what kind of arguments they need)? We saw already that Python has a help() function. Doing:

help()
modules

Will give us a list of all available modules. We can now type q to get out of the interactive help, and import any of them. We can even browse their content with the dir() command:

import math
dir(math)

We'll see all the functions contained in the math module, as well as strange stuff named __doc__, __file__, __name__. The __doc__ is extremely useful, it is a documentation text. Every function of (well-made) modules has a __doc__ that explains how to use it. For example, we see that there is a sin function inside the math module. Want to know how to use it?

print ( math.sin.__doc__ )

which is a simpler version than:

help(math.sin)

And finally one last little goodie: When we work on programming a new module, we often want to test it. So once we wrote a little piece of module, in a python interpreter, we do something like this, to test our new code:

import myModule
myModule.myTestFunction()

But what if we see that myTestFunction() doesn't work correctly? We go back to our editor and modifiy it. Then, instead of closing and reopening the python interpreter, we can simply update the module like this:

reload(myModule)

Conclusion

By now, you should have a broad idea of how things are programmed in python. As you see, it's basically a matter of writing text files containing your python instructions, and have these files (modules) imported in your favorite application, and executed for example when the user pushes a button. How to achieve that depends from the application, that's what we'll explore in the next parts of this tutorials serie...

In the meantime, if you would like to know more about the basics of python, there are many, many tutorials on the internet. I selected a couple of good, simple and easy ones here. For more advanced ones, just google for "python tutorial", and you'll find plenty, including one from the official python website.

There are also many very complete PDF ebooks:

I hope you liked, if anything is unclear, please tell me by posting a comment below, so I can make it evolve into something better!

To be continued! Read the second part: about Blender.


in categories  blender  permalink:  49   posted on 24.03.2012 16:23
From Yorik
Matching colors to a photograph...


in categories  linux  opensource  blender  permalink:  177   posted on 03.12.2011 16:41
From Yorik

Compiling YafaRay

I had to dig through several places to find the right info and tweak things a bit, so here goes the resume. This is on debian testing but should work on any updated linux distribution. I didn't have to install any extra libs, I suppose that if you can compile cycles you'll already have all you need...
cd ~/Sources
git clone git://github.com/YafaRay/Core.git YafaRay
cd YafaRay
git clone git://github.com/YafaRay/Blender-2.5-Exporter.git Exporter
cp CMakeConfig/UserConfig.template UserConfig.txt
Change the following values in UserConfig.txt
set(BUILDRELEASE ON)
set(USER_INSTALL_PREFIX "/home/yorik/Apps/YafaRay")
set(YAF_PY_VERSION 3.2)
Then go on (I prefer to build outside of the source folder):
cd ~/Apps
mkdir YafaRay
cd YafaRay
cmake ../Sources/YafaRay
make
make install
Then link evrything in blender scripts folder:
cd bin
ln -s ../src/bindings/yafrayinterface.py
ln -s ../src/bindings/_yafrayinterface.so
ln -s ../src/bindings/_yafqt.so
ln -s ../lib/libyafaraycore.so
ln -s ../lib/libyafarayplugin.so
ln -s ../lib/libyafarayqt.so
ln -s ../lib/yafaray plugins
cd ~/.blender/scripts/addons
ln -s ~/Sources/YafaRay/Exporter yafaray
cd yafaray
ln -s ~/Apps/YafaRay/bin

in categories  linux  freecad  blender  architecture  opensource  permalink:  97   posted on 22.09.2011 16:52
From Yorik

Linux for architects


This is a little introduction to Linux for you architects who have never tried it, but would like to know what's all the fuss about it and if it is really usable for working with architecture. If you know Linux already, I'm sure you'll find a lot of missing info in this text and find it maybe a bit too enthusiastic, but we are whowe are, aren't we...

This article is a sequel of another short article I wrote back in 2009 to present some tools available to architects on the Linux platform.

Just a small note, What it is exactly?

Actually it's wrong to call Linux Linux. Linux systems are not all-in-one, monolithic things like Windows, but rather a complex assemblage of software pieces, Linux being only the base block.

Linux is based on Unix, its predecessor, and follows a basic Unix philosophy: Rather than having one huge all-in-one application that does 1001 tricks, have 1001 small applications that do each one one simple task, but do it well.

Most of the other pieces come from a project called GNU, that's why those systems are usually called GNU/Linux and not just Linux. But let's make it simple and continue to call it Linux.

Of course make those thousands of small applications all work seamlessly is not a small work, but fortunately it has been done a lot of times already. This is where comes what we call a Linux distribution, which is a complete operating system, based on GNU/Linux, made of hundreds of little pieces, all working in a big symphony. Ubuntu is one of the most famous Linux distributions.

First things first, Why Linux Is For You

  • Linux is free. This means not only that you don't pay anything, but also that you are free to do what you want with it: download it, distribute it, share it on bitTorrent, (you caneven sell it), without having to do anything or report to anyone. Like GNU people use to say, it's free like freedom, not free like free beer
  • Much more important than being free, it will stay free forever. Like most free software, its code carries a license that prevents it from being bought by a firm and stop being free.
  • Your distribution doesn't only provide you with the Linuxoperating system, but with almost any piece of software that runs on Linux. As a consequence, all your applications can be installed easily from your distribution's servers, and your whole computer, not only the operating system but ALL yourinstalled applications, are updated automatically.
  • Linux inherits another very important thing from Unix: The rock-solid built-in protection of networking, files, processes and users. As a consequence, Linux is almost invulnerable to viruses (there is no Linux virus known today) and easily protected against network intrusions.
  • Linux and most free applications that runs on it are programmed and maintained by people who have no commercial reasons to do it. They do what they think is best, not what they think will sell better. Your software will never force you to buy a new computer (Linux and most free software run fine on very old hardware) or a new plugin, and software evolves extremely fast (new features land on your system almost every single day).
  • People who make free software are extremely social. You find them easily, talk to them, discuss, share ideas, and easily get involved in directions your favorite application is taking. All happens through forums, email discussions, chat rooms or facebook pages. If you miss some feature and you can convince people of the importance of your claim, chances are high that someone will implement it.
  • Linux can safely be installed side-to-side with another operating system such as Windows. A menu will then appear, at boot time, to allow you to choose which system to boot to.

The Bad

Of course nothing comes without disvantages. Here are a few issues you might expect:
  • Bleeding-edge new hardware might not be totally supported yet. Nobody has commercial urge to make Linux work for your particular hardware, so you usually have to wait until some Linux programmer will get one for him, be annoyed be the fact it isn't supported, and remedy the situation. It's always a good idea to test before installing or investigate before buying.
  • Windows software doesn't run on Linux systems. You will need to get used to other applications. But most of the usual ones have one or many excellent or even much better alternatives in Linux, and nowadays more and more applications such as Google Chrome, Firefox or Open Office can run on both Windows and Linux. Some more specialized commercial-grade applications such as engineering applications still don't have a Linux alternative, though. You will sometimes need to do some homework and find workarounds to palliate to that situation.
  • There is no firm behind Linux. Nobody to call, nobody to complain to. Although some firms may offer you tech support, you are on your own in most cases. But fortunately most answers are very easy to find on the internet, a simple search like "How to resize a picture in Ubuntu" will usually give you an easy and immediate answer.

So what does it look like?

If you managed to read until now, you must be a bit curious to see what it looks like, right? I gathered here a couple of screenshots from the most common distributions:

Below is the latest version of Ubuntu, probably the most famous of all Linux distributions, and one of the most friendly to new users. In this version, Ubuntu introduced a new way to navigate through your files and applications, called Unity, which is the vertical bar containing icons on the left:



Another very good distribution is LinuxMint. Linux Mint is based on Ubuntu, so it inherits all the qualities of its father. But its developers put a special effort into style and design, so Linux Mint is often the favorite distribution used by artists:




This is another of the most famous ones among new users, called Fedora. Fedora is derived from a famous commercial Linux system called Red Hat, and it inherits from it a great deal of novelty and power. Fedora is usually liked because it brings bleeding-edge features faster than the others:



But most Linux systems are deeply customizable, and you can usually make your desktop look like your wildest dreams. Here is, for example, a screenshot of my own desktop:



How to get it

Most Linux distributions have a great feature: The installation CD is also a Live CD, that allows you to run your Linux system entirely from the CD, without installing anything. This is a great way to test, to see if it runs well, and if you like it at all, without risking to do any harm to your current system. The proceeding is very simple:
  • Download an .iso CD image from one of the distribution sites indicated above. Sometimes they have several flavours, such as 32bits or 64bits. Choose one that suits your computer. Since a full CD image is a big file (700Mb), Most of them allow you to download it via bitTorrent if you prefer. Some even provide DVD versions, which include more pre-installed applications.
  • Burn that image on a blank CD. Be careful, burning an image is not the same thing as copying a file on a CD. Simply copying the .iso file on the CD won't work, you must either right-click on the .iso file and select a "burn this image to disc" option, or open your disk burning software and find the "burn disc image" option. When your disk is burned, it will contain several files, not the .iso file.
  • Now place your fresh CD in your CD drive, and reboot your computer. On some systems, you must allow your computer to boot the CD before booting the Hard drive, this is usually done by pressing a key (F2, F12) during the first seconds after powering up and selecting your CD drive in a list.
  • Your new operating system will now boot. Remember that nothing is copied to your computer, so you can play safely with everything, there is no risk to harm anything. Just remove the CD and reboot, and you'll be back to your original operating system. But remember too that nothing you do while you are running from the CD will be saved, so you will loose any work you do during that time.
  • Most Linux distributions, when running from the CD, will have an "Install to Hard Drive", icon, which you can use when you are ready to install. You will then be taken to a step-by-step install procedure.
Now where are the file explorer, the internet explorer, the windows messenger, the acrobat reader, photoshop, skype, notepad, word, excel? Well, almost none of those are there, but all have at least one equivalent. Explore the menus and you will find everything in no time. And if something is missing, it can easily be installed by the system itself.

This is, for example, the Ubuntu software center, from where you install just about anything:

Okay, after all this bla-bla, what about doing architecture work?

The problem you'll encounter with Linux is that none of your usual architecture software will work. No Autocad, no Revit, no Archicad, no Vectorworks, no 3DS Max, no V-Ray. Those are all windows-only (some run on Mac too), and it's very unlikely that their developers will want to spend time in doing a Linux version in the near future.

So, how bad exactly is the situation?

Actually it is not bad at all, but you will need to learn to use new software, there is no way to avoid that part. Apart from that, it is actually possible to work without any problem.
2D CAD
In the 2D CAD field, we have a couple of options now. Some are totally free, like QCad,Cademia or the new and promising LibreCAD. Those, since they are maintained and developed by a community, might lack some commercial features like DWG format compatibility. This is LibreCAD:



We also have several commercial applications, which are not free, but run natively on Linux, and have all the features that you would expect from a commercial application, such as DWG compatibility and technical support, like Ares Commander and BricsCAD. Here is BricsCAD:



And, since a couple of months, we now have a free AND commercial application called DraftSight. DraftSight, although owned by a company, is distributed for free, and supports DWG format natively:

3D CAD & BIM
Here unfortunately things are less easy. There is at the moment no ready solution, but there are several efforts going in that direction, so the future is promising. One of these efforts is an application called FreeCAD to which I have the honor to contribute with coding in my spare time. FreeCAD is a full modern parametric modeler, and although very young, it already has a lot of interesting functionality for doing architecture, such as a 2D drawing module, usual 3D tools such as extrusion and booleans, and a 3D-to-2D module. A real BIM module is also in development.



I write a lot about FreeCAD on this blog...
3D MODELING & RENDERING
In the area of 3D rendering, things are not only better but state-of-the-art, thanks to an amazing piece of software called Blender. Blender runs on windows too, so chances are high that you heard about it already. Blender is for me the best general-use 3D application available today. Better than 3DS Max, better than Maya. It is faster, smaller, and made by 3D users instead of made by Autodesk. Blender can do everything that those 2 applications can do, and has several external renderers available.

The only drawback of blender is that it can be hard to learn if you are much used to another 3D application. But I warned you about that already...



In fact, I use Blender so much that it is now not only what I use to do rendering, but also to compose architecture:



I also write a lot about Blender, there are also many tutorials on the homepage of this site.

But there is something I didn't tell you yet. Remember I told Windows applications don't run on Linux, right? Well it's not totally true. There is a little gem of a software, called Wine, which allows to run Windows applications on a Linux system. It won't work with all applications, and many will run with problems. But one of the applications that runs almost perfectly is Sketchup! Installing Windows applications with Wine is nowadays almost as easy as installing them on Windows, and they integrate seamlessly on your desktop (But of course it is never as comfortable and fast as running a native Linux application). The Wine website has a list of windows software that runs with it, with ratings, comments and notes.
2D PAINTING & PHOTO-COMPOSITION
What would be of us architects without photoshop, right? The most famous Linux photoshop-like application is called Gimp, and, although many purists will argue that it lacks some or another indispensable photoshop option, is an excellent and very mature application, totally able to perform all the tasks architects usually require from photoshop, and, thanks to the typical friendliness to extension and customization found in most Linux applications, you can extend it into a very powerful digital painting platform.



To give you an idea, this is the kind of drawing that you can achieve with gimp only:



But a lot of digital artists use Linux nowadays, so there are many more interesting tools available, like MyPaint or Krita. Another must-have Linux application is inkscape, which is a vectorial drawing application, similar to Corel Draw or Illustrator. It is commonly used for drawing diagrams, icons and vector artwork, but is perfect for mounting more complex presentation sheets.



Also worth noting, many of those applications also run on windows, so it's a good place to try.

Are there architects out there who use Linux?

Because of all the little problems but mostly because it is not very well known, very few architects use Linux at this time. But things are changing fast... Here is a list of interesting people who share tips, techniques and resources about the subject: Enjoy!

in categories  blender  permalink:  143   posted on 24.08.2011 14:14
From Yorik
Commenting post 142: Hi Rob,
I have all that stuff here too, fortunately!
the blender greenhouse (blender trees with textures included): http://yorik.uncreated.net/greenhouse.html
the rendered textures: http://yorik.uncreated.net/archive/textures/index.html
the ngp files + textures used to create them: http://yorik.uncreated.net/archive/ngplants/
the povray plugin I use to render the images directly from ngplant: http://yorik.uncreated.net/scripts/ngplant-povray.html

Feel free to use anything you might find useful. But note that these trees are not exactly suited for games. The 3D versions are way too heavy for games, and the textures are flat renders, made for billboards, which are good for animation but not too good for games. One solution I used already is to use them for vegetation that is far from the camera. Then, using the textures and doing a "cross" with 2, 3 or 4 planes works well, like this:



blend file here...

in categories  blender  permalink:  131   posted on 27.07.2011 22:38
From Yorik

Blender 2.5 black and yellow theme



A little theme for blender 2.5. Install it via the theme manager addon. Enjoy!



http://yorik.uncreated.net/scripts/themes/blacknyellow.blt

in categories  blender  freecad  opensource  permalink:  116   posted on 11.07.2011 20:40
From Yorik

Exporting 2d linework from blender 2.5



Blender 2.5X still does not feature the excellent dxf exporter Migius wrote for blender 2.49, so I mounted this little workaround to be able to export linework from a blender model to a 2D CAD application such as FreeCAD or LibreCAD (or AutoCAD if you really must...).

It is made of two scripts, a blender addon to export and a FreeCAD macro to import. In blender, install the addon the usual way, then use it from the export menu to export the selected meshes. What will be exported is simply all the edges of the selected meshes in a text file, one edge (2 vertices) per line.

Then, place the FreeCAD macro in your macros folder, then run it, select the exported .txt file, and voila, your objects edges get imported, one compound object is created per blender object. You can then select everything and export to dxf if you want.

Here are the two scripts:
http://yorik.uncreated.net/scripts/blender25/io_export_flat_edges.py
http://yorik.uncreated.net/scripts/importFlatEdges.FCMacro


The meshes to be exported in blender


The imported linework in FreeCAD


The same linework exported in .dxf fomat and opened in LibreCAD.

in categories  blender  permalink:  113   posted on 08.07.2011 19:55
From Yorik

Haiku icons for blender 2.5

These are the standard blender icon files where I changed the folder icons to match the Haiku icon theme. Follow the official instructions to install...




in categories  opensource  blender  permalink:  76   posted on 21.04.2011 21:29
From Yorik

Playing with luxrender


I never paid enough attention to LuxRender, so the other day I decided to play a little bit with it. Installation on linux (debian wheezy 64bits) with blender 2.57 is easy (download the luxrender 64bit binaries, download the blender addon, copy pylux.so from the binaries to the addon, activate it and that's it). This is luxrender 0.8, so it already has (preliminary) support for GPU rendering, and the addon is really impressive already, totally integrated into the different panels of blender (scene, materials, lights, world, etc...).

The only thing I couldn't make work is rendering transparently in blender, that is, without opening any luxrender window. This is due to the luxrender binary I downloaded being compiled with a different libpng version than mine. I could of course compile luxrender, but there are some problems with the version of openCL libs I have in debian (of course lux needs the most advanced available...) and I got too lazy to look for a solution.

Anyway, rendering without opening the luxrender interface makes you miss a great feature, which is the ability to tweak your image whil it is rendering...

This is the image I managed to produce (2h rendering):



The light setup is dead simple, place one sunlamp, orient it the way you want, that's it. No setting, no tweaking. The geometry has nothing particular, lux respects all modifiers, the geometry is rendered just exactly like blender.

The materials is of course the main focus when you work with another renderer. But with this latest addon, things are really not too complicated. The blender materials panels get changed by luxrender, and you have many cryptic options to look at, but the system is simple: Choose one of the presets, change the color, change the texture and that's it. Special materials such as glass also have further presets to choose from. Textures can be either normal blender textures, or special lux textures (set from the same textures panel) which have many further options. One detail, though, all objects must be UV-mapped. And you can only add one diffuse texture.

In the image above, sand and concrete are common "matte" materials with a normal blender texture. Inox is a standard lux "glossy metal" material, the wood is a "glossy" material with a blender texture, and the character is a vertical plane with an alpha texture. This one has to be set as lux texture in order to take alpha channel intoo account. Finally I added a little bit of bloom in luxrender while rendering the image.

It really doesn't take long to get used to how luxrender works. To newcomers to luxrender, I would suggest first to test light setup, without putting any material. If the light comes good, then go ahead, put materials. Another important thing, you can take a normal blender file, already set up with blender materials, add a new scene linking objects, and start tweaking luxrender settings and materials in that new scene, your original blender materials will remain the same in your original scene (luxrender only "adds" information to the materials, does not modify them). And there is now a button called "convert blender material" which automatically creates a lux material based on the original one. But I found it better to do it by hand, because the result is not always like you want. Anyway, outside the fact that you must UVmap everything, you can get on tracks pretty fast.

in categories  blender  opensource  permalink:  73   posted on 17.04.2011 22:49
From Yorik

Solidify-wireframe script for blender 2.5


Another port I made for the 2.56 version of blender, of a script originally written for 2.4 by Alejandro Sierra. Download it from here (you might need to right-click->save as):

http://yorik.uncreated.net/scripts/blender25/mesh_solidify_wireframe.py

The script is very simpe to use, once installed via the user preferences->addons page, when you are editing a mesh, press Mesh->Edges->Solidify Wireframe, and the selected edges of your mesh will become solidified with quadrangular sections. A dialog will pop up to allow you to choose the section width. Enjoy!




Edit: In latest version, this script doesn't open a popup anymore, instead it sits in the toolshelf (T key), more the new blender way.

in categories  blender  permalink:  72   posted on 17.04.2011 22:41
From Yorik

The joy of blender scripting...



Isn't this comfortable?

in categories  linux  blender  opensource  permalink:  67   posted on 07.04.2011 21:59
From Yorik

Gimp Multilayer EXR import plugin


This plugin imports multilayer EXR images into GIMP. Please note that layers contained in the EXR image will be converted to tga format and therefore reduced to 8bit/channel. So, don't use this plugin if you want to import high-range (HDR) images into the gimp, but simply for importing multi-layer images such as exported by blender.

For this plugin to work, you also need the djv tools (djv-info and djv-convert) installed and correctly running on your system. See http://djv.sourceforge.net for info & download. To install the plugin, simply copy the file-exr.py file into your gimp plugins folder. It is tested on linux but should work on any platform.

The workflow you can achieve with this plugin is the following: When rendering an image in blender, you can divide the render into several render layers, specifying for example to render each blender layer in a different render layer. You then specify "multilayer" as the image format.



Then, after saving the image as an .exr file, just open it in gimp (gimp will now recognize the format) and all the layers will be imported as separated layers, for your painting convenience... Enjoy!


Example of the results here...

in categories  blender  opensource  linux  permalink:  57   posted on 26.03.2011 2:04
From Yorik

Generating vector 2D views of 3D models


The other day I found this interesting little trick with my friend Omar to get a precise vector 2D elevation view of a 3D model in blender. It implies a bit of swap work between applications but the result is just perfect.

1. Export your blender model as .3ds



2. Import that 3ds model in sketchup. Be sure to mark "merge coplanar faces" in the import options.

3. Set yourself in front view, set the camera to "parallel projection" and print your view as a pdf file (on linux you must have the cups-pdf package installed for wine applications to see the pdf printer). Be sure to mark "Use high accuracy HLR" otherwise your pdf will contain bitmaps instead of vectors



4. Open the resulted pdf file in inkscape (on linux you need the uniconvertor package for inkscape to be able to open pdf files), explode if needed (and remove filled areas if you wish, will make it load faster in blender afterwards) and save it as a svg file



5. Open the svg file in blender, now you just need to scale it to the exact size of your model...


in categories  3d  opensource  blender  permalink:  41   posted on 23.02.2011 2:34
From Yorik
The nodes setup used for the interior scenes of the video below. I took the idea of colouring with a ramp from a recent artwork video from overgrowth...



To compare with, here is how this image was before applying the composite:


in categories  blender  opensource  permalink:  29   posted on 04.02.2011 19:13
From Yorik

Check integrity script renamed to Select non-manifold edges

I thought this would be clearer and bette rinserted. The script can be found here:

http://yorik.uncreated.net/scripts/blender25/mesh_select_nonmanifold_edges.py

It is found in the Mesh menu in Edit mode, inside the Edges submenu. Simply run the script, and non-manifold edges, if any, will be selected, so you can easily find and fix them. Basically this script's main use if to see if a mesh can be converted to a solid when imported in a program able to do so.

The script's wiki page is at http://wiki.blender.org/index.php?title=Extensions:2.5/Py/Scripts/Modeling/Select_nonmanifold_edges

Note: I just discovered that blender already features a built-in command to do that: Ctrl + Alt + Shift + m, which makes this script totally obosolete now!

in categories  blender  permalink:  12   posted on 15.01.2011 21:42
From Yorik

Setting shortcuts for Properties window in Blender 2.5x


I had to fiddle a bit to find those, but it's actually easy: You must:

1) create a new shortcut in User Preferences -> Input -> Property Editor
2) set a F5 shortcut with action "wm.context_set_enum"
3) set a "space_data.context" attribute with valeu "MATERIAL"

You can set shortcuts for the following contexts: 'SCENE', 'RENDER', 'WORLD', 'OBJECT', 'CONSTRAINT', 'MODIFIER', 'DATA', 'BONE', 'BONE_CONSTRAINT', 'MATERIAL', 'TEXTURE', 'PARTICLE' and 'PHYSICS'

in categories  blender  opensource  permalink:  278   posted on 06.12.2010 13:44
From Yorik

Check Integrity script for blender 2.5


This is my first script adapted for blender 2.5. It was a bit of work to understand all the differences but I think the next ones will go faster now. I'll wait for the new blender project tracker to be up then I'll submit it there.

Download it here: http://yorik.uncreated.net/scripts/blender25/object_check_integrity.py

The script checks a mesh object and selects all edges that are not manifold (that is, that don't have exactly 2 faces connected to them). In other words, a manifold mesh is a mesh that can be converted to a perfect solid (no holes, and no face that has no inside/outside). After running the script on the active object, enter editmode and the bad edges will be selected so it's easy to find and fix them.

Install the script via the addon manager, it will then be available in the "Object" menu.

in categories  works  blender  3d  permalink:  261   posted on 03.12.2010 2:58
From Yorik
Two renderings of a project by Luc Nelles in Belgium...




in categories  opensource  freecad  blender  permalink:  122   posted on 11.08.2010 14:45
From Yorik

More on FreeCAD, or Generative Components-like workflow on Linux

I did this interesting little chain yesterday, you might find it interesting. With a bit of trickery, you can really do some interesting parametric-generated architecture design on linux, only with open-source tools. And when I say architecture design, I mean the whole production chain, from conception to paper prints.

If you don't know Generative Components, it's a piece of software made to design architecture compositions based on sets of parameters that you can make evolve to create "beautiful" parametric-looking structures... I recently discovered an amazing application called StructureSynth which does exactly that: create geometry based on parameters and rules.

You design simple rules in a very simple language, such as: "Rule n°1: move 2 units in x, rotate 15° in y, then create a box, then reapply Rule n°1". Then, all the magic is here: You can specify another, different Rule n°1. The program will interpolate both randomly, and create randomic variations:



The version of StructureSynth in the Debian repositories comes with a set of exporters for different renderers such as Sunflow, and Blender, (with the help of a blender import script) which I used here to import the geometry:



The blender import script imported all the geometry as one single object, so I first separated it in original parts (Edit mode, select all, P -> separate all loose parts), then exported it as an .obj file, that < href=http://free-cad.sf.net>FreeCAD can read. Of course the blender import script could easily be adapted to FreeCAD so we could skip the Blender step, but I found it interesting to show how the geometry passes from one to another without any data loss.



FreeCAD can work with several types of geometry. Our .obj file was imported as Meshes, but much more interesting is to work with bRep objects, which are FreeCAD's "native" object type, and permit much more complex functionality (they have the notion of "solid", so boolean ops work perfectly, they can have real curved surfaces, etc). So I converted my meshes to brep parts with a macro, and added a couple of lines just to show you how 3D and 2D begin to mix well in FreeCAD.

The Draft module in FreeCAD can already give you nice results when putting your scene geometry on a sheet. Of course the Draft module is made for 2D, so you'll notice the 3D parts are not displaying very correctly (face inversions, mostly), but that problem will be addressed soon.



To show you better the possibilities of the Geometry-to-paper process, I did another example. It suffers the same problems as the one above, but the control over display (colors, line width, texts, etc...) begins to be good.



This is a quick structure I did just to play with the process, and here is the SVG output:



SVG files already carry informations such as paper size, and it is as reliable as pdf (you can easily turn them as pdf with apps that support svg such as Inkscape or directly from FreeCAD). At the moment the informations in the template (Project author, etc...) cannot be edited directly from within FreeCAD, so you need to edit your sheet in another app, but that also will probably be addressed one of these days.

in categories  opensource  blender  permalink:  96   posted on 01.07.2010 22:39
From Yorik

Working with blender looks cooler than sketchup

One image is worth thousand words




in categories  works  3d  opensource  blender  permalink:  89   posted on 18.06.2010 15:07
From Yorik

World cup stadiums in the blender game engine

This is a job we've recently made with Chico Ortiz for an exhibition currently running at the SESC Pompéia in São Paulo, until 30th of June.

The idea was to show a couple of stadiums interactively, so you can see their shape and surroundings, then enter them and experiment how it feels to play football there... Maíra and me made the modeling, while Chico made the game logic, python scripting, the menus and all the game system. Everything runs in the blender game engine, and is displayed in 2 consoles in the expo (on first floor, next to the spiral stair):











Here is a video of the in-game feel...

And last but not least, here are the files! Here are the 4 stadiums (74Mb zip file). In short we'll put the complete game files...

in categories  opensource  blender  permalink:  30   posted on 18.02.2010 21:05
From Yorik

Blender 2.50 and 2.49 together

A couple of days ago, the 2.49 scripts were removed from the blender trunk version (2.50). This means that when you install the 2.50 version, the 2.49 won't work fully anymore. But it is quite easy to make both work side by side:

- The user settings aready use different files (.B.blend for 2.49 and .B25.blend for 2.50) so nothing to worry about
- The scripts folders can be set to a custom path. What I do is to keep the standard .blender folder for 2.50 so it gets updated when I recompile (actually it is a link to the .blender folder inside my compilation folder), and I created a .blender24 folder, containing the old scripts. Then, in blender 2.49, set the script path to that one in the preferences, and the job is done!
- You can then create two different links (or two different launch icons) to the two blender executables. If you are on linux, you can even create a "blender" link in your /home/user/bin folder pointing to the blender 2.50 executable, so it overrides your system-installed blender...

in categories  opensource  3d  blender  permalink:  23   posted on 03.02.2010 22:54
From Yorik

Switching to blender 2.5



The new blender version 2.50 is now in sufficient good shape to be fully customized, and to me that was a very important point. So I swapped my main work version to the new one. Of course, since several functions are still not there (and specially almost all the python scripts), it's good to keep a 2.49 version around for a couple of months.

I had a bit of trouble understanding how to change the default theme (You must go into the outliner, set it to display the user preferences, then navigate to the theme and replace the theme name "Blender" by another name, which will create a new - editable - theme.

Other small thing was the middle mouse button that rotates the view instead of panning. Same thing here, you must export the default keymap, then change its name and reimport it, in order to create an editable keymap. Then, swap the view2d.pan and view3d.rotate values.

I still cannot seem to export my new theme, but as soon as it works I'll post it around here...

in categories  opensource  architecture  freecad  blender  linux  permalink:  40   posted on 28.11.2009 2:25
From Yorik
Actually I really should write a kind of FAQ or article about doing architecture on a Linux platform... Many people are indeed interested by the subject. So, here we go:

My architecture workflow on linux

Actually there is no obvious or productive workflow possible at the moment, due to the lack of good (productive) CAD software on linux. You can do architecture on linux, but you won't have the same level of productivity as if you just draw with your favorite CAD program under windows (I indeed have a dual boot system .


just for the fun, my linux desktop!

That said, if you are willing to move away from the "all-in-one" solutions that big CAD vendors sell, you already can do a very big part of the work with linux software. I myself use blender for about 80% of the conception work, the rest being simple hand sketching. You already have several good scripts to generate plans and sections from your models in blender, and export them to convenient CAD formats like DXF. Search the blender wiki scripts section.

In blender you can do all kinds of useful things like importing your hand-drawn sketches, pieces of 2D CAD plans, model on top of it, etc, for example:


blend file here

The biggest problem is then, when you want to do 2D CAD. There are indeed several solutions, like qcad, autocad under wine, bricascad/intellicad, or long-time linux CAD challengers, like cycas, graphite one or varicad. There are also a number of interesting newcomers, like realCADD or medusa. But none of those solutions are really productive and free at the same time.

What I do most of the time, when I don't need much detailing, is to use several programs, each for doing pieces of the work. This is a typical unix-like approach (use several simple, reusable programs to do separate tasks, instead of having one all-in-one program) that in my opinion could benefit much architecture workflows on linux.



I myself contribute with coding and documentation to a very interesting program (currently) named FreeCAD that could hopefully fit very well in the middle of the workflow, to rework data coming from 3D into precise construction drawings. It is in usable state already, but not for real production.



Note that FreeCAD is not at all aimed at becoming another autocad clone, and 2D drafting is only a temporary use I make of it. The plans for the future of FreeCAD include much more powerful things such as parametric modeling, automatic sectionning, or structural analysis.
Today I still use a mix of other programs, such as autocad, qcad or sketchup. I also use different utilities and convertors to manipulate different file formats, like RealCadd converter or Varicad viewer.

The same way as the data you export from a 3D program to a 2D app, the way the data is formatted is the most important point, not the program you used to make it. If you modeled your building correctly, you will have good 2D data, easy to rework in 2D. The same should apply to 2D data. If you build your technical drawings correctly, they will be easy to export to other programs for presentation work.

The presentation work in itself is also easy to do under linux, there are several programs able to import technical drawings and rework them, my favorite being inkscape:



I also use gimp a lot.

All this works quite well for short or limited architecture projects, like competitions or draft projects, but of course, not so well for more detailed work such as execution drawings. For that, we would need better tools for technical drawing. At the moment I don't know any that is strong enough to allow fast, efficient and beautiful work. But the way we draw architecture is slowly changing too, so maybe new solutions will begin to appear on the linux platform too.

And if you are interested in helping the situation to evolve quicker, there are many great open-source projects out there that could use your efforts, even if you are not a programmer. This is the case of most of the software I showed in this article.
Note: I wrote a sequel to this article, explaining how to get started with Linux...

in categories  opensource  blender  permalink:  35   posted on 28.11.2009 1:58
From Yorik
New blender theme:




in categories  opensource  freecad  blender  permalink:  105   posted on 28.11.2009 1:55
From Yorik

FreeCAD import script for Blender

I just made a new script to import FreeCAD files into Blender. You must have FreeCAD installed for this script to work, and you must configure the path to your freecad.la file at the beginning of the script.
The script can be downladed here: import_freecad.py


Note: at the moment you need a recent SVN version of blender (>2111) to make it work...

in categories  opensource  blender  permalink:  112   posted on 28.11.2009 1:54
From Yorik
Another blender theme!

in categories  opensource  blender  permalink:  187   posted on 28.11.2009 1:52
From Yorik

How to import google earth terrain data into blender

Quite easy, actually. You need google earth, sketchup (free edition), python and blender installed.
  1. Open google earth and zoom to where you want to import. You might need to zoom closer than you want, because sketchup has an altitude limit. In that case, do several parts
  2. Open sketchup, and press "get current view" button
  3. After import, press the "toggle terrain" button
  4. Right-click the terrain, Unlock, then Explode
  5. Export as a kmz model
  6. Save a color image from the same view in google earth (Ctrl+Alt+S)
  7. Rename the saved .kmz file extension to .zip
  8. Unzip it
  9. There will be a "models" folder with a .dae file inside. Open that file with blender's Collada 1.4 import script
  10. Select everything and scale by 0.00001 (more or less)
  11. Unparent everything (Alt+P)
  12. Change the black and white texture by the image you just saved from google earth

in categories  blender  permalink:  11   posted on 28.11.2008 1:29
From Yorik

BLENDER, ARCHITECTURE" BOOK - SAMPLE CHAPTER

This is a sample chapter from Allan Brito's book "Blender, Architecture, Building and Scenery", for which I have made the technical review. This is chapter 6, treating Furniture modeling. Download it here (pdf, 1.6Mb)

in categories  blender  permalink:  10   posted on 28.11.2008 1:28
From Yorik

Blender 2.4 themes

The default blender is rather ugly, don't you think?  Here are a couple of home-made Blender themes to make it more sexy... Just click on the image to download the theme. Then, in blender, open a text window, load the them file, and run it (Alt-P). Then, if you liked, don't forget to save your preferences (Ctrl-U) otherwise you'll have to load it again next time you start blender.

Tutorial Theme
Tutorial Theme
Tutorial Theme
Clean Theme
Black Theme
Dark Theme
Slightly Different theme

in categories  blender  permalink:  9   posted on 28.11.2008 1:25
From Yorik

FreeCAD importer blender script

FreeCAD importer

This script imports FreeCAD files into blender. You must have FreeCAD installed for this script to work, and you must configure the path to your freecad.la file at the beginning of the script.

in categories  blender  permalink:  8   posted on 28.11.2008 1:24
From Yorik

DXF and SVG profile exporter blender script

DXF & SVG Profile exporter

This script exports selected wire contours (such as the cross sections generated by the CrossSection script) to dxf polylines or svg paths. In this last version I removed sdxf dependency. Migius did a big job at simplifying DXF outut too. He has also made a new version of a dxf export script so this one is a bit obsolete now.

in categories  blender  permalink:  7   posted on 28.11.2008 1:22
From Yorik

Check Integrity blender script

CheckIntegrity

This script checks the active mesh for open or non-manifold edges. If all edges have exactly 2 faces, this means we have a perfectly closed manifold mesh. Otherwise, the 1-face or 3-face edges are selected, so you can fix them easily... Useful if you need well-closed meshes, for example when calculating volumes.

in categories  blender  permalink:  6   posted on 28.11.2008 1:21
From Yorik

Cross Section blender script

CrossSection

This script creates cross-sections of selected objects at their intersection with active object. Active object must be a plane (or any one-face object). Only meshes will be cut. The script has now been improved by Alex so no need to apply transformations anymore. Thanks, Alex!

in categories  blender  permalink:  5   posted on 28.11.2008 1:20
From Yorik

Win2Lin blender script

Win2Lin

little script is intended for people who use a dual boot (Windows/Linux) machine, and have the problem of having all their textures on one drive unit, which has a different name under Windows and Linux. This script detects your current operating system, and updates the images paths by changing the unit name if necessary.

in categories  blender  permalink:  4   posted on 28.11.2008 1:18
From Yorik

Quantities bill blender script

QuantitiesBill

This scripts creates a quantities bill from the selected objects. It separates the objects by material, then computes for each object either the volume, the total area or the total length and creates a new text in the text editor, formatted in CSV format, which you can save and open with any spreadsheet application.
For this script to be efficient, you need to be very careful when modelling, build proper meshes, according to the rules described in the script. It is a bit tedious but it is the right way to work with Blender. This is mostly made for small architecture projects, where you have linear elements, areas and volumes, to obtain a base to make a quick costs estimation.
Be sure to apply transformations to objects before running the script...
This script has been updated by people on blenderartists.org, so you'd better go there to grab a newer version...

in categories  blender  permalink:  3   posted on 28.11.2008 1:17
From Yorik

Look at Camera blender script

LookAtCamera

You know when you copy objects that are looking at the camera to another scene that already has a camera? They will go there, and bring their own camera!!! How gross!!! Now, with this script, you can delete the new unnecessary camera, select all the villain object, run the script, and they will redirect themselves to the right camera, the one that's active in the scene...

in categories  blender  permalink:  1   posted on 28.11.2008 1:15
From Yorik

Skip rendered frames

SkipRenderedFrames

This script renders the current scene, from start frame to end frame, skipping images that already exist in the rendering path. (Works with the extensions specified here below. If you render to files with some other extension, you must add it manually to the list.

The most useful use (yes...) of this script is when you leave a rendering task unattended, typically a week-end giant-animation-rendering. You make a command-line rendering using the script (in a shellscript, a .bat file, whatever) You configure your OS to start the job again in case of problem, power shortage, etc... (At or Cron in linux, Scheduled Tasks in Windows), and the rendering job will resume, skipping everything that got rendered already.