it’s been mentioned a few times on the forum that instancing is the appropriate method for duplicating vray proxies, but i wonder: does “copying” a proxy instead of instancing actually create another version of the proxy in memory at any point when rendering, or otherwise affect performance?
i ask because it’s not uncommon to have a bunch of instanced proxies, then have a few of them split out into a separate file, and then merged back in for whatever reason. the instance link is broken, but the proxies are still referencing the same .vrmesh. having to re-instance these objects would be time consuming.
i would’ve thought it wouldn’t matter since vray would be directed to the same mesh no matter what, but i couldn’t find any posts that said anything other than “always instance.”
If they are not instanced, the same information will be loaded twice and take twice the RAM.
It is possible to write a script to replace proxies pointing to the same .vrmesh files with instances though - I know I wrote this once, but I have to find it.
so presumably this is the same for Xref files as well?
i.e. - two (or more) proxies, all in different Xref scenes, but all pointing to the same proxy file - these can’t be instances so the same proxy will be loaded twice and take up twice the memory?
A script to re-instanciate would certainly help in optimising scenes - this would be very welcome…
*bump*
sorry to bump this, but just wondering if this is indeed correct? If so that script mentioned would be a welcome tool for optimising scenes just before final renders - I’m sure it’s not that hard to write, but I have absolutely no experience in max script myself…
yep it’s an easy one - what you do is decide which object you want to bet the master one - lets say it’s called proxy_01 in your scene for example. You select all the objects you want to be an instance of proxy_01 and in your listener you type:
$.baseobject = $proxy_01
And hit return - done. What it’ll do is swap one object with another and instance them - it’ll keep the scale, position and rotation of the original. You can use this to quickly replace one object with another too but if there’s differences in size in the two original objects at 100% scale you’ll get a change in sizes. For example if you’ve got a hedgerow or a forest and you swap one bush or tree for another, you may get gaps or overlaps if one tree is bigger or smaller than another when swapped. Thankfully every tree will be affected the same way so select em all and do a local pivot scale to adjust.
Here is my original script; save it somewhere and choose MAXScript > Run. Then you will get a new MacroScript called “VRayProxy instance” that you can drag to a toolbar.
When you execute the script, it will find all proxies that reference the same .vrmesh file and will make them instances.
Thank you, this just saved me a day of work on a massive scene i am working on right now.
The instancing of the trees was broken because i had to merge several times.
The script worked flawless,
memory usage is way down now.
this may be a bit off topic, but if i have a lot of instanced proxies and a variety of materials applied to them, will it still only load the proxy once into memory for all of them?.
I have a repeated house model that varies only with regard to the materials so am wondering if it is worth creating an instanced proxy for it
Hello,
I tried to Maxscript/Run this script as you said but nothing happened, nothing executed.
Then I tried Maxscript/Open Script and scipt was open so I made Ctrl+A and tried dragging the script to a toolbar. But I got an error message :
Compile error: nested macroscript definitions are not permitted.
In line: mamacroScript V
I got that script, used it once or twice with no problems.
But now whenever I try to use it I get
“type error: call needs function or class, got: undefined”
And this pops up in maxscript:
macroScript VRayProxyLister category:“VRay” buttontext:“VRayProxy instance check” tooltip:“Check for VRayProxy’s with the same .vrmesh file” (
local res=queryBox “VRayProxy’s with the same .vrmesh file will be converted to instances. Are you sure?” title:“VRayProxy instance check” if res then enumVRayProxies()
With the bolded line highlighted.
I just started with a blank scene, merged a proxy in and copied it around a few times to test it and it’s still doing it.
Any ideas?
Weird that it’d work for a bit then break.
You can try to change the script like thisif (res==true) then enumVRayProxies() however in any case the error means that the queryBox function did not work for some reason. Which version of 3ds Max are you using?