Jump to content

X-Refs and scene states?


Tommy L
 Share

Recommended Posts

Is it possible (using plugins if necessary) to include X-Ref on/off in scene state? Or something similar?

 

I have a scene which has 12 cameras and each camera needs to render a different condition in the scene. Scene state combined with Batch render gets me most of the way there, but the solution is completely undone if I cant control what XRefs are turned on for which camera.

 

Any help much appreciated,

Tom.

Link to comment
Share on other sites

I did some tests in the past, I got almost the same rendertimes turning off layers or xrefs.

 

Yes, its not rendertime Im worried about. I have high res car models being deconstructed to elements (about 200mb per .max file) and reconstructed. Each is driven by a particle system and carries its own animated material. if they are all in the file (12 of them) then the .max file becomes unmanageable.

Link to comment
Share on other sites

Are you able to set up a container for each car and inherit the container into your scene.

If you use the global object properties overide of each container it will be recognised in the scene states,

so you could switch each one on/off dependant on what camera is rendering.

I get that you'd still need to inherit all the containers in the scene at once but there may be a better way

to handle the data than what an x-ref can provide due to the extra features and functionality of the container.

Edited by Cyberstyle
Link to comment
Share on other sites

I have been thinking about this for the last hour and I think I have a solution that might work...

 

I don't have Max in front of me right now so I am not sure if the standard batch script rendering dialog allows you to load pre-render scripts but I know Sergey's Batch Camera Render does. If the Max default one does not support pre-render scripts, download Sergo's and use it. Just make sure to use the1.9.x version and not the 2.0.

 

The next step would be writing 12 Max Scripts that tell max what xref's to turn on, and which to turn off. Writing the scripts should be fairly simple, and only require monitoring the listener to see what is happening when you enable and disable the Xfref's.

 

To acquire the code you need simply open the Max Script listener and watch what lines it spits out as you turn on and off the Xref's manually. Then just copy and paste the lines that were generated into Notepad, and save it as something that makes sense.. LoadCar01.ms, LoadCar02.ms, LoadCar03.ms...

 

Now assign the Max Scripts you just saved out to the pre-render script roll-out in whatever batch render dialog you are using (Segey's or default.)

 

If all goes well this script will run turning on and off the proper Xref's as the job goes to render.

 

Since I am not at a computer with Max on it so I can't look into this and see if it would actually work, but in my head it makes sense.

Edited by Crazy Homeless Guy
Link to comment
Share on other sites

Thanks Travis, just the kind of answer I was looking for. Ill give it a shot.

I really think batch render and scene state are vastly under-developed tools in Max that have huge benefits on pipeline. I guess because its not node based these are the only tools that offer any kind of procedural render toolset, but it really feels like a workaround when I use them together.

 

I have been thinking about this for the last hour and I think I have a solution that might work...

 

I don't have Max in front of me right now so I am not sure if the standard batch script rendering dialog allows you to load pre-render scripts but I know Sergey's Batch Camera Render does. If the Max default one does not support pre-render scripts, download Sergo's and use it. Just make sure to use the1.9.x version and not the 2.0.

 

The next step would be writing 12 Max Scripts that tell max what xref's to turn on, and which to turn off. Writing the scripts should be fairly simple, and only require monitoring the listener to see what is happening when you enable and disable the Xfref's.

 

To acquire the code you need simply open the Max Script listener and watch what lines it spits out as you turn on and off the Xref's manually. Then just copy and paste the lines that were generated into Notepad, and save it as something that makes sense.. LoadCar01.ms, LoadCar02.ms, LoadCar03.ms...

 

Now assign the Max Scripts you just saved out to the pre-render script roll-out in whatever batch render dialog you are using (Segey's or default.)

 

If all goes well this script will run turning on and off the proper Xref's as the job goes to render.

 

Since I am not at a computer with Max on it so I can't look into this and see if it would actually work, but in my head it makes sense.

Link to comment
Share on other sites

I can use the Preset option in batch to pull a render preset which includes the Pre-Render script function in Scripts panel of the (thats a mouthful) render panel.

Now I just need to write a script. It will be my first. Call me a klutz, but I cant see the maxscript generating in the listener as I make commands (ie, turn off xref)?

Link to comment
Share on other sites

Are you able to set up a container for each car and inherit the container into your scene.

If you use the global object properties overide of each container it will be recognised in the scene states,

so you could switch each one on/off dependant on what camera is rendering.

I get that you'd still need to inherit all the containers in the scene at once but there may be a better way

to handle the data than what an x-ref can provide due to the extra features and functionality of the container.

 

I missed this, thanks for the contribution.

Im using Max 2010. I had a bad experience last time I used containers, frankly, I just didnt get it. This may be an occasion that merits time spent testing containers, but Im just so slammed with work I may just hire a scriptwriter to make a tool that matches Travis's solution.

 

EDIT: Just did some reading on containers. I think its an elegant solution in another job. This one is unwieldy because of the particle systems in each of the XRefs. If I pull all the XReffed files in as inherited containers, its going to be attempting to periodically update 12 particle systems, which will not work.

Edited by Tommy L
Link to comment
Share on other sites

Sounds complex! It it were me I could avoid scene states and simply have 1 camera, 1 lighting setup in each file, then only enable the needed xrefs for each file.

 

I also stumbled over this http://www.scriptspot.com/3ds-max/scripts/tags/xref which if you look into the script you can see xrefs are controlable by scripting to an extent, but sadly it's over my head to offer any real advice.

Link to comment
Share on other sites

Hi Tom,

 

I didn't realize that the MaxScript listner doesn't record the XREF info. I did a bit of tinkering this morning and found somehting that should work.

 

So... I think you can look at the code below and decipher it. Right now it is set up for 3 Xref's, with the first being enabled, and the second 2 being disabled.

 

Just save it to a .ms file, and assign it as a pre-render.

 

x01 = xrefs.getXRefFile 1
x01.disabled = false

x02 = xrefs.getXRefFile 2
x02.disabled = true

x03 = xrefs.getXRefFile 3
x03.disabled = true

 

I am not a big fan of containers. In concept they sound awesome, but my real world experience with them has proven less than ideal. I find them to be uber slow with large files.

Edited by Crazy Homeless Guy
Link to comment
Share on other sites

Thanks CHG! Ill give it a try. I got in touch with Mark Olsen. Here's what he sent me in an email, Im sure he wont mind me sharing:

Hey Tom,

The short answer is this:

 

(xrefs.getXRefFile 1).disabled = false;

 

Where the number 1 is the index of the files listed in the xref dialog.

 

The long answer is attached. Usage:

 

turnOnXRef index:1

-this turns on xref number one and opens a message box if index number 1 does not exist

 

turnOnXRef fileName:"13948.max"

-this looks for the name of the file in the list and turns it on

 

turnOnXRef index:0

- Opens a message dialog telling you which xrefs exist. This is more of a dugging tool for me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...