Network rendering for Maxigo

Announcements, requests and support regarding the 3DS MAX exporter
Post Reply
14 posts • Page 1 of 1
Sukrim
Posts: 66
Joined: Wed Jan 09, 2008 6:47 am

Network rendering for Maxigo

Post by Sukrim » Thu Apr 10, 2008 3:54 am

Alright, consider this as an alpha release... I'm still open for suggestions and not everything works as expected/wanted.

Since Windows _loves_ to misbehave, better copy your entire Indigo folder to the root of your harddisk (e.g. C:\Indigo_v1.3.3.7) and don't forget to change the path to Indigo.exe in Maxigo!

Simply unzip the contents of the attachment into your "new" Indigo folder (e.g. C:\Indigo_v.1.3.3.7\NetRendering) it contains just my batch script, a freeware utility (ssr.exe) to search+replace text in files via command line and the Source code of that utility.

Here is the Source code of the batch file as well so you don't have to download + "install" the whole package if you just wanted to take a look at the code. I recommend a proper text editor like Notepad++ to view this file, it's much easier if for example comments get colored differently.

Code: Select all

@echo off & setlocal
pushd ..
set IndigoDir=%CD%
set Master=%COMPUTERNAME%

echo Welcome to the net rendering suite for Maxigo!
echo.
echo Please keep a USB stick (or a floppy disk) at hand and fasten your seatbelts,
echo we're going to do some serious network rendering now, cowboy!
echo.
echo ----------------------------------------------------------------------
:sceneselect
echo.
echo Enter the name of a scene file you want to render:
echo (=folder name in .\Exported_From_Max)
set /p Scene=
if exist .\Exported_From_Max\%Scene%\%Scene%.bat goto scenecontinue
:sceneerror
echo Sorry, this doesn't seem to be a valid scene name, please try again!
goto :sceneselect
:scenecontinue
md .\NetRendering\Files\%Scene%
cls
:driveletter
echo Please enter a drive letter that is NOT assigned yet on ANY Slave computer
echo (and will not assigned after you plugged in the stick...)
set /p Drive=
echo.
echo.
:Yesno
echo You selected %Drive%, is that correct? (Y/N)
set /p YesNo=
echo.
if /i %YesNo%==Y goto lettercontinue
if /i %YesNo%==N goto driveletter
echo Now come on, just type Y or N... it isn't that hard!
echo.
goto Yesno
:lettercontinue
cls
echo Alright then, please plug in a USB stick, I'll do some stuff in the meantime...
echo.

rem Network stuff
echo Setting up the network share...
net share IndigoShare=%CD% /unlimited /remark:"Should only be active while rendering..." /cache:no
echo.

rem Change those local paths - UNC Style!
echo Changing paths to nk files in %Scene%-materials.igs if they exist...
popd
start /d%IndigoDir% /wait /b ssr.exe 0 %IndigoDir% \\%Master%\IndigoShare .\Exported_From_Max\%Scene%\%Scene%-materials.igs
pushd ..
echo done
echo.

rem Start me up...
pushd .\NetRendering\Files\%Scene%\
echo Writing Autostart file
echo [AutoRun]>Autorun.inf
echo open=.\NetRenderer\%Scene%\Slave.bat>>Autorun.inf
echo action=Start or stop Indigo Renderer in Slave mode>>Autorun.inf
echo done
echo.
popd

rem Modify initial batch file
echo Writing batch files
pushd Exported_From_Max\%Scene%\
for /F "delims= skip=1" %%a in (%Scene%.bat) do call :Modify "%%a"
:Modify
popd
pushd .\NetRendering\Files\%Scene%\
rem Master batch file
echo @echo off>%Scene%Master.bat
echo cd ../../../ >>%Scene%Master.bat
echo %~1 -n wm>>%Scene%Master.bat
echo exit>>%Scene%Master.bat
rem Slave batch file
echo @echo off>%Scene%Slave.bat
echo if not exist %Drive%: goto Vanilla>>%Scene%Slave.bat
echo taskkill /t /f /im indigo.exe>>%Scene%Slave.bat
echo net use %Drive%: /delete>>%Scene%Slave.bat
echo exit>>%Scene%Slave.bat
echo :Vanilla>>%Scene%Slave.bat
echo net use %Drive%: \\%Master%\IndigoShare /persistent:no /user:Administrator>>%Scene%Slave.bat
echo %Drive%:>>%Scene%Slave.bat
echo %~1 -n s>>%Scene%Slave.bat
echo exit>>%Scene%Slave.bat

