Notifications
Clear all

[Closed] Assigning materials to 10,000 models quickly?

I’m making a render layer tool that allows property and material overrides to be set for specific models and layers at render time.

I’m in the process now of trying to optimize the speed at which the materials are assigned to the models when the user switches render layers. For smaller scenes, the time is negligable. But for large scenes, it’s quite significant. For 10,000 objects it can take over a minute.

Does anyone know of ways to assign materials much quicker to large numbers of models? Here’s what I’m already doing to optimize speed:

  • Undos are not enabled
  • Screen redraw is not enabled
  • Assign one material to the entire array at once: NodeArray.material=someMaterialReference

In spite of all these optimizations, it’s still taking a minute or more to process 10,000 models.

Thanks in advance.

10 Replies

Select 10000 objects and assign a material through the Material Editor. Stop the time.
You will notice that it still take a significant amount of time to process.

In short, you cannot do it faster than Max can do it – the proble is not necessarily in MAXScript, it is simply a slow operation. You have already done what I think would be doable. If you have your own loop, pop up a progress bar or something and let the user know it might take a while…

I noticed importing from inventor 11.0 assembly files with more than 6000 parts
into Viz.
Appling one material and UVW maps to all grouped models takes awhile.
But I started saving out as 3D AutoCAD DWG file from inventor.
This imports as a 1 solid 3d dwg model with all the parts as elements to be detached if necessary.
Appling materials and UVW maps to the dwg 3d file takes no time all .

A comparison in minutes /sec’s from multiple models import to a single 3d dwg complex model.

4086 objects appling material 1 minute 25 seconds. polygon count 97812
Same size 3d dwg model 3 seconds. polygon count 83496

I hope that this is informative and not OT sense I’m working in Viz 2007.

Greg.

Bobo:

Thanks for the assurance that I’ve done all I can to speed up the process. I like the idea of a progress bar, too.

Greg:

So based on your findings (and some speculation), it would seem that one of the major things that determines how much time it takes to apply materials is NOT the number of polygons being affected, but the number of OBJECTS. I suppose it has something to do with allocating memory for each object’s material, or something.

Thanks all for your time.

A little tip.

When you have progress bars, dont update them every step. Update them every 10 steps or so. The graphical update of the progress bar takes some time too.

/Andreas

You should look at how RPManager handles this problem. It has a custom material that stores all the materials for all layers on the object, and then when you switch layers it just has to change which material is active. That has to be much faster then manually replacing all the materials in the scene.

Which to me, doesn’t sound like a good idea. I’d like to be able to see all my materials for all the layers no matter what layer I’m working on.

So does RPManager just allow for layer material overrides, or does it support specific node overrides too? If it supports both, how can you tell which is what?

Personally, I’d rather have a tool that simply re-assigns the materials and properties everytime you switch a layer (which is good, since that’s the way I’m doing it! ) and then have some kind of nice GUI that shows you an overview of what overrides are set for what layers or nodes.

1 Reply
(@mustan9)
Joined: 2 years ago

Posts: 0

Both.

That is really hard to work with in a production pipeline. When you hide materials like that it gets really confusing. How to you instance materials across many nodes or layers? When you select a node how can you see a list of all the materials assign to it on all layers.

How will your merge the material layer data? Can you use XRef with it? If I export a select node won’t it loose all of it’s layer properties.

Matthew,

Thanks for the honest feedback and crits. This is exactly the kind of critical thinking I need in order to move foward with my project. If you can spare the time, I would like to continue this dialog so I have a better understanding of what are the strengths and weaknesess of my design.

How to you instance materials across many nodes or layers?

Currently, my design allows you to pick a material from the scene or material editor to assign as a layer or node material override… so if you pick the same material for all of them, then they’re all instanced. That seems pretty straight-foward to me… Am I missing something?

When you select a node how can you see a list of all the materials assign to it on all layers.

Currently I have a modeless override floater that lists all the properties that can be overridden, including the material. I also have a modeless dialog that has two lists, one for layers, and upon clicking on a layer, one for the nodes in that layer. When you select a layer and node or nodes, the overrides panel updates to show what properties have overrides, and what they are. If multiple nodes are selected with differing settings, the override panel displays an “inderterminate” state for that property.

So currently to see what materials are a assigned to a specific node on different layers, you have to click on each layer, and then select the node to view the node overrides. So you’re not getting an instant overview of all the materials assigned to the node.

