Phil: "Can we create a city and move a camera on it?" me: "yes, I can generate random buildings in random positions" Phil: "no, we need a main street with specified buildings of given dimensions and style..." me: "ok, let me think about it" I'm working as Software Engineer in a visual effects company in London, Jellyfish Pictures Ltd.. In a small company this means coding stuff for anything using any kind of language from object-oriented to scripted. Actually my first task in Jellyfish is to create a very cool and pretty useful asset-management. By the way, when something different, something interesting tickles me, I dip myself into coding, to find cool and smart solutions to any kind of problems. So, when they told me to create something capable of creating buildings and place them in a 3d world as fast and easy as possible, my brain began to work! The best way to make a city creation easy is to draw it and leave the buildings creation to the computer, so I needed to create something that can read an image, read some information from it, create the buildings as the image says and put them in a 3d world. It was the first time I developed a tool for Softimage|XSI, so I downloaded the SDK and with the help of my great friend Enea Le Fons I started my fast training on scripting in XSI. I'm not new about the C++ programming, so it was easy for me to apply my knowledge of object-oriented programming (using Visual Studio) to the development of an XSI-plugin. When I completed the Buildings Generator they told me the work was gone, so the company had no need for the plugin anymore. After few days, I decided to continue to develop this plugin, as a self-training. During my period at the university in Rome I was involved into research and development in image analysis for video-based motion capture and I thought to use the same techniques to "find" buildings on an image map. That's how I developed a blobDetection plugin for XSI. At the beginning it was a scripted plugin in JScript, but it was way too slow. So I have translated the code into C++ and it was been better (note: changing the text or the caption of a progress bar at each cycle increases the computation time). Now, with two different plugins, mixing them, I developed a new city generator based on an image analysis to detect the blobs by choosing a color or a luminance to create different buildings according to the blobs' dimension, and place them into a 3D scene using the blobs' position. I release the first beta version of this plugin (with some bugs) to the XSI community to test it, so that I can read your feedback about it and to check whether or not this the right way to create a city. Actually this plugin reads image of 320x240 pixels, with all kind of blob shape, but all the blobs are translated into bounding boxes; so, when you use this plugin, create a base image with rectangles of different colours and dimensions, which will then be used to define the styles and the dimensions for all the buildings in the city. I'm also working on a different kind of "buildings positioning", using your mouse, choosing some building options like balcony, windows dimensions, entrance, and so on, moving a cube and creating a buildings with the cube dimensions, but this is another story. Write you soon. Paolo |
UPDATE - CityGenerator V0.80601 Download What's new: - No more installation steps, just drag&drop citygenerator_interface.js into XSI script editor and run it. Take a look at this video - Create your own units (buildings styles) simply clicking a button, editing geometry and clicking another button (not yet complete) - Screenshots from the new interface: Choose the citygenerator path and save it Choose color to detect and preview Choose building style to assign to the blobs NEW: create your own style Donwload the zip-archive from this link and extract wherever you want. Create a folder named "builder" into your Softimage-users folder to have a path like C:\users\yourusername\Softimage\Softimage-version\builderCopy all the package content into this folder to have a path for the citygenerator_interface script file like this C:\users\yourusername\Softimage\Softimage-version\builder\citygenerator_interface.jsNow, you should have a folder structure like this: C:\users\yourusername\Softimage\Softimage-version\builder\bitmaps C:\users\yourusername\Softimage\Softimage-version\builder\images C:\users\yourusername\Softimage\Softimage-version\builder\maxscripts C:\users\yourusername\Softimage\Softimage-version\builder\objs C:\users\yourusername\Softimage\Softimage-version\builder\scripts C:\users\yourusername\Softimage\Softimage-version\builder\citygenerator_interface.js C:\users\yourusername\Softimage\Softimage-version\builder\readme.txt 1. Open XSI and load the citygenerator_interface.js in a script editor then run it. 2. Choose an image (sample image in IMAGES folder). Note: image should be at 320x240 pixels in BMP format 3. If an elevation map exists, check "with elevation map" checkbox. Note: take a look at the city map example in the images folder 4. Choose the color to track in RGB or LUMINANCE mode 5. Click on PREVIEW to see the generated blobs-detected image 6. change the "min blob size" if you want to remove the smaller blobs 7. choose your "max units" values. A unit is the smaller part of a building (a window or a door, anyway an OBJ), and the "max units" per width and length is the max number of units per 320pixel (width) or 240pixel(height or lenght). It means that if you choose a value of 320 for "max units per width" you have a pixel per unit, so if a blob has a dimension of 100x80, the assigned building has 100units (windows) x 80units (windows) per floor. 8. take a look at the preview in the output box on the right. if it sounds good go to 9 otherwise change the values and click again on the preview button. 9. Choose a building-root name for all the buildings with the detected blobs 10. choose a unit-type Note: 1,2 and 3 are faster then the fourth type, that could be very slow 11. click on creation button and wait... General notes: the interface is very rough, I'm sorry about it, but I'm working on ;) Take a look at this video for more info. |