Convert to Empty

Sunday, March 21st, 2010

Downloadable Files

I just now needed this to replace a bunch of objects with empties so I can use “Dupligroups” in stead. I thought I’d publish it… but no more info for now… perhaps later. It’s meant to work in Blender 2.5

Now Blender 2.5 still isn’t stable so don’t expect it to work as is forever… I found it usefull though.

Selection to view cursor

Thursday, March 18th, 2010

Downloadable Files

This script moves your current selection to the cursor relative to the current view.


Requirements

This script is written for blender 2.45


Running the script

There are no settings for this script. It acts on your currently active object, or if you are in edit mode on the verts in your mesh.

Of course you can just open the script in your text window, but I find it’s nicer from the menus. If you added the script to your scripts folder it shows up in the Object menu of your 3d view as well so you can just select it there.

But since you may also want it to be in the mesh menu I made a second version. This second version is exactly the same as the original, but with a different header.

You can download that version by clicking here: VertsToViewCursor.1.py (put that in your scripts folder as well)

If you did you’ll find it in the Mesh menu as well


The practial use of the script

Lets give a small practical example. Say I have two suzannes in my scene like this.

They have completely different positions, but now lets say that I want them right next to each other. So I put the cursor at the position of the left monkey by doing the normal “cursor to selection” (ctrl+s).

Now if I would select the other suzanne and did a “selection to cursor” their positions would be completely identical… and that’s not what I want… so I go into side view and run the script.

And this is the result as seen from the side.

But if we go to the front view you can see they are still next to each other (the x position of the second suzanne is not influensed, since that was the view vector). And we can do this from any angle, it doesn’t have to be just the front or side.

And we can do this with verts in a mesh as well! Think of it as a tool to align things!


That’s it for now.. I hope it’s as usefull to you as it is to me.

Dolf

Really big render

Thursday, March 18th, 2010

This script helps you render to sizes so large that blender can’t normally handle them.


Requirements

This script is written for Blender 2.47, but should work in older versions.

If you want to use the new Composite function you need to have a full python install and the PIL library.

You can get the PIL library here: http://www.pythonware.com/products/pil/


Running the script

The script will render to 2, 3, 4, or 5 times your original rendersize. You can select the multiplier you want from a popup window. So say your rendersettings are 800 x 600 and you select 3X multiplication, then the script will render nine images at 800 x 600. If you combine these images in your favoured image editor the end result will be a single image of 3200 x 1800 pixels. Make sure that Blender can render at your current render settings! If it can’t then it won’t render the tiles either! The tiles are rendered left to right, top to bottom and numbered as such, so 0_0 will be the left top, and 1_1 the right bottom (for a 4 tile render).


Step one, setting the filename/location to render to

The first thing you see when you run the script is a file window that comes up. Here you set what directory you want your images to be saved in. Set the filename to only the name, without the directory as in the example below.


Step two, setting the number of tiles you want (multiplier)

After the file selection window you will get a popup asking you how many tiles you want to render, as seen below here.


Step three, composite or not

If you have the PIL library installed your last option is whether you want a composite created or not.

If the script can not find the library, you will not see this option.

Be aware that the script could easily fail during this action. It all depends on how much memory PIL can use.

But even if PIL can not create your composite for you, you will still have the tiles.

The limit for my system (32bit vista) is somewhere between 15k and 20k, which is still bigger than I can render in Blender internally.


Things to know

Some texturing methods are dependant on the ‘screen’ which means they don’t work well with lens shift and this script. Try to avoid material textures mapped to “win”, and world textures with “paper” switched on.

Update: I just found out that the script won’t work if you have manually set a border. So if you have a border set to your camera… add a new/fresh camera and use that.


Example

Here I rendered cornelius at 320 x 240 pixels.

Then I ran the script, and made it render twice the size by creating the following 4 tiles.


And a much nicer example by Cujo13

He rendered this at 10.000 by 12.000 pixels, and it was used to create a mural 8.5feet by 10feet in size.

You can visit his site at http://www.greatlakesgraphics.net/


That’s all

If you have any questions or comments please contact me through the blenderartists.org forums

Enjoy macouno

Raytrace baker

Wednesday, March 17th, 2010

Downloadable Files

