Notifications
Clear all

[Closed] New Free Script … SM Scene Optimizer

Hi all …

I’d written this script some time back and it should help u when working every heavy scenes with a lot of geometry …

This script should be of good use to animators, lighting artist, environment modellers, shading guys,

Features:

1).Launching the optimizer makes your scene very light (for navigation purpose) in the viewports …
What u see in the viewport is not what will be rendered.

2).After launching optimizer, u can interactively put on or off the optimize effect on selection of objects… using the “OPT ON” and “OPT OFF” buttons.

3).u can also set the level of optimization required on the whole scene or on selection of objects using the vertical slider … taking the slider up means more optimization…

4).The button “Kill Optimizer” will remove all optimizations from the entire scene (or selected objects if your have clicked on the “sel” radio button…

5).“MS ON” and “MS OFF” with “scene” radio selected puts on or off Meshsmooth for all objects in the scene which have a meshsmooth applied … if “sel” radio is activated, the same works on selected objects only

6).When u render the scene, it shows u actual geometry, not optimized stuff…

7).U can use the “launch optimizer” in one session of max, save the scene and use
“kill optimizer” in another session of max

[font=Verdana]8).The button exclude objects is not yet implemented …[/font]

example Usage:

Suppose u r working on a forest shot with tons of geometry in trees, leaves , terrain, stones, etc, and a character running thro a path in the jungle:

if u r an animator , u could click ‘launch optimizer’ to optimize the whole scene,

and then remove optimization on only the character u r animating, and
maybe also the path

if u r lighting/shading the scene, u can keep the whole scene optimized and yet see render

results which are un optimized…

hope it helps someone …
shibu

14 Replies

It seems very nice but i didn’t try it on a big scene.
How about Xrefs ? Does the script handles them ?

And maybe you could implement an option to show/hide the materials which have a big impact on real time display.
In attachement is a nice script from Ken Turner (thanks to him) that do this very well and handles multimaterial.

Any way thanks for your script.

Haven’t tried it yet but great idea! I’ll give it a try

u r welcome, namoi …
it should handle xref objects, but definitely not xref scenes …

and thats a good suggestion about putting on/off the textures …
i think i had written something similar for a different purpose in a separate script … i’ll try to incorporate that one into the optimizer.

i hope to upload a revised version soon…

shibu

Wow – works a treat! Good stuff. What versions does it support?

I have uploaded a new version of Scene Optimizer…
Clicking on “Launch Optimizer” button, now also puts off all textures seen in the viewport…
U can also use this tool to interactively put On or OFF textures of all objects in scene or only for selected objects…

Thank u namoi for your inputs…
shibu

You’re welcome.

But about this feature, i’m trying to upgrade it.
For now, all the scripts i’ve seen only hide/show the textures for the standard mat and the first level of a multimaterial. It could be great it to show/hide the textures for selected objects like the “activate/deactivate all maps” function build in max. Unlikely this function doesn’t seem to be exposed in maxscript and if it was it would be maybe difficult to make it work for only selected objects.

For en example of the limitation of the show/hide script, try to apply a composite mat with a standard mat contening a bitmap texture and assign it to a face of a mesh.
Now assign to another face a multimaterial with a standard mat inside with again a bitmaptexture.
Try to show/hide the mat. You’ll see that only the standrd mat in the multimat shows or hides. The standard mat in the composite mat is ignored. But if you try to “activate all maps” in the view menu, all the textures “magically” appear.

To solve maybe this problem, i found an extension (named fooFunctions (maxR5) and embeded in the Wad-O-MXS-Wads! v1.02 pack) on scriptspot.com that expose some functions to deal with textures and materials:

DeleteUnusedSubMaterials
Takes an object using a multi/SO material, and removes any unused sub-materials.

GetSubMaterials
Get all the submaterials of the passed material.

GetStandardSubMaterials
Get all the standard submaterials of the passed material.

GetObjectMaterials
Get all the materials and submaterials applied to the passed object.

GetObjectStandardMaterials
Get all the standard materials and submaterials applied to the passed object.

GetSubTextures
Get all the subtextures of the passed material or texture.

GetBitmapTextures
Get all the bitmap subtextures of the passed material or texture.

GetUsedMatIDs
Get which material IDs are used in an object.

ReduceSubMaterials
Takes a multi/SO material, and remove any duplicate sub-materials.

If someone else want to put a little time on this, it could be usefull for everyone.


A little more about those extensions. In order to make them work you need the avguard extensions for your max version. In the scriptspot pack, the one for max 7 is missing. I post it here. Put it in the stdplugs directory, and DON’T FORGET to rename it avg_dlx.dlx.
More: one of the function the mzp call doesn’t work on max 7 (maybe 6 too), so you have to decompress the mzp (rename foofunctions.mzp to foofunctions.zip), open the foofunctions.ms and remove the line calling the foofunctions_string.ms (append fileinarray “foofunctions_string.ms”). I don’t think this function as an impact for the material ones. Recompress the mzp and launch it.
Voila

Again me.

I tried to do the “advanced” show/hide scripts. Now it seems to work ok. I just see some strange behavior with composite materials time to times (maybe other, don’t know).

But anyway, this time it’s a lot better. I put the functions in attachement for everybody.
In fact, we don’t need no extensions at all, it’s just a couple of function from John Burnett which were in the extension pack (it explains my misunderstanding).
So in the txt file, you’ll find some functions used by 4 buttons. Two are to hide/show materials from a selection of objects and 2 to show/hide the material located in the current Material Editor Slot.

Hope this help

Hi!

First of all, thanks for this script!
I ‘ve been testing it and i have found that it works pretty fast when optimizing, but it is terrible slow killing the optimizer! Also, i had to re-run the script because an error i get when using the MS OFF button. I think that this should be changed from meshmooth to turbosmooth (or both)
I have been testing this with an scene i´m working on (you can see the wip here: http://www.cgtalk.com/showthread.php?p=2348106#post2348106 to see of what i´m talking about) The problem is that the Optimizer does a good job with the face, skull, body, and in general with big objects, but it does not touch the rings of the chainmail. Why this could be? those are simple torus…

I hope it can help to improve that great script!

Page 1 / 2