I need a Death Certificate

I’ve come to the conclusion (sniff) that my idea is dead. What I wanted to do was this: create copies of an object on-the-fly, as an animation is rendered, but only where the camera was looking, dependent upon an emittor mesh. This would allow you to have (for example) an entire landscape of trees or rocks or whatever, but the meshes for those instance objects would be generated only where they would be visible to the camera, saving you tons of rendering time and vertices, etc.

The problem seems to be that there is no way to actually assign a material to a Python-created mesh object. You can assign material indices to a new mesh, but I can find no way, either in the current API or in the Blender210 API to do this. I am sad. The rest of the thing is done and works beautifully. Everything works, but there are no materials.

I am sad. Can anyone who knows more than I (probably most of you) give this project an official Death Certificate? Or am I wrong?

P.S. If this idea really IS dead, at least I can have a wake party this weekend!

I don’t know too much about Python yet. Actually, this dissapoints me too because I’m trying to modify a hair script so that the hair is not gray all the time.

I do know that when they made Shrek they used shader to paint the trees, grass, and fur on during render. Maybe if you looked into a plugin with C perhaps.

I don’t know C yet, but give me a month and I’ll try and write some shaders or something. Let me know how it goes.

It is not very useful because you can create a few objets (mesh, lamp,… see this page for an an example: http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_b223new.htm ) on- the-fly, but you can’t delete them after. There are better ways to do this with anim effects using “scenes” for instance.

Look at this script: http://www.geocities.com/blenderdungeon/lsystem/index.html

jm

You can (sort of) assign materials by doing something like:


mesh.mats[0] = materialname

But the problem is that it won’t work the first time you do that, only after you deleted it and then run it again, does it show up…
So it won’t work for new meshes.
You can see an example of that in the script from the fur blendfile for instance.

However, in Publisher it is possible to do it using the setMaterials() functions, but I guess that won’t help you much…

Crap crap crap. Oh well. I guess deleting an object is too much to ask. Hmm. Thinking about an alternate approach. Maybe a bank of 1000 premade objects, referenced by name, to be moved into place where they’re needed. Hey. That’d work. Cool. I’ll start tonight.

Thanks. The create-on-the-fly project is dead, but it’s mutant brother may yet survive.

Hello Harkyman

I strugled with the sameproblem a while ago while writing the forester2blend script. To see the solution see this webpage:
http://users.skynet.be/sky33676/Ter2BlendTutorial5.html

It is not very elegant but it works!

I hope this will help you

Succes

Guy