Important information
Be aware that baking has been added to blender’s source!

This basicly means that this script has become outdated.

Find the official information about it here.

I will keep this script online, but I won’t be updating it


Blender Raytrace Baker

Originally written by macouno 31-05-2005

(current release version 16-07-2006 for blender 2.42)

This page explains a bit about what this script does and how you can use it.


Requirements

Version 3.4 is written for the blender 2.42 official release. You can still download version 3 for older blender versions (3.4 should be fine but just to be sure I left it on here) The scripts uses both the os and math modules, which means that you need a full python install.


The gui


The use and functions of the script

Top details

blender_bray_top.gif

At the top of the gui you can read what version you are currently using.

Regular data

On the top line you can read how many mesh objects are available in the current scene. On the second line you can read what object you have selected now. On the third line you can read how many faces your current object has.

Warnings

If you don’t get the above you’ll get a message saying: No object with faces selected! Select one and press reset! Which I suggest you do ;)


Layer selection

blender_bray_layer.gif

Here you can select what layers you want to be rendered. Thus you can for instance have an object selected on layer one that you want to create a new baked texture for. But you can have the script render a higher poly version of the object on another layer.


Camera settings

blender_bray_cdist.gif

In these 3 number fields you can set your basic camera settings. For normal use I advise you to keep them as is.

c-start

Sets the clipstart of your camera in the same way the Clipsta setting in your blender settings does. If you set this too small or too close to the c-dist value you may get clipping of faces.

c-dist

Sets the distance buffer from the closest vert to the camera. The script calculates the absolute minimal distance from the midpoint between the verts to the camera. This will put it right at the closest vert. But blender needs a slight buffer for it to register a face. Thus we set the camera a little bit further away. This value should be bigger than the c-start value and smaller than the c-end value.

c-end

This one’s simple… It sets the Clipend for your camera in the same way the ClipEnd can be set in your normal camera settings. The clipend must be big enough to not only reach the distance of the first vert but the furthest vert in the face… thus we like to keep it large. Set it lower for quicker renders but usually you can leave it as is.


Frame selection

blender_bray_frame.gif

In this number field you can set what frame you want to render. It’s really only helpfull in case you want to render a specific frame in an animated sequence.


Uv layout

blender_bray_touv.gif

Here’s one to think hard about. When there are no uv coords available you will see a message in place of this toggle. No uv coords set! In normal modes it means that texface (edit buttons) is not enabled for this mesh. And normally this means there is not yet a uv layout to render to. In “all mesh” mode it means that one or more of your meshes do not have an available uv layout. When not selected the script will create all new uv coordinates for your mesh. The texture will be rendered onto a grid of squares. When selected the script will attempt to render to your uv layout. Be aware that if you have overlapping uv’s you will get unsatisfactory results.


Resetting

blender_bray_resetting.gif

Here you have two options for resetting which are normally selected. R scn When selected the new scene that’s created for tile to image conversion is not removed. Thus if you are getting errors you can use this to see if anything went wrong there. It’s really mostly there for me to see what’s happened. When in “all mesh” mode the button will be hidden and you can see the following text. Resetting! This because your blend file would get far too messy if left on. X tiles When selected all the temporary tile images created by the script will be removed after the render is complete. For testing purposes it can be handy to see everything that got done. I can come up with other applications but as a standard leave it selected.


Estimation

blender_bray_estimate.gif

When this button is selected the script will estimate optimal tile/image sizes every time you change one of their values. When you are in “all mesh” mode the button will disappear and the following text will be visible. Estimation is on! This means that reset has been switched on. This because setting tile sizes for all meshes according to the one you have selected is not practical (more on this later) You can of course swith estimation on to see what values it gives you, then switch it off and set the image size values to whatever you like.


Tile size relativity

blender_bray_relative.gif

Here you have 3 options for how you want your tile size to be calculated when estimation is switched on.

Edge length

The tile size will be calculated relative to the longest edge’s length of each face. Use this mode if you have a lot of ‘non square’ faces. Long and thin faces may not have a large area which would normally mean they get rendered quite small. In this mode that won’t be such an issue.

Face area