popd
popd
echo done
echo.
echo That was fast, huh?
echo.
echo ----------------------------------------------------------------------
echo.
rem Needed to get out of that FOR construction
goto :continue
:continue
echo Now tell me: What letter did Windows assign for that stick you just plugged in? 
set /p USB=
if /i %USB%==C goto wrong
if /i %USB%==B goto wrong
if exist %USB%: goto create
:wrong
echo Well, I don't think a USB stick would be mounted *there*...
echo.
goto askletter
:create
echo.
echo Alright, copying files!
pushd .\Files\%Scene%\
xcopy Autorun.inf %USB%: /y /v
md %USB%:\NetRenderer\%Scene%\
xcopy %Scene%Slave.bat %USB%:\NetRenderer\%Scene%\Slave.bat /y /v /i
echo done!
echo.
echo We're nearly ready!
echo Just remove your stick and off we go!
pause

rem I'm comin' up...
echo Starting Network master...
start /b /wait %Scene%Master.bat
popd
popd
echo.
echo done
cls
rem ... so you better get this party started!
echo Please insert the USB stick now to all your slaves.
echo If autostart is disabled, please run the "Slave.bat" file located at USBletter:\NetRenderer\%Scene%\ manually.
echo.
echo To stop the slaves, simply insert the USB stick again and run the batch file on the stick again.
echo.
echo Happy Rendering!
echo.
pause
exit
What does _NOT_ work right now?
  • Network rendering directly from within Maxigo - it's closed source after all... but I don't think my "batch file"-approach would be very difficult to implement
  • Preview rendering: Don't try this at home... you will have to modify parts of the batch file and I honstly don't see any sense in rendering a preview file over the network outside of Max - it is however possible to do so and would also require only a small hack on Maxigo's side
  • Network rendering without having to stand up... Man, I really tried but psexec.exe just didn't want as I wanted to! If someone is better than me on that issue, PLEASE help me out! That USB-stick thingie is more of a fast solution but surely shouldn't be permanent...
  • On the master computer the network share doesn't get eliminated since the script doesn't know when the master is down... could be a problem depending on your paranoia and on how your network at home is secured. I could maybe fire up another batch instance that just lurks around and checks periodically if indigo.exe is still there.
On Line 86 ("net use ..." on the slave) you maybe have to change the /user:Administrator to a user on your master computer, but generally many people have a user named like that...

Please report any errors (or success) here so I can work on with it - maybe even someone who can code (I can't... no really, batch files are difficult enough for me to handle, and they are just simple scripts...) could take this as an input and write his/her own implementation!

Have fun, take care

Sukrim
Attachments
NetRendering.zip
(86.51 KiB) Downloaded 310 times

User avatar
suvakas
3rd Place Winner
Posts: 2613
Joined: Mon Sep 04, 2006 11:08 pm
Location: Estonia
Contact:

Post by suvakas » Thu Apr 10, 2008 10:00 am

Cool.
I'll try to test it as soon as I can.
Anything I should add to Maxigo?

Sukrim
Posts: 66
Joined: Wed Jan 09, 2008 6:47 am

Post by Sukrim » Thu Apr 10, 2008 11:49 am

Hm, you could give an option inside Maxigo like "Network Render" and then modify the output a bit:

- Create a $ScenenameMaster.bat file that has -n wm as option and gets called by Maxigo like now, so Indigo starts as working Master.
- turn all paths to nk-files (and maybe other files?) into UNC-Paths
- Create an additional $ScenenameSlave.bat file that you can run on remote clients, but it might be a bit frustrating - you cannot execute a program or Batch file (=cmd.exe) from a UNC patch for example... you have to map the remote share to a local driveletter first! :roll:

I guess all settings for that batch file could be set in Maxigo as well, it might be even easier since you have more possibilities (select the location of a USB-Stick for example) within Maxscript.

A simple and fast solution would just be a checkbox inside Maxigo that adds -n wm to your command line. You could then manually set up your network to share the Indigo folder and launch the Slaves manually, they get new work from the master automatically and network rendering would start much faster since you launch it from inside Maxigo. (Especially handy for preview I guess...)

User avatar
suvakas
3rd Place Winner
Posts: 2613
Joined: Mon Sep 04, 2006 11:08 pm
Location: Estonia
Contact:

Post by suvakas » Thu Apr 10, 2008 8:53 pm

Hey Ono, maybe you happen to read this (don't want to start a new thread, cause it's a minor issue)
I just did my first network rendering with Indigo and I noticed one strange thing. When using -n s for slave without specifying the main host, it does an auto search to find the host itself. Now the strange thing for me is, that when it finds a host, then it keeps on looking. Why? Seems like a waste of resources? A host is found already and it uploads frames to the main workstation and etc. No need to keep on looking for another host i think? :roll:
Confusing?

User avatar
filippo
Posts: 658
Joined: Sat Aug 05, 2006 8:46 pm
Location: italia(senigallia-an)
Contact:

Post by filippo » Thu Apr 10, 2008 10:00 pm

Sorry, but I don't understand to do a net render....
how I said to indigo that it's a net render?
filippo
sorry for my poor language
2x Xeon quad core ghz 2.66(8 core)+4g ram+quadro fx
2 x Xeon Quad 5540 (16 core)+16GB ram+ Nvidia GTX 295 1800mb

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Fri Apr 11, 2008 12:21 am

Suv: yes, it is a bit strange,
it's just cause it looks for the server in another thread and it's easier to leave the search going :)

