Introduction to Wooscripter

30/08/2014 – Updated for Wooscript 2.1

The time has finally come for me to open wooscripter up as a general download! I’ve got the sourcecode on github, if you’d like to have a look, and the installer is available here.

So in case you missed it, what is this wooscripter application? In a nutshell, Wooscripter allows you to build 3d objects and then raytrace them. The objects are built using a script called Wooscript, and they are raytraced using a system called the Wootracer. There is a theme to the naming….

So download the app, and lets got in with introducing some of the key features. If you have any feedback please put it in the comments on this article until I get a proper feedback method setup!

Basic Wooscript

Let’s start with some basic Wooscript. Wooscript is a simple language designed to make it easy to build 3d shapes using a few commands. To build shapes you modify the state (colour, position, etc.) and then place primitives (cube, sphere, etc.). This doesn’t sound like much, but coupled with the ability to call rules from within other rules, this allows you to build very complex 3d shapes.

The Wooscripter application loads up with an initial simple screen. On the left is a preview window which allows you to navigate around the scene. Click on the picture, and then use arrow keys to move around. You can also hold down the button on the mouse and move it around to adjust the direction the camera is pointing in. This should make it easy to setup the view of your objects.

On the right hand side are the scripting tabs. There are three tabs, backround, scene and lighting. The idea is that primary objects go into the scene script. The background should go into the background tab. The lighting environment should go into the lighting tab. For now we’ll use the default background and lighting while modifying the script in the Scene tab.

Wooscripter main window

Wooscripter main window

When you’re ready to do a final render click the “Final Render” button on the left hand side and this will open up the next major window.

The Final Render Window

The Final Render Window

There are a number of options here that allow you to adjust the quality of the renders produced. There are full articles on these different types of rendering on the site. For now adjust the resolution of the render and then click start. When you’re happy with the quality of the rendering click the Stop button. On slower PCs this screen can be a little slow to respond. Adjust the exposure or linear ramp settings until the image looks correct for you. Now click save to store the image on your harddrive.

final render window completed

The Final Render window with a render completed

Rules

All scripts are built around rules, and every rule has to have a starting rule called main. To create this first rule we’ll type the following into the Scene tab on the right of the application window.

rule main
{

}

Primitives

As of writing, Wooscript supports the following primitives; sphere, box, circle, cylinder and spherelight. To create a primitive you need to call a rule which adds one to the scene. Helpfully these intrinsic rules all have the same name as the primitive, so to add a box to the scene you do this…

rule main
{
box
}
A simple 3d script

A simple cube

State – position

To do anything more than add an object at the start position, you need to adjust the state of the scripting language. The most important state that you can change is the position. This allows you to build additional primitives into your object. This simple script will add a second cube above the first cube.

rule main
{
box
pos.y += 1.5
box
}
Two cubes

Two cubes

Colour

Another simple state that can be changed is the colour of an object. The basic diffuse colour is adjusted using the state “diff”. Let’s adjust the script to place three boxes next to each other, one red, one green and one blue.

rule main
{
// red box
diff = vec(1, 0, 0)
box
pos.x += 1.2

// green box
diff = vec(0, 1, 0)
box
pos.x += 1.2

// blue box
diff = vec(0, 0, 1)
box
}
rgb cubes

Three cubes, each with a different diffuse colour

The repeat function

Once you start to build objects with lots of cubes you’ll get bored of calling the box rule lots of times. Lets modify the script so that it adds a line of cubes moving diagonally upwards. To do this we need to add the box and modify the position in a simple rule, and then call this rule a number of times using the “repeat” command. We can change the diff state too so that the colour changes going along the chain.

rule main
{
diff = vec(1, 0.5, 0)
repeat(10) { addbox }
}

rule addbox
{
box
pos += vec(0.7, 0.7, 0.7)
diff *= vec(0.9, 0.9, 0.9)
}
chain of boxes

Chain of boxes

State – Rotation

The next thing that we need to do to make interesting objects is to modify the rotation as we go along. Rotation not only changes the orientation of the objects being added to the scene, but it also changes the way modifications to the pos state occur. For example, lets change the script to add a line of boxes along the ground (pos.x += 1), and now we’ll rotate around the y axis by 10 degrees after adding each box.

rule main
{
diff = vec(1, 0.5, 0)
repeat(10) { addbox }
}

rule addbox
{
box
pos += vec(1, 0, 0)
ry += 10
diff *= vec(0.9, 0.9, 0.9)
}
Rotated curve of cubes

Line of cubes with rotation added each increment

State – Scale

We can also modify the scale of the objects as we add them, and this also adjusts the position increments that occur within a script. Lets tweak the earlier example to add the cubes with a scaling factor too.

rule main
{
diff = vec(1, 0.5, 0)
repeat(10) { addbox }
}

rule addbox
{
box
pos += vec(1, 0, 0)
scale *= vec(0.9, 0.9, 0.9)
ry += 10
diff *= vec(0.9, 0.9, 0.9)
}
Cubes curve

Scaled curve of cubes

So that’s about it for your quick introduction to the Wooscripter application. There are lots more ideas on this site that you can use as inspiration for building your own 3d objects. Please feel free to share these on the facebook page or the g+ page, and get in touch if you’d like to help me develop the product further.

You may also like...

3 Responses

  1. Vladimir says:

    This is a disaster! I do not have the program works!
    I really want to work in the program.
    Windows 7×64
    When you run the error and gives a black screen.
    How to fix it?
    http://i65.fastpic.ru/big/2015/0409/6d/4f857f606dfe3d3c35d2ee160c90d96d.jpg
    http://i66.fastpic.ru/big/2015/0409/a7/4b385aeacae2493a462f0d0f15bc8ba7.jpg
    http://i68.fastpic.ru/big/2015/0409/1f/da220fcf0bb7e1ff1963781520b1601f.jpg

  2. Vladimir says:

    Does not work:

    scale = vec(1.0, 2.0, 1.0)

    This is how:

    scale = vec(1, 2, 1)

    Why is this happening and how to fix it?
    Sincerely, Vladimir.

  3. Dom Penfold says:

    This should now be resolved. The latest version of Wooscripter now uses CultureInvariant number conversions. Please let me know if you’re still experiencing this problem!

Leave a Reply

Your email address will not be published. Required fields are marked *

Spam Protection *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>