Imaging is a Core of 3D ModelingPosted: December 21, 2011
One of the aspects I really like about Processing is the ease with which you can do things with images.
Here, I am doing the moral equivalent in Banate CAD. Images are setup using the following code:
local b = PImage.new("csg1.png")
local starhead = PImage.new("starhead.png")
local proccer = PImage.new("Processing1.PNG")
Once those image objects are setup, they can then be displayed using the ‘image()’ function. Nothing could be easier I think.
There are a couple of very interesting things that are being gained here. First of all, I am using the “IM” library that incorporates into the Lua language. This little library does many things with images. First, it can read and write many popular, and not so popular formats. Beyond that, it can also read from devices like cameras and whatnot, which is great. And finally, it can also output to many formats.
There are many options available for importing/exporting images. I went with IM because it provides the widest range of features within a single package. Not only can I import these images, but I can perform image processing functions on them as well. This is very useful in cases where I want to take an image, do a blur on it, and then use it as a height map for a 3D model. I don’t have to implement that filter on my own, it’s already a part of the imaging system.
Similarly, when I want to export a movie of my animations in action, I don’t have to code up a whole new set of libraries, on multiple platforms, to perform this. I can just rely on the IM library to do the work for me. I am currently using the IM library in the most rudimentary way, simply getting pixels one at a time, and displaying them as points. But, now that I have the rudimentaries working, being able to fully integrate images as texture maps will drive both the UI and the usage in modeling.
And, it’s almost Christmas!!