Cover image for post More 3D fun with PHP

More 3D fun with PHP

Kore is again fiddling around with his PEAR package Image_3D... While implementing something new, he rendered the following "Zebra-Pig", which actually resulted from a bug. Anyway, the whole package is cool, and the pig looks quite funny! ;) Go on, Hardkore!


That is a really nice pig! Makes me wonder what "algorithm" an animal uses to get its stripes and patches ;-) Looks totally genuine...

Hallvar Helleseth at 2006-04-03

Maybe this post should be entitled "Bug in PHP Code Creates Abomination!"

Chris D at 2006-04-03

I think "Mutation" is a bit better here. It's not really abominate, or? Anyway, would have been cool to have that for April 1st! ;)

Toby at 2006-04-03

Perhaps I destroy the magic of the picture, but let's explain:

The calculation of the light influencing each polygon uses the normale vector of the polygones.

The normale vector depends on the order of the points defining the polygon (non-clockwise).

The algorithm for subdivision surfaces declares some of the polygones with points in clockwise order, so that the normale vector points to the inner side of the pig, which caused - after some modifications in the enlightenment code - black polygones. ... it was really a bug, but a very nice one. I love this picture ;)

kore at 2006-04-03