blender export!

February 18th, 2006 by Bramz

It’s been a while since my last update. Two months to be exact. What have I been doing in that time? Not that much … I’ve been struggling with lights … How do lights fit in the grand design of a ray tracer? Are they objects? Are they shaders? Or even something completely different? I’ve settled with the first option: lights are objects. I don’t know if that’s the best decision, but you have to make one to get on, don’t you? Anyway, that’s not the subject of this post. I’ve also been working on a script to export scenes in Blender to a LiAR script.

You can’t continue crafting your scenes in raw Python code forever. One day, you want to use a real modeling program. And what program better suits this need than Blender? First of all, it’s free and open source. But secondly (and perhaps more interesting for LiAR), it has an embedded Python environment. So, we can write our export script in pure Python, which is of course great.

It takes a while to get the hang of their Python API, but once you get the feeling, it’s fairly easy. And so here’s the first result. I’ve managed to export the default scene (the one you get when you start Blender) to a LiAR script, and to actually render it. It’s not exactly spectacular (it’s rather dull even), but it works. A lot of features are still missing, but that’s not so important. The important thing is that the export works. Here it is (model courtesy blender.org =) …

I can’t link to the code, because it’s not in the CVS yet, but when it is commited, you’ll find it in extras/blender_scripts/liar_export.py

default scene of Blender rendered by LiAR isn't a raytracer ...

Comments are closed.