[SOLVED] Exactly same object in multiple places

OK, so I want to finally make my terrain in Blender. It will have lots of object that will repeat like hundred times on the terrain like plants, trees and rocks, but will have different scale and position. Of course Shift+D for dublicating is a bad idea, right? It adds more geometry.
What way would you guys suggest to do this? I’m sure there must be a way. Though I just hope I can do the same with egg files :confused:

http://www.youtube.com/watch?v=dw5DxESx_1Q
you can use empty objects in blender and replace them with models in your terrain-loading code. thought there might be another sollution with better preview in blender but i cant really say that for sure.

You can use blender’s DupliGroup functionality and link another blend file to it if the object is in a different blend. Or, you can simply let multiple objects (OB) refer to the same mesh (ME).

There is a better solution:-) The Chicken exporter supports instancing - go read about it in the manual. Basically you can use emptys with dupligroups to make the egg file contain a reference to another egg file that Panda automatically loads, with geometry of course shared between all of the instances. And Blender will display the dupligroup object, so you just make that the same object as is exported to the relevant file and its just like any other level editor. There is an example of this in Chickens testing files, if you want to see it in action.

Edit: RDB beat me to the punch. Just note that the second method he mentioned will not result in instancing in Panda, which would be very inefficient, so I would stick to his first method/what I’m talking about above.

Do you have any idea how Blender actually does this automatically? Would be a nice feature to add to the other exporters as well. Pretty sure neither Max nor Maya can pull that off currently.

Well, yeah - whilst someone else did the original coding I integrated and extended that original code, so I have quite a good idea of how it works;-) Blender effectively has built in support for instancing other objects - DupliGroups as it calls it, so its a simple matter of detecting this in the export script and writing the correct data out to the egg file. I don’t know about Maya and Max, but if they have some kind of similar feature, which seems incredibly likely, then it most certainly can be done. I don’t do those exporters however, so can’t really help with the specifics - the egg file output required is pretty simple though, so it shouldn’t be hard. My understanding is that Max isn’t actively supported, whilst Maya is primarily done by Disney as its in their art pipeline, so unless Disney decides they want this I expect someone from the community would have to spend the time and write and submit a patch.

Thanks for the info, dug around for a bit in Chicken and the egg specs and it’s not terribly complicated like you mentioned. It’s a nice feature in a sense that if you try and export instanced geometry out of Maya (or even Max) the exporters don’t even give you a working egg file as far as I’ve seen. Blender actually does a little work for you to insure you get an egg file you can use.

As for the maya2egg tool, you’re correct. It is a tool mainly used and maintained by Disney. However, I’m on a team here at Carnegie Mellon that is going to fix some of the maya2egg bugs (with input from the Panda community and Disney of course). Max is another tool that CMU maintains (or doesn’t maintain depending on who you talk to), because we use both packages. Since you had some input on the Blender tool at the beginning if you have any advice on tackling the exporters in general I’d greatly appreciate it. Thanks again for the info.

-Andrew

EDIT: sorry misread the original, guess you extended the code, but still your thoughts would be helpful

Thaks everyone.

Thats what I wanted to hear! I was sure Blender has something like that, but thought likely I wouldn’t be able to get that information into egg->engine.
This is pretty cool.

I have read about instancing, but doing it all with code in my case is exhausting.

I’ll try this when I have the time. It looks like Blender can really be used as a level editor (kinda)

lethe means the Chicken manual, I think.

Yeah, I was referring to the Chicken manual:-) You can also see it in action from the file instancing_test.blend, which can be found at http://chicken-export.svn.sourceforge.net/viewvc/chicken-export/trunk/tests/

As for exporter advice I can’t really say much - I’ve never used the other exporters for one thing. But I would think in terms of use cases, and consequentially what a user might want to do for those cases. There are three I think about for Chicken, specifically static geometry, animated characters and level editing. I should probably have a look at gui creation to, on account of treegui using egg files (Well, used to, not sure if it still does.) - see if I can make that work better. Its the level editing that results in all the interesting stuff though - maybe sit down in front of the level editors for some fully featured games and see what they have, and if you can get equivalent features into the exporters. The Unreal engines editor is a good example, and one I often mentally use due to having quite a lot of experience using it. The hard part is always guessing what all the possible use cases are - for instance Chicken has three different ways of inferring the filename to use for instancing, to support as many different users as possible, and I bet that doesn’t cover all possible use cases. Users are always far more varied than you expect!

Hi !

I have problem with instancing (not sure Panda or Chicken side).

I’m trying to export my scene from Blender. 99% of objects are DupliGroups from external .blend library. This is very handy. So for example all plants comes from …/models/plants.blend. It’s exported to …/models/plants.egg containging about 20 groups.
Problem is that chicken uses all that 20 plants for every single node.

<Instance> plantago01 {
  <Transform> {
    <Matrix4> {
      ... numbers...
    }
  }
  <ObjectType> { model }
  <File> { ./../models/plants }
}

My question is how to refer single model from plants.egg, why I can’t make something like this:

<Instance> plantago01 {
  <Transform> {
    <Matrix4> {
      ... numbers...
    }
  }
  <ObjectType> { model }
  <File> { ./../models/plants }
  <Ref> { plantago01 }
}

Do I have to use single plant per file ?

It does have to be a single plant per file I’m afraid - limitation of Panda, as far as I know. You don’t have to break plants.blend into lots of files however (Or redo any already created levels.) - you can export each plant to a separate file and tag each plant in the plant.blend file with the name of the file it has been exported to - Chicken will then get and use that filename. (tag is ‘filename’, don’t put the extension in.)

Works. Thanks !