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 method

Wednesday, March 17th, 2010

On this post I’ll try to explain how the method for the Normal Smooth script works.


Concept

The idea is to reposition verticles so your mesh ends up nice and smooth. Of course there is already a function in Blender that does it, but that doesn’t take the actual “surface” of the mesh into account. So say you have a part of a perfect sphere selected, and you run the current internal function, it would flatten that selection, or even make it concave (hollow). That’s what we don’t want. In stead if you try to smooth a perfect sphere, it should not change anything. You can’t get smoother than a sphere!

See below here… that’s not nicely smoothed!


Smoothing the normal way

I’ll explain the concept in 2D. Lets say we want to smooth the position of vertex A and it’s connected to vertex B and C. Then we get the vertex normals for B and C. We then rotate those normal vectors 90 degrees towards A and make them half the length of the distance between that specific vert (B or C) and A. Once we have those, we find the points at the ends of those two vectors and place vert A at the midpoint between them.

But let me explain with a picture, which should help.


That’s just the basics

Of course there is a lot more that you can do with a script. Like looking further along the surface and using more normals. Also in 3d at times you have quads and you need to figure out what you want to do with the vert at the far end of the quad. Having non manifold meshes can be tricky too.

At least I hope this explains the idea a bit, and as ideas go…. it’s not too bad

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

Inset

Wednesday, March 17th, 2010

Downloadable Files

This script Insets a selection of faces in your mesh.


Requirements

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


Settings

There is only one setting for the script and it will appear as a popup in your script window. The value is in blender units.

You want to make sure that the length in this is shorter than the shortest edge of your selection!!!


Usage

Select one or more (but not all) faces in your mesh, then run the script.

Pre Inset example

Post inset example:


Known issues

The script does not like poles!

It also doesn’t like Kinks


That’s it

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

enjoy!
Dolf

Finding mesh angles

Wednesday, March 17th, 2010

Here I’ll try to explain a method for finding out the angle of a mesh at a specific point/edge in python.

This method can for instance be used to create effects like with the ma baker or ma self scripts;


Finding the angle between two faces in Blender

Now this isn’t really complicated.

Lets say you retrieve two faces from Blender’s python API that are connected by an edge.

Lets call them face1 and face2 and face1.no retrieves the face normal of face1.

Then we can simply do the following to find the angle:

  1. myAngle = Mathutils.AngleBetweenVecs(face1.no, face2.no)

Display clean python code for copying

myAngle = Mathutils.AngleBetweenVecs(face1.no, face2.no)

The result though is only an angle between 0 and 90 degrees, to find out if that is positive or negative continue reading below.


Finding out whether the angle between two faces is convex or concave

A lot of the time you also want to know whether the angle is concave or convex (positive or negative).

To get that we get the vector from the midpoint of face1 to the midpoint of face2.

The midpoint of a face is retrieved by getting face1.cent.

Then we get the dot product of the face normal of face1 and the vector we just retrieved.

In python that could be:

  1. dotProduct = Mathutils.DotVecs(face1.no, (face2.cent - face1.cent))

Display clean python code for copying

dotProduct = Mathutils.DotVecs(face1.no, (face2.cent - face1.cent))

The resulting dot product will be either positive or negative depending on whether the angle is concave or convex.

Euler filter

Wednesday, March 17th, 2010

Downloadable Files

On this page you can find the Euler Filter script for Blender 3D.

It is meant to clean up Rotation IPO curves recorded with the game engine.


Requirements

This script is written for blender 2.48a


Use of the script

A lot of the time when you record motion in Blender’s game engine you get Curves that ‘Flip’.

This because Blender doesn’t like rotations above 180 or below -180 degrees.

Below here is an example of what a recorded curve may look like.

And here the result of a cleaned IPO curve


That’s basicly all there’s to it. It looks like the script does the job… enjoy!

Dolf

click here to close

Help keep these files free,
and support further development!