User avatar
suvakas
3rd Place Winner
Posts: 2613
Joined: Mon Sep 04, 2006 11:08 pm
Location: Estonia
Contact:

Post by suvakas » Fri Apr 11, 2008 2:08 am

Gotcha!
Any performance hit because of that?
Would i gain some rendering speed when I manually enter the name of a main workstation?

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Fri Apr 11, 2008 4:00 am

No, there shouldn't be a noticeable performance hit.

Youn
Posts: 18
Joined: Tue Dec 04, 2007 5:00 am

Post by Youn » Fri Apr 11, 2008 5:43 am

what does this batch file do? when would i use it? if suvakas could add the "-n" option to his batch file generator, that would save the only extra step I currently have to go through.

User avatar
suvakas
3rd Place Winner
Posts: 2613
Joined: Mon Sep 04, 2006 11:08 pm
Location: Estonia
Contact:

Post by suvakas » Fri Apr 11, 2008 5:53 am

Yes, I will add the -n option to the next release.

Youn
Posts: 18
Joined: Tue Dec 04, 2007 5:00 am

Post by Youn » Fri Apr 11, 2008 12:14 pm

oh by the way, you CAN use pstools to check and start/restart the slave processes! :)

What I do is pslist all designated slave computers and serach for the word "indigo" and if it'snot found on a pc use psexec to start it. Of course, I had to mess with permisions to get it to work on all the comptuers, and I bet you could automate it somehow, perhaps in a batch file or maxscript.

I'd play around with that more if I were you?

Sukrim
Posts: 66
Joined: Wed Jan 09, 2008 6:47 am

Post by Sukrim » Sat Apr 12, 2008 10:14 am

Jeah, believe me I'm trying!

But I fear psexec + pslist are not exactly the tools that are easy to handle and are quite picky configuration wise.

Of course it would be much easier to just use psexec but this won't work on ??% of computers (it doesn't work on XP Home, it doesn't work if your Admin Account has no PW, it doesn't work if you have simple filesharing enabled, it doesn't work if remote users authenticate themselves as guests, it doesn't work well with network shares, it sometimes wants a portforward in your personal firewall (btw. a pfw is useless if you're behind a router...), it doesn't work if the workstation and the server service aren't running... and so on)

A much more elegant solution would be a way to execute/install Indigo as a service that just runs in the background, you haven't got an image on slaves anyway.

Youn
Posts: 18
Joined: Tue Dec 04, 2007 5:00 am

Post by Youn » Sat Apr 12, 2008 10:41 am

yeah good point, I was just thinking you could turn it into a service using "srvany". I've done this with some other apps I've made and it seems to work well.

Here's some instructions:
http://support.microsoft.com/kb/137890

Sukrim
Posts: 66
Joined: Wed Jan 09, 2008 6:47 am

Post by Sukrim » Sat Apr 12, 2008 11:03 am

Yeah, it would be nice though to have just a small slave service that tries to find a master - if it finds a master it could create a network share or something, launch the renderer from there and then render away.
I don't see the need to install Indigo on multiple machines and sync folders etc. since it only reads its files once and then only sends updates to its master. This can only be done on Indigos side though...

Btw. does Indigo compress network traffic?

Post Reply
14 posts • Page 1 of 1

Who is online

Users browsing this forum: No registered users and 37 guests