Skip to content

Tag Archives: tutorials

How to use Blender’s cartoon renderer

Hello!, and welcome.

In this tutorial, you will learn how to render ANYTHING made with blender in a cartoon style.

I’m going to show you how to apply this effect to a cube first, and after that you should be able to use it for more-or-less any scene.(if you don’t know how to do these things, go to www.blender.nl and check out some of the preliminary tutorials)

Firstly, create a cube, add a light on front of the cube, and position the camera so that it is can see more than one side of the cube. You should end up with something like what i have below (bare in mind that it is being viewed from the camera view).

Now do a quick render, and you should get something which looks vaguely like this:

This is NOT what we want. Here’s what you have to do to fix it:

First, give the cube new material, and select “shadeless” from the material options ase shown below.

Now try render it again, and you will see a 100% white cube. This can’t be what we want? or can it?

The first thing we should do is to give it an outline. To do this, go to the display screen (the one with all the rendering setting on it), and click on the edge button, changing the corresponding settings as shown below (just for your information, the EInt, or Edge Intensity Button sets more-or-less how many lines should be drawn in, and how heavily):

Also, turn the Render Daemon and Unified Renderer on as well.

Now, if you render you will see an outline on the cube, but there is one more thing to do which will make it look like a proper cartoon (albeit an obviously 3d one).

Click on the “Worlds” button (4 to the left of the display button), and add a new one. Alter the world’s settings to match the ones on the picture below (which just sets the background colour to white).

Now change the colour of the cube’s material to pure white, and re-render. You should see something like I have below.

This may not look brilliant, but try it on a more complex model, and change the Edge Intensity(see above for explanation) and you will se what can be done. In the images below, I have simply added a few other shapes, even MetaBalls (which is what Mr. Cinema is made from :) ). The first one has all white textures, the second is coloured.

I hope you like this tutorial. I would gladly write a million more if anyone wanted me to (i.e. e-mail me if you want me to write more tutorials).

Editing the system registry with Delphi

I must say that this is extremely easy to do, and reallly can make any delphi application feel like a “proper” windows application.

Firstly I must point out that all this tutorial does (at the moment) is teach you how to make windows open documents with a certain extension automatically, as well as given them an icon of your choosing. A basic knowledge of Delphi would be a great help for this tutorial, but is NOT NECESSARY. I will point out everything clearly so that any programmer who knows how to edit registry keys in his language and access parameters can use this (i will show you how to do this if you are a delphi programmer).

If you do not know what the system registry is, then think of it as a massive database of information which you can mess around with that windows uses. When you double-click on a file, windows checks the registry to see what application has registered that extension, and open the document within it.

The registry settings you should alter and what you should put in them are given below for all you non delphi programmers(I’ll explain more afters). For the example below i have just created a program called Hoding, which opens all “.hod” files automatically. It is located at c:\hoding.exe (you do need to add some code to your program for handling the autoopen parameters, a simple editing of the registry won’t do (in Delphi anyway)).

Directory or key Data
HKEY_CLASSES_ROOT\.hod\ Hoding.Document
HKEY_CLASSES_ROOT\Hoding.Document\ Hoding Document
HKEY_CLASSES_ROOT\Hoding.Document\shell\open\command\ “C:\Hoding.exe” %1
HKEY_CLASSES_ROOT\Hoding.Document\DefaultIcon\ “C:\Hoding.exe” ,0

If any of the above even looks a little like it makes sense to you, you will have no problem in modifying the code to your own progam’s ends.

Before I get into how to change the registry settings, I want to show you how to handle them. Look at the data held in the HKEY_CLASSES_ROOT\Hoding.Document\shell\open\command\ folder. It says “C:\Hoding.exe” %1 . This means that when a person trys to open one of the file types you have registered, windows just runs your program and attaches the file name onto the end of it as a parameter. Eg. you double click on c:\my documents\testfile.hod after messing with the registry. Windows will run this– “C:\Hoding.exe” “c:\my documents\testfile.hod” –. Basically, all windows does is replace the %1 in the registry data with the document’s file name.

Now I’m going to go into the code needed in delphi to access this parameter. It’s dead simple actually. To acces the 1st parameter, just type paramstr(1) (in case you care, paramstr(0) is the applications directory and filename). If there is none, then it will be blank. Likewise, you can, if you have more, open the second, or third parameter by using the paramstr(x:integer) function. I’ll give you an example piece of code below for handeling the code (I’m just going to load the file into a tmemo, but naturally you should be able to write your own procedure).

procedure TForm1.FormCreate(Sender: TObject);
begin
Memo1.loadfromfile(paramstr(1));
End

Was that tough? I don’t think so. Now on to the editing of the registry…

I’m just going to paste the code I use below, add a few comments, and hope that you will have the cop on to be able to modify it yourself. (also, don’t forget that you have to add “registry” to your uses list at the top)

procedure TMainForm.SetRegistry;
var reg: tregistry;
appfilename:string;
begin
appfilename:=application.ExeName;
reg:=tregistry.create;
reg.rootkey:=HKEY_CLASSES_ROOT;
reg.OpenKey(‘.HOD’,true);
reg.WriteString(”,’Hoding.Document’);
reg.CloseKey;
reg.openkey(‘Hoding.Document’,true);
reg.writestring(”,’Hoding Document’);
reg.CloseKey;
reg.OpenKey(‘Hoding.Document\shell\open\command’,true);
reg.WriteString(”,’”‘+appfilename +’” “%1″ ‘);
reg.CloseKey;
reg.openkey(‘Hoding.Document\DefaultIcon’,true);
reg.writestring(”,appfilename +’,0′);
reg.Destroy;
end;

I would love to add loads of more stuff, but I don’t have enough time right now so you’ll have to figure everything out yourself (not as tutorial like as I would like, but I don’t have the time to make it so). All I will say is that if you use the code above, the document icon will have the same icon as the program. Ideally you should add another icon to the resource file, change the line that says this reg.writestring(”,appfilename +’,0′); to this reg.writestring(”,appfilename +’,1′); and the program will use the second icon istead of the first :).

Have fun making loads of nice registry-integrated apps!

-Stephen Lavelle-