SC4 Devotion Forum Archives

SimCity 4 General Discussion and Tutorials => SimCity 4 General Discussion => General Custom Content Discussion => Topic started by: joelyboy911 on July 01, 2009, 12:54:57 AM

Title: Batch Render in GMAX.
Post by: joelyboy911 on July 01, 2009, 12:54:57 AM
I have downloaded the BAT4MAX utilities, and used the features (in GMAX) such as create complex LOD to help my modelling. As I am modelling aircrafts (ATR 42/ATR 72 - see SCAG Creations) there are many different models, as well as other smaller props, that need exporting. However, when I go to the batch export function, I am presented with the usual export screens (each view, night time, NESW etc) but, and this is the crux of the issue, it renders totally white, as if all the texture bitmaps have been deleted or moved. I hope someone can point out what I am doing wrong, or how to fix it.
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 02, 2009, 03:04:51 AM
No-one has any idea?
Title: Re: Batch Render in GMAX.
Post by: Diggis on July 02, 2009, 06:05:46 AM
Sorry joel, I haven't been home to look at this.  As I use Max for the batch rendering I am unsure of how well the GMAX batch rendering works.  I'll also point this to chris for you.
Title: Re: Batch Render in GMAX.
Post by: Chrisadams3997 on July 02, 2009, 06:44:08 AM
Thanks, updated script attached at the bottom.  The problem is that BAT loses the textures as you describe if the active viewport at render time is shaded in wireframe.  I'd actually put in a line of code to prevent this, but looks like I put in one wrong word (oops &ops) that instead of always changing it to 'smooth + highlights'was changing it to 'wireframe'--thus causing the problem everytime.  Sorry about that, but should work now, just download the update and replace the original script file inside your 'Gmax/gamepacks/BAT/scripts' folder.

Chris
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 04, 2009, 10:21:18 PM
Excellent. Thank you very much
Title: Re: Batch Render in GMAX.
Post by: Chrisadams3997 on July 06, 2009, 10:06:26 AM
Well, don't thank me yet, RebaLynn sent me an IM that it's still doing the same thing, but I have figured out why and might have a solution soon.  The maxscript manual gives wrong descriptions for what the commands I was trying to use do exactly:

max wire facet 
-Sets active viewport shading mode to Facets + Highlights 

max wire smooth 
-Sets active viewport shading mode to Wireframe 

The actual effect of each is that they toggle between wireframe and facets+highlights or wireframe and smooth+highlights, respectively.  Therefore, if you're already in smooth+highlights in a scene and use the 'Max wire smooth' command in a script, the scene goes into wireframe, hence our problem.  I'm working on a solution, but I need to do some testing.

Chris

EDIT: Looks like this should work, give it a try, and if you run into any problems, let me know :thumbsup:
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 06, 2009, 12:26:35 PM
It is true that I hadn't gotten a chance to try it yet, but hopefully this one will do the trick.
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 07, 2009, 12:11:49 PM
I am going to test it out now, and see what I get.

Edit: Getting closer, the first view still has no texture, the rest are fine after that. This only happens on the first thing in the batch. I can work around this for now.
Title: Re: Batch Render in GMAX.
Post by: Chrisadams3997 on July 07, 2009, 12:46:25 PM
Interesting... The first file in your batch list you used, if you open it up in Gmax, is it saved with wireframe or smooth turned on in it's active viewport?
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 07, 2009, 01:58:16 PM
Saved with smooth in the active viewport, as all my files are.
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 07, 2009, 09:09:42 PM
After some more testing, anything with a sinle texture seems to work ok, but anything with more than one, the textures do not render.
Title: Re: Batch Render in GMAX.
Post by: Chrisadams3997 on July 08, 2009, 07:01:43 AM
I'd tested with one model (with many textures) and it'd worked, though extensive testing in Gmax just takes too long due to it's render times.  I've only got one computer and I need it available most of the time.  In theory the present version is checking if you're in a wireframe mode before applying the toggle, then toggles it until you're not (in case the first time it goes to another wireframe).  Outside of the script I have tested the code and it seems to work perfectly.  Sometimes inside of a section of code, due to multithreading the code doesn't all play out in the order it's written, which is the only thing I can immediately imagine that could cause different behaivor inside the batch rendering code as opposed to scripting the toggle independent of it.  But, it shouldn't toggle at all for scenes already in smooth.

Just do one thing for me before I go to try additional changes, be certain that you've replaced the original script in the right spot (it should have asked you if you wanted to overwrite the original when you unzipped or moved it there if it is).  Just covering the bases to avoid wild goose chases ;).

I'll also try to run a test tonight while I can spare the computer and see if I can replicate the issue.

