I am a web developer. I am looking for a solution for a clients’ site and was wondering if this can be done with blender3d.
Basically, the site is for a building materials manufacturer and they have a stock of over 50 types of bricks. What they want to do is for a visitor to their site to be able to select a house type, select a brick type and colour, and then see a realistic-looking image of the house rendered with these bricks.
If done statically, it would mean producing over 1000 renders in total, there are different models, over 50 bricks and nearly 40 different colours, so dynamic rendering would be better.
I was thinking that I can pass variables to blender, then blender could load the appropriate house.blend file, change the material/texture for the brickwork, output a render and then return the output image to the web browser.
Is this possible with blender/python or would another solution be better?
I’m not a python guru, but I don’t believe you can pass command line variables to a python script within Blender. Alternatively, you have your system write a config file with a pre-specified name which the startup script (scene-linked onLoad script) in the blend file would read to get it’s settings for that particular render. Other than that, yes - you can change material property links from python, and you can direct the output from the command line.
I don’t think that Blender itself could generate an http stream for sending the image directly to the clients browser. You’ll have to write an overall control script (php or whatever) that handles all of these things, with Blender being justmenuog in the wheel.
This calls for a real FAT server. Allthough blender is rather fast, I takes a lot of processorpower to create a picture. If you still want to do it this way (which btw. is a very cooooool way! you should check the following points:
create a python-script which gets the configuration-parameters from one file. Be aware, that you have to think about some file-locking, or two people, who happen to ask at the same time will overwrite each other.
Create the blend file in a way, that you just have to call blender with blender -b file.blend -f 1 to create the picture. Again beware. As long as one user is creating a file, other users have to wait! Otherwise files will be overwritten, as you are not able to change the filename on startup of blender.
Maybe, create a cache. Meaning, if an image was created once, just save the picture to the server. Subsequent calls of this picture (with this parameters) don’t have to be rerendered and don’t hit the server. Harddiskspace nowerdays is really cheap. Faster Server not.
If you are this far, just create a script to create all of the pictures one by one, save them to disk and output them static. Will save you some headaches about locking, timeouts, not removed lockfiles, serverbreakdowns…
could this not be done within the “game” engine?
just swapping out textures and models and colors seems possible to me, although I’m not an authority on this.
on the up side the client could see an interactive view of the structure.
Im not sure if the textures could be called from outisde of the web plugin so that the size would not be unreasonable.
perhaps someone with experience could address this
I would think povray would be easier. Povray takes an ascii file and spits out an image. If your server is a linux machine, povray has great command line options. For example, perl can write a user’s input from the webpage to a file. Then have perl generate a povray ascii file, and render. Your colors are just strings, the house is hard coded into perl as strings that povray can read.
I think a “game” served up by the web plugin would be perfect. You would have to do some mouse scripting in order to make it interactive for you online customer. But the customer could move around the house and if you made the model/mesh the correct way move inside the house. The only problem you would have would the person would have to be computer savvy enough to know how to download and install the plugin. Thats not a big deal, but from teaching basic computer usage for the last 5 years I am not surprised by anything anymore. “Right mouse click. Right mouse click. No you OTHER RIGHT”