At this point, rendering simple 3D objects like planes, cubes, pyramids has been accomplished. Rendering more complex objects like toruses, dices and tea pots has also been performed. I have to admit that I was not completely satisfied with the previous models. Not, that was anything wrong with them; it's only that I borrowed the objects data from other demos.
Motivated by the need to create my own renderings from scratch, I started to read about different 3D Modeling packages. In my search for software, I found Blender. This is the perfect tool for my needs. I am just starting to learn the package and I have been able to create some complex objects in no time.
There was only one more challenge to overcome. Once the object has been created in Blender, how could I extract the data needed for my source code. I searched the net and could not find much information about it. After some frustration, thinking I was not going to able to use this powerful program, I decided to look at some plugins source code and started writing my own plugin.
After a brief history about this plugin, let's get into the technical side of it.
Let's start by downloading the
Blender PS2 Plugin (size 1.3 Kb)
The file name is ps2_export.py
If you installed Blender under Windows, save the plugin file in the following folder:
C:\Documents and Settings\user_name\Application Data\Blender Foundation\Blender\.blender\scripts
If you installed Blender under Linux, it depends where you chose to installed it. In my case, the path is something like this
/home/user_name/blender-2.34/.blender/scripts
That is it!
If you have Blender open, just close it and restart it again.
Note: I have only tested this plugin under Blender 2.34. This is the latest version of Blender as of this writing.
Blender is an open source project, feel free to go and download the latest version from this website
http://www.blender3d.com
Once you have created your 3D model, and you are ready to export the data;
from the main menu select
File -> Export -> PS2 C Arrays (.h)...
In the file save dialog window, type a file name underneath the path name. Type the file name without the extension. The program will append the extension .h to your file. Click the button that says export h.
The header file containing all the object data has been created.
To illustrate the use of this plugin, I have created a demo. I have included a small tutorial about blender and the plugin.
Rendering a monkey