However, making a separate “browser” for this kind of data is really trivial, so I might add that feature.

How will your merge the material layer data?

At this point, I wasn’t planning on making it so you could merge the override data. Is this something that’s critical to a production pipeline? Under what circumstances would that be a necessity?

Can you use XRef with it?

While I haven’t tested it extensively with Xref yet (I’m still in the early stages of development), I don’t see how this would be a problem. The default material would be whatever the Xref brought in with it (unless you reasign it, of course). And then you could set a material override for whatever render layer you specify. Again, am I missing something obvious or misunderstanding your point?

If I export a select node won’t it loose all of it’s layer properties.

It would export with the properties and materials it had at the time of exporting… so if the view is currently set to a render layer (ie the overrides have modified the node’s properties and material assignment), then it would export the model with those settings. But you would only need to be in that mode when you’re rendering the layer. Just make sure you’re not in that mode when exporting.

Thanks for your time on this… I look foward to hearing your feedback.

1 Reply
(@mustan9)
Joined: 2 years ago

Posts: 0

No I don’t think so. That sounds good. The question is work flow, how many clicks of the mouse it takes to change things around, replace materials, or copy layer settings. That’s all. I like having a main material that holds all the layer materials, because I can quickly change things, and see how things are setup on an object.

Currently I have a modeless override floater that lists all the properties that can be overridden, including the material. I also have a modeless dialog that has two lists, one for layers, and upon clicking on a layer, one for the nodes in that layer. When you select a layer and node or nodes, the overrides panel updates to show what properties have overrides, and what they are. If multiple nodes are selected with differing settings, the override panel displays an “inderterminate” state for that property.

There are three critical sets of data to track in layers. 1) the visibility of objects 2) the properties of objects (a material is just a property) 3) the rendering settings for that layer.

I think you’ve covered those areas in how you link data together, but maybe think more about an artists work flow.

So currently to see what materials are a assigned to a specific node on different layers, you have to click on each layer, and then select the node to view the node overrides. So you’re not getting an instant overview of all the materials assigned to the node.

So if I have 50 layers setup, I submit all the layers to the farm to render over night, and come in the morning to find a “sphere” rendered wrong on a given layer. It was because I didn’t search threw all the layers, each node on that layer, and double check it’s material assignment. I’m in trouble trying to explain that to his boss.

However, making a separate “browser” for this kind of data is really trivial, so I might add that feature.

I think it’s critical that the artist is able to have an higher over view of how things are setup.

At this point, I wasn’t planning on making it so you could merge the override data. Is this something that’s critical to a production pipeline? Under what circumstances would that be a necessity?

It depends. Some people merge data, and others XRef it. I on the other hand. Will often setup a character, assign it’s layer properties, and then merge it into a scene many times in order to create duplicates of that character.

You see. Now I have 10 characters, and they’re all rigged and assigned to their render layers.

While I haven’t tested it extensively with Xref yet (I’m still in the early stages of development), I don’t see how this would be a problem. The default material would be whatever the Xref brought in with it (unless you reasign it, of course). And then you could set a material override for whatever render layer you specify. Again, am I missing something obvious or misunderstanding your point?

People often use XRef materials, objects and scenes. When you have a TD who does the shader development, then you often XRef in their materials from another file. If your doing visual effects then objects will often have many different materials to render that are composited together later. But, I think you get what I mean.

It would export with the properties and materials it had at the time of exporting… so if the view is currently set to a render layer (ie the overrides have modified the node’s properties and material assignment), then it would export the model with those settings. But you would only need to be in that mode when you’re rendering the layer. Just make sure you’re not in that mode when exporting.

That’s cool. I was just wondering where you store the layer data. RPManager stores all it’s data in a global cache for the scene file. So if you save a selected object the data doesn’t follow it.

Thanks for your time on this… I look foward to hearing your feedback.

No problem. We NEED MORE layer managers out there for 3D Studio Max. Especially faster ones!

Matthew,

I’ve been so used to working with Max a certain way for years, that sometimes it’s a real eye-opener to hear how others do it… and in many cases better than I’m doing it.

Your comments have inspired to me to take this question to the main Max forum… I’d like to get as much input as I can from as many people as possible. Feel free to repeat your comments there, if you’d like, so others get the benefit.

Again, thanks for your time and input.