The tile size will be calculated relative to the face area of your mesh. If you render to an existing uv layout it calculates the maximum face area relative to the maximum uv area. Then it calculates the minimum face area relative to that. If you don’t render to an existing uv layout the maximum tile and minimum tile sizes will be calculated relative to the total area of your mesh.

Uv area

The tile size will be calculated relative to the uv layout of your mesh. If you have no available uv layout it will result in the same as a Non relative render. This mode calculates the face’s uv areas relative to the total uv area that’s available, not the total uv area that’s used.

Non relative

When tile size is non relative all your tile images are the same exact size. The difference between the total image and tile images is calculated using the total number of faces in your mesh. This is the optimal setting for rendering to a new uv grid.


Normal image sizes

blender_bray_tilesizes.gif

Here you can set the size of your renders. There are 3 available sliders.

tile min

This slider is only available when your render to relative image sizes. It sets the absolute smallest tile that will be rendered.

tile max

In non relative render mode this slider sets the size of your tiles. In relative render mode it sets the absolute maximum size for your tiles.

image

This sets the size of the total compilation uv texture image that will be rendered.


All mesh image sizes

blender_bray_minmax.gif

When you select “all mesh” mode the normal image size sliders are replaced by these 2 sliders. The size for each image will be calculated relative to the total face area of your mesh. You can still select what estimation mode you want to use. But for practical purposes we’ll let the script calculate all the tile sizes. To see what those tile sizes will be for an object leave “all mesh” mode and select that object, then press reset.

min image

The minimum size for the final uv textures.

max image

The maximum size for the final uv textures.


The render path

blender_bray_path.gif

Here you set the path where you want the files to be saved. You need a total path and filename without extention. So you can set: c:myfoldermyfilename But not: c:myfoldermyfilename.png The extention and frame nr will be added to the filename. In “all mesh” mode the object name will be added as well. If you don’t change the frame your default final imagefile name format will look like: myfilename0001.png If you are in “all mesh” mode it will look something like: myfilenametheboject0001.png


Image types

blender_bray_image.gif

This one should be easy. You can select three image types.

PNG

Targa

JPG

Do not use jpg if you want to render with an alpha channel. I advise you to use PNG since it’s lossless but not as huge as Targa.


Rendermodes

blender_bray_modes.gif

There are three render modes available.

All faces

All faces of your current mesh will be rendered

Selected faces

Only the selected faces (in face mode) will be rendered. Be aware that when you render in this mode to an existing uv layout it will also create the copies of this face needed for seamlesnes. So your image may look strange but it will be correct.

All meshes

All the mesh objects in this scene will be rendered. Reset of scene will be enabled. Estimation will be enabled. To uv layout rendering will only be possible if all your meshes have a uv layout assigned. The image sliders will be set to minimum and maximum total image.


Bottom menu

blender_bray_bottom.gif

Here you have 3 options:

Run the script

Will start the rendering of your tiles.

Reset

Will try to reaquire the mesh you have selected. Will recalculate relative rendersizes relative to the total image size.

Exit

Exits the script.


Do’s and dont’s

Pitfalls and things to do before using the script

There is a flaw in the windows dirname function when you haven’t saved your current file before. This only impacts the script if you set a relative render path. So if your renderpath was //render It may print out ./render To solve it… either just type in the full path or save your blend file (and reopen the script). The bug is solved now (so I’m told) so if you have something more current than 2.37 this should be fine. The script will get errors if you have loose verts floating around in your mesh. For finding these problems I wrote the Mesh Checker script. Also you may want to run the script on a copy of your object. This because in regular mode (not original uv) it changes all the object’s uv coordinates. I advise against using specularity! The camera angle is different for each face so it’ll never match!


Straight edges and long faces

blender_bray_edges.gif

In the example on the left you can see the model on the left and the created uv layout on the right. As you can see the blue face only uses a small portion of the square part of the uv layout it resides in. Thus as a rule of thumb… try to make your faces as square as possible. In the example on the right you can see a small white edge in the black circle. On the right you can see that that’s where the uv image borders on the white background. This is because we’re using a true ortho camera straight in front of the face. It’s not an error in the script. All I can do is advise you to use rounded or beveled objects as much as possible. Or try to set a background color that matches your object somewhat


See through faces

blender_bray_drawmode.jpg

If after rendering when you enter textured view mode you see slightly transparent faces like above. This means some faces are set with an alpha drawmode. To fix it select them all in face select mode (f) and click on the copy drawmode button in your edit buttons (texture face tab).


A nice example

blender_bray_suzanne.jpg

I rendered this texture in a half hour. The tiles are only between 20 x 20 and 40 x 40 in size and I let it render relative to face area. Rendering this model shadeless with a high osa only takes around 2 seconds now… that’s a lot quicker than the 5 minutes it would take to raytrace it every time.

That means that after baking I can render my model 150X faster!

sketchy.jpg

This is a figure by Sketchy… also baked ;) If anyone else has some nice examples that they want to show, please send them to me.


That’s all for now.

Enjoy
Dolf

Project cursor

Wednesday, March 17th, 2010

Downloadable Files

Blender 2.5 is at this point still highly experimental, so this script may well change.

This script places the cursor at the intersection of the vertex normals of selected vertexes.


Requirements

This script is written for blender 2.5 and is currently highly experimental.

Usage

Place the script in your .blender/scripts/op/ folder and when you reload the scripts using F8 or reopen Blender you can add the tool in the Tool shelf.


I will add more information when Blender 2.5 becomes more stable. For now you can see the previous version for details on what the script does.

Dolf

Project cursor

Wednesday, March 17th, 2010

Downloadable Files

This script places the cursor at the intersection of the vertex normals of selected vertexes.


Requirements

This script is written for blender 2.45 but should work with older versions as well


Usage

There are no settings for the script.

Simply select the required verts in your mesh and run the script.

Here’s an example of what I use the script for

Here we have part of a uvsphere and neither the object centre nor the cursor are where the centre of the full sphere would be.

Now say that you wanted to move or resize this mesh as if it was a full sphere.

You’d normally put the cursor at the centre of the sphere, but this won’t work here.

So we select a bunch of verts and run the script… see where the cursor ends up?

Now the cursor is where it would be if we set it to the centre if the sphere were full!

Remember that it uses vertex normals… so in this case… you don’t want to select the outer edge of the mesh… cause we really don’t know where those vert normals point.


That’s all

Nothing much to it… but usefull. Enjoy…
Dolf

Pivot constraint

Wednesday, March 17th, 2010

Downloadable Files

This script helps you to use a bone in an armature as an animated pivot point.

It can be very helpfull in making things like a heel/toe rig for a foot.


Requirements

This script is written for blender versions newer than 2.45


Setting up your rig for the script

You will basicly need 2 bones for the script to work.

1. the bone that the script is assigned to (this bone is affected by the script)

2. the pivot bone that manipulates bone nr 1.

You want both bones to be in exactly the same location/rotation in edit mode when you create them.

In the example file I named the pivot bone pivot and the bone that the script is assigned to foot.

I also made a parent bone for the both of them called location, that way you can move them together, but it’s not nessecary for the script to work.


Assigning the script

You have to have the script open in blender to be able to assign it.

So open it in a text editor window.

Now you can select the bone you want to assign the script to andOadd a script constraint.

The script should be available in the script dropdown box.

Set the spaces to local space and assign the pivot bone as the target.


Options

If you click on Options you will get a small popup with one setting.

If you have Only location selected the rotation of the bone that the script is assigned to isn’t affected by the script.

Normally you want the location and rotation both to be affected, but I thought it might be nice to have the option.

I didn’t add an Only rotation option because then it would just be a copy rotation constraint, and we already have one of those.


Animating with the pivot setup

The idea is that now you have your pivot bone, you don’t need to animate/rotate/move your foot bone anymore. All you use is the pivot bone, and/or the parent(s) of the foot/pivot bones.

For a step simpy think like this… move the location bone (the parent) to where the ground is, then move the pivot to the point the foot rotates around… then rotate the pivot to the angle you need… voila.

If you’re not carefull you can make some really strange things happen, but I purposely left everything simple (script wise). This way it’s up to you to make it usefull ;)


That’s all

It can be a bit tricky to get the hang of this functionality, but I’m sure it’ll prove usefull to some.

enjoy
Dolf

Normal smooth

Wednesday, March 17th, 2010

Downloadable Files

This script is an alternative to the mesh smooth function in blender. The mesh smooth function in blender uses only vertex position.This script uses vertex normals, which is why it’s called normal smoothing.In version 6 the code has been cleaned (versions 2, 3, and 4 were never released). The script now no longer needs you to have part of the mesh selected, and part unselected. So you can run it on an entire mesh, but it still works best for a few edge loops/verts. I also solved the cases in which it made ‘flat surfaces’ “wavy”. You may need more iterations than in older versions.


Requirements

This script is written for blender 2.45 but should work with older versions as well


Example meshes the script was used on (parts of them)


Comparison

Before we get going…. Here is a comparison between blender’s internal function and the script.


Settings

There is only one setting which shows up in a popup when you run the script.

The number of iterations is the total ammount of times the script will run one after the other… normally a value of one or two is enough.


Usage

Select the verticles you want smoothed and run the script.

Pre script example:

Post script example:


That’s it

That’s all for now… I hope someone can help solve the large area issue… untill then it’s already quite usefull to me ;)
Dolf

Ma Self

Wednesday, March 17th, 2010

Downloadable Files

This script creates vertex colours based on the angle between the vertex’s normal and the edges connected to it.

It is written as a faster alternative to the Ma Baker script.

It is also a lot like Campbell Barton‘s Self shadow script.

Hence the name.

The big difference is that this script has no settings, and thus should be really fast.


Requirements

This script is written for blender 2.42


Running the script

There are no settings for this script and there is no interface! It is written to be quick and simple. If you have no mesh selected it will give an error message. Loose verts and edges will be ignored!


A nice comparison between the three scripts

The times it takes for the math part to run in the scripts on the suzanne model on my system (1ghz amd 768MB ram):

  • MaBaker: 0.5991s
  • SelfShadow: 0.1182s
  • MaSelf: 0.0944s

That’s all

Enjoy
Dolf

Ma Baker

Wednesday, March 17th, 2010

Downloadable Files

This script bakes vertex colours into your mesh depending on the angle of the edges of the mesh.

Based on an idea by endi

Optimised by tedi


Requirements

The script is written for use with blender 2.41 but should work with newer and older versions as well.


The interface


The header

Here you can see what version of the script you are currently using


Messages

Here helpfull messages will be printed. It will tell you if the bake was succesfull and if not what went wrong.


The settings

Here are all the functions of the script. The following options are available.

  • invert shading
    In regular mode the concave parts of the mesh are made dark and the convex parts of the mesh are made light. By selecting inverted shading mode the reverse will happen.
  • invert wind
    When wind is created basicly the faces facing the direction of the wind are made lighter.
  • wind direction
    Here you can set where the wind should come from. The direction is set relative to the global coordinates, not local.
  • concave
    When selected concave parts of the mesh are coloured. From the dictionary: Concave: hollowed or rounded inward like the inside of a bowl.
  • convex
    When selected convex parts of the mesh are coloured. From the dictionary: Convex: curved or rounded like the outside of a sphere or circle.
  • wind
    When selected the mesh is coloured relative to the wind direction.
  • min angle
    Edges with an angle below this value will be assigned the default colour value.
  • max angle
    Edges with an angle above this value will be assigned the maximum colour value.
  • BAKE
    When pressed this button starts the bake.
  • EXIT
    When pressed this button exits the script. Alternatively you can use the escape button on your keyboard.

Tips

If you find this script is too slow for you try the Ma Self script.

For the bake effect to show up in your 3d window you’ll have to view your model in “textured view mode” (Alt + Z). For the bake effect to influense your render you will have to assign a material to your model with VCol Light in the material buttons switched on.


Exporting the result

This based on a tip from patricks. Follow the following instructions

. Assign a uv layout to your object (unwrap it).

2. Open a script window.

3. Run the “texture baker” script you can find in the scripts menu under “UV”. This will export an image but not with the colors. The script will create an object and camera on layer 20.

4. Go to layer 20 (right bottom in the layer selection of your 3d window).

5. select the camera you can find there.

6. Hit CTRL + Numpad 0 to make this your current camera.

7. Set your rendersize to something square.

8. Render it!


Examples


That’s it

Enjoy!
Dolf

click here to close

Help keep these files free,
and support further development!