Archive for February, 2009

22
Feb
09

Game in Javascript

memo

A year ago or later I was learning Javascript, PHP and a little about AJAX. I created many simple Javascript codes, but at the time I thought they were too naive. But I also remembered that I’ve written a simple memorization game, like those that came with windows 95, or something like that.

It is still simple, but I liked to play a little with it, so I decided to add it to my homepage. It is in portuguese, but the gameplay is very easy and so playable by anyone. It can be accessed from: http://www.students.ic.unicamp.br/~ra036668/projetos/jogo_memoria/

21
Feb
09

Modeling trees

I read a post in Allan Brito blog about modeling tress and how 3dmax has a plugin to generate trees models [1]. I researched web a little about the subject and found Arbaro [2], a tree generator written in java which exports models in pov ray format (.pov) and wavefront (.obj). Fortunately blender reads .obj format and I could import the trees. The sofware has a lot of examples and parameters to play with, but I didn’t spend much time on it.

tree

You can download it in any SO with compatible java version. The only problem I had was due to the outdated manual, which tells to type:

java -jar arbaros_gui.jar

For graphical interface and:

java -jar arbaro.jar -p pov/quaking_aspen.pov -o \
pov/quaking_aspen.inc trees/quaking_aspen.xml

for command-line execution. But the actual filenames are arbaros.jar instead of arbaros_gui.jar and arbaros_cmd.jar instead of arbaros.jar.

Reference:
[1] Criando uma árvore com subdivisão no blender 3d (pt)
[2] Arbaro – tree generation for povray

21
Feb
09

Broken PC

Tonight my computer died. I think the source have overheated and the computer stopped working. I’m so lucky, to have my pc broken in the beginning of “carnaval” (a holiday week)… I’m not sure when I’ll have it back. I’ve stored there all my models in blender and every other files I was working with.

Well, I had backup copies in my pen drive, but guess what: I just bought a new pen drive and was transferring the data from the old pen drive to the new one. I had only time to move from my old pen drive to a temporary folder in my pc. (Lesson: just remove a safe copy after you are sure the transfer was done).

To complete, I also can’t access my university account through ssh due to server maintenance. Funny how bad things usually happen almost in the same time.

I’ve reactivated my old computer, but everything is in a mess. I have at least four copies of linux installed here and also windows 98. Tomorrow I’ll try to get a new source and maybe install latest kubuntu.

19
Feb
09

Texture Mapping

After a while I’ve finally returned to my Blender studies. I’ve been busy with academic stuff, but I now remade my schedule and now I have more time for my hobbies.

Texture mapping is a nice way to apply textures to complex objects (like human head). The idea is to turn the surface of the object planar and then apply an image as texture.

I followed a simple tutorial and made an even simpler object to test what I’ve learned.

tex

I created a simple texture image in Gimp from a random image if found on web.

texture

Reference:
[1] UV Mapping and Texturing
[2] UV Unwrapping

04
Feb
09

Python Learning

I’ve been busy the last three days practicing python. My primary interest in python was to be able to code for blender. I was told it was the best way to enter blender’s developers world.

After reading some tutorials on web, I decided to start programming. My first attempt was to use SPOJ [1] to practice, since most of the problems avaiable there may be submited in any language. The main difficult in training there is that problems generally have limited time to execute. I know there’s a way to optmize python execution, but I thought I needed to start low.

euler

I don’t know how I’ve found this site: http://projecteuler.net/, but I discovered it was very suitable for my purposes. First of all, you can program in any language (or none at all), since you just need to send the answer, not the program. Secondly, for the same reason, time is not mandatory, even if it takes python three times more than C to run, I won’t bother to wait that much.

Another advantage to use python to solve the problems in that site is that python have many third-party libraries that are much easier to include than in C/C++. By the way, I found it very useful the scypy library. Also, in python you don’t have to declare variables and define their types and python has a built-in support for arbitrary precision integers. This combination makes a problem like “Find the sum of the digits of 35^100″, a trivial task.

Python data structures are also very very good. The new great concept python introduces is Lists [2]. This is a very intuitive way to manage data. I’ve also used some structures common to C++ STL, like sets [3]. The recently released python 2.6 provides a new data structure: Fractions, which implements rational numbers.

I’ve been coding python under windows using Netbeans IDE 6.5 which now supports python development. I have nothing to complain about this tool.

Python is a great language and I think it’s fun to program. The most part of what I’ve learned comes from the references below. But I think that it’s not enough to read all python materials and tutorials: practice is essencial! I hope that describing my first steps in learning python I may help anyone willing to do the same.

References:
[1] Sphere Online Judge
[2] An Introduction to Python Lists
[3] sets — Unordered collections of unique elements
[4] The Python Tutorial