Chris
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 08, 2009, 09:08:54 AM
OK, I deleted the script, downloaded a fresh copy. Made sure it was in the right place (it was). Then ran it on 2 items. The first one rendered properly, but the second one had no textures. I was thinking about removing all the other scripts to be sure there are no conflicts, but not sure that is a good idea.
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 09, 2009, 01:04:17 AM
I exported 17 ATR-72s and one dairy farm milking shed overnight, on the latest script and it seemed to work fine for all of them. Though some of the ATRs had unexpected LOD discrepancies, however this is most certainly not related to the batch render function.

So I think the issues have been totally solved.
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 09, 2009, 05:43:53 AM
Any clue why I am still having the same problem then?

Could it be that I have not pre-created the LODs?

Should I switch all views to Smooth when I save?

I am at a loss.
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 09, 2009, 02:13:38 PM
For me it might be that I never use wireframe view. And I did pre-create all the LODs.
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 09, 2009, 04:20:28 PM
I set everything to smooth, and created all the LODS, and still am having problems. Could my version of GMax be the problem?
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 10, 2009, 09:13:16 PM
I have the latest version, which do you use?
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 10, 2009, 11:45:42 PM
I am using version 1.2
Title: Re: Batch Render in GMAX.
Post by: Chrisadams3997 on July 14, 2009, 09:38:04 PM
It's hard to say.  LOD's are most certainly utterly disconnected from this issue.  If all of your files are saved in smooth, it should never be a problem theoretically, with or without the small section of the script in question.  While I wasn't aware of different versions of Gmax floating around (as I said, I never even use it anymore since I've got Max), but if a different version is returning different gw values(don't worry what that means :) ), it could trick my solution.

The last thing I'd try for you Reba is removing the corrective code from the script (it won't ever toggle the wire/smooth mode), you'll just have to be careful that all files you'd like to batch render are saved in smooth.  Personally, I always work with a single viewport, so I know which one is active (the only one!).  If you work with multiple viewports on the screen (such as the default), I'm not sure if Gmax saves which viewport was active when you saved (and therefor loads it with that one active) or not, so to be safe save with all of them in smooth, or do some testing to figure out how it loads.

If you want to try that, I'll post a version with that section stripped down for you tomorrow sometime.  I won't have any internet access from thursday through sunday, so if you don't hear from me after that, you know why ;)

Chris
Title: Re: Batch Render in GMAX.
Post by: Diggis on July 15, 2009, 01:13:58 AM
I don't think the previous versions of GMAX are still available.  As far as I know 1.2 is the only one you can get now.
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 15, 2009, 01:24:36 AM
Rendering my ATR-42s the other day, it seems that one of the angles (I think it was east?) on some of the models rendered with no textures. The other three angles appeared fine. I can't be sure if this was related to batch export, but I thought perhaps it could be. Other than that I would like to say that since it has been fixed, it is the most useful tool ever conceived for the BATting process. Especially for me as a part of the SCAG for making bulk quantities of props. 
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 15, 2009, 05:29:31 AM
When I save, GMax remembers the active viewport, as well as the mode (Smooth). I tried saving them all in smooth, I tried having one viewport in smooth, Everything I can think of, and still it does not have textures from time to time.

I even tried commenting out the lines in the script that check for facet, to no avail. Though I am not 100% sure I did that right. The do-while loop does not seem to have an end line, but I am guessing that is the way the scripting works.

One thing I did not try is to set the configuration to one viewport, I'll give that a shot now, and see what happens.
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 17, 2009, 06:46:26 AM
OK, got it to work.

Set viewport configuration to one pane, and make sure to save it in Smooth. Works fine then.
Title: Re: Batch Render in GMAX.
Post by: Chrisadams3997 on July 22, 2009, 04:10:21 PM
QuoteThe do-while loop does not seem to have an end line, but I am guessing that is the way the scripting works.

MaxScript doesn't use end statements like some other programing languages, once you open loop or if statements, etc., the code block for it is just bounded by parenthesis.

QuoteOK, got it to work.

Set viewport configuration to one pane, and make sure to save it in Smooth. Works fine then.

Cool
Title: Re: Batch Render in GMAX.
Post by: RebaLynnTS on July 22, 2009, 08:24:20 PM
Thank you, it is very handy to be able to render everything while I am sleeping :)
Title: Re: Batch Render in GMAX.
Post by: joelyboy911 on July 22, 2009, 08:46:52 PM
Quote from: RebaLynnTS on July 22, 2009, 08:24:20 PM
Thank you, it is very handy to be able to render everything while I am sleeping :)
True that!
Title: Re: Batch Render in GMAX.
Post by: Diggis on July 23, 2009, 12:10:44 AM
Amen here too!