This Java tool helps preparing a basic structure of POV-Ray files and a batch script, which will allow to bake lightmaps from a POV-Ray scene. The scene, at least the part of it to be baked, has to be composed out of uv-mapped meshes, and converted to POV-Ray format using Poseray.
At first, this was going to be just a little tutorial illustrating a method I developed to generate lightmaps with POV-Ray, using the new
mesh_camera feature in the latest version. I started by doing all the work manually, but as it was rather tedious with more than a few meshes, I created a PHP_CLI script which automated the process by creating the needed include files and a batch script.
I used PHP just because I'm accustomed to use it to write this kind of file I/O scripts, but it seemed an odd choice for a multiplatform distribution. After a little quest, I decided my best option was to use Java instead. A friend recommended Netbeans, so I installed it and started development... it seemed so easy to learn, that I decided to move the app from the command-line to a simple GUI, and in the process I've made it a bit more complete and practical (though there is still plenty of room to refine and enhance, or even redesign this tool).
A lightmap is an image which captures the effect of the lighting on the surface of a 3D object. The technique usually known as lightmap baking, consists on rendering images of the uv maps with a plain white texture, so the resulting maps can be used back to texture the meshes (this is done usually by just multipliying the lightmaps and the final pigments), making the light sources no longer necessary.
The more obvious applications are virtual reality and games, but it could be useful also just to make faster POV-Ray animations, or to render in minutes multiple views of a scene, or the same shot with different textures, etc...
The main drawback is that we lose color bleeding in radiosity, as the pigments are all white (tough the same procedure can be used to bake textured maps, just by using POV-Ray textures instead plain white pigments). Also, only the meshes on the scene can be baked, but other primitives can be used if they are going to be self-lighted or not visible.
The process I used assumes that our main purpose is to use POV-Ray as a radiosity-baking engine for externally modelled scenes, converted to POV-Ray format with Poseray. It will go as follows:
I explained these steps with more detail on the include README, so just go and download the archive.
Please, let me know any problems, comments or suggestions... they are always welcome.
If you develop an alternative baking method, specially if it's a more user-friendly solution, please let me know, so I can put a link here.