[Closed] Create/Distribute Thousands of Cubes in 3d Space from Text File
Hey whats up guys, I have an interesting one for you.
So my company does a lot of Crowd Behavior simulations using our own custom engine, which is really simple in terms of visuals…no lighting, shadows, texture effects, etc.
We want to produce a nice marketing piece, but I’d like to fancy up the output by using Max to render a screenshot (not an animation).
So I have my environment model in Max, and I can produce a text file that represents the positions of the crowd in 3d space, directly from our output.
So is it possible, or does a script exist that could create and position objects in Max based off this massive list of 3d positions? (I imagine we could format the list in a number of ways that make it easier for Max to deal with.)
Thanks guys,
Ryan
post some sample text, then we’ll help out.
It’s a very easy script task.
how many objects are we talking about? thousands?
Have you seen this thread?
http://forums.cgsociety.org/showthread.php?f=98&t=748348&highlight=transform+object
stigatle, good point.
I’ll see if I can grab a small sample file. As far as the number, it’s a fully populated NFL stadium, so we’re talking 70,000+…
Kameleon, I looked at that post but at first glance it was way over my head. Let me dig into it a little bit more…
So the simple way to create and position a cube is as follows:
Box lengthsegs:1 widthsegs:1 heightsegs:1 length:5 width:5 height:20 mapcoords:on pos:[0,0,0]
Now, I’m sure our programmers could just insert the positions from each agent and create a massive script, but I’m sure that’s not the optimal way of doing it?
Massive script would work fine but only if all generated objects are unique. If you want the boxes to be instances, you’d have to create them in a loop.
It’s as simple as reading the text file, parsing each coordinate set, and using a loop to create the crowd.
Does your text file also contain rotation information, or only position?
actually you can use a massive script to distribute instances:
obj=Box lengthsegs:1 widthsegs:1 heightsegs:1 length:5 width:5 height:20 mapcoords:on pos:[0,0,0]
instance obj pos:[10,0,0]
instance obj pos:[10,20,0]
instance obj pos:[10,30,30]
delete obj --remove "prototype" box
etc.
Quick and dirty.
Thanks plastic, worked like a charm. (liked the website too, really nice renderings, is that all V-Ray?)
Anyway, so I have the massive (9mb) script and after 40 minutes or so it finally finished creating all the cubes.
The problem now if just with the shear number of objects (71,000), which Max just isn’t handling very well at all.
Even a partial marquee select will crash Max because it runs out of memory.
My plan is too attached the cubes in groups so there’s only a few objects (each one containing thousands of elements.) However, I’m running into the same issue, as that operation causes a memory crash.
Can anyone think of a way to handle this intelligently? My brute froce method is to merge the cubes into several different scenes in groups of 10,000…
Ryan
using a massive script is imo one of the less efficient methods to accomplish something like this. You just need a text file with coordinates and one very small loop.
About attaching, that could be a way to go… what I would do is create 5000 objects, cluster-attach them into one object, continue…(by script, not manually)