red dwarf script

red dwarf script

this is a no frills script for adding (random) geometry/texture to
meshes to simulate spaceship hulls a la “Red Dwarf”.

Download the .blend file from
a (copyright free) texture is packed


create a mesh
recalculate normals
launch the script


uses mathutils in blender 2.33

This one, a bit more rustic,
seems to give best results.

But the code is not free…

Yes they both extrude along normals but that is not the point.

The geometry added by fil de fer is uniform and not random.

When was the last time you saw a spaceship that was
mathematically symmetric?

2/ The fil de fer code was written before 2.33.

The code for extruding along a normal with mathutils,
for example, is much more succinct and,
at least for a mathematician, more readable.
That’s what python is about non?

hey, this is a good one!

a question - (may I steal some of your code :slight_smile: ? ) - if you’re willing to help, that is - how can I modify your code to do following:

a) affect only faces in z-direction (like a back of a thing or rooftop of a hangar)
b) affect only faces in negative z (like a ceiling of a hangar)
c ) affect only faces that point outside for sides, separately in x and separately in y
d ) affect only faces that point inside in x and y

e ) control the beveling amount of extrusion, depth (displacement) and inner-extrusion amount.

Are you sure ?
The faces are divided but The red dwarf script extrudes nothing on my mesh.

They are extruded.

Resize the mesh in edit mode.
Make it much smaller so that the
normals (which are always unit vectors)
are relatively larger.

Alternatively go in the script and change the

height /= 5


height *= (something)

I said it was no frills.

The point is that with mathutils the code
is very compact and you no longer have to
loop over[i] as of old.

Sure steal the code. That’s what it’s there for.

I’ll post a better .blend file (with a slightly modified script)
when I get to work with bump and emit textures.

I guess that you can do this quite simply by testing in the loop.
It’s not a Vector strangely enough but a list representing one.
All the elements of the list are >=-1 but <=1.
So if you want to pick out a direction then

After the

if len(f.v) >.3: continue


something like

if abs([2]) <.95: continue

to texture only the faces that are (almost) horizontal


if abs([2]) <.1: continue

for those that are (almost) vertical

thanks! I’ll see what can I come up with :slight_smile:

You are a prince among men. Or a princess among women…kind of hard to tell from just a screen name. Take your pick.

I’ve been making ships from some Star Wars stuff, and this is incredible for quickly adding some nice detailing.

One issue I ran into and didn’t spend enough time on figuring out last night: When making a symettrical model with a mirrored instance the mirrored section wanted to place the detailing on the INSIDE of the object. I tried recalculating normals outside, but the issue seemed to remain. I’ll dink with it more tonight, but do you have any suggestions to cut down dinking time?

have you deleted inner edges?

What you mean inner edges?

Vertices stay. Edges stay but might be in new faces.

I put an updated verison of the script here with
more comments an better variable names

I hadn’t really thought about this.
The idea was that you should use this on a finished model or
for throwawy models where you need a lot of detail
to fool the eye but you don’t really care what it looks like.

I guess I’m thinking about the attack on the Death Star
in the first Star Wars. Some guy designed the Death Star
then some team of guys glued polystyrene on any old way
to give the detail. And any old way works.

I guess you duplicate and flip a mesh.
I guess if you join the meshes this and
then recalculate the normals with Nkey
in editmode this should work.

Maybe I should think about a script (with a GUI)
to fix normals/ set normals randomly?


I tried this script on the default cube and here is what I got.
Traceback (most recent call last):
File “”, line 79, in ?
NameError: Material “Grey” not found
Traceback (most recent call last):
File “”, line 79, in ?
NameError: Material “GreyW” not found
So I thought the first error was becasue I had not assigned a material name so I did that then I got the second error.

Mayhaps a bit more detail about how you run the script and what has to be done in advance before you run it.

Edit: Ok foget the last post. I just read the script comments that said you had to include the packed textures included in the blend. Sorry.

wow that model is totally cool. cool script man. [!]