setting vray separate render channels via maxscript

Hi!

This is a crosspost to the one I’ve started on cgtalk. Since the problem is in vray I hope vray people should give the solution.

I’m writing batch render script and trying to implement feature to set automatically render elements paths relative to main output file’s path. Max’s standard render elements work fine and predictable but with Vray’s frame buffer enabled something goes wrong.

Assuming that
vr = renderers.current

I enable vray frame buffer and set vray output by

vr.output_saveRawFile = true vr.output_on = true vr.output_rawFileName = “filename.exr”

Then I enable split render channels and set file to write to:

vr.output_splitgbuffer = true vr.output_splitfilename = “filename.exr”

And nothing happens! Vray saves only “raw” file but not the render channels.
It creates them ONLY if I point split render channel file by the “browse” button!

Is there some checkbox I’ve missed or some way to further set output file name?

Thank you.

You would set this in the same way as you set the render output in the Common tab of the Render Scene dialog. Can’t remember what was the trick there, I have to check.

The problem is that the “output_splitfilename” parameter is not a string parameter - it is a bitmap, so assigning a string to it will not work.

Best regards,
Vlado

this is what “show (renderers.current)” command says:

.output_splitfilename : string
.output_splitbitmap : bitmap

I’ve checked all vray properties during normal, not “maxscript-ed”, rendering and found that .output_splitbitmap parameter is set to last rendered element file.

I think this bitmap should exist in order to get hold on it, and supposing that this bitmap is a produce of render how can I set it before the rendering?

In fact, if I set split file name manually, after that I’m able to change the name of .output_splitfilename and it works. Also I can change the state of .output_splitgbuffer.

But if I make this for the first time and split file name was not set manually all that changings and settings don’t work - I can set properties but with no result.

you also cant do a batch render with vray demo

Thank you for reply, but I don’t use standard batch render. I’m writing my own batch render, it works with vray demo. I want to implement some vray-specific features (demo version is absolutely sufficient for this) in order to make script more valuable for the community and I thought this forum is the best place to solve vray-specific problems.

hows the scene transfered to the other computers

To test this variable I dont’t need to transfer scene to other computers. Batch render doesn’t always mean network render.
I don’t understand you. Do you think I’m trying to cheat demo protection with my batch script? Absolutely not! Since I made my script public my main gain is to make it more interesting.
Here is the script - http://www.scriptspot.com/3ds-max/batch-camera-render. If you read the comments you’ll see that vray features is what the community demands most often.
Can I get help at this forum using vray demo version? Is there some license restrictions relating using demo version with maxscript?

There are no restrictions on using MaxScript with the demo version. For development purposes, we can also get you an NFR license of V-Ray.

Best regards,
Vlado

nono, i was wondering just how it worked. looks ingenious. the render settings are set in the batch script.. does this mean they can be changed on the fly during a render?

You can’t really change any parameters while V-Ray is rendering (except with V-Ray RT of course).

Best regards,
Vlado

Script doesn’t change anything at render time, it works quite simply - just gets render parameters from camera object (they saved as a text in user properties) and sets them to the renderer.
So far everything works fine except the gbuffer settings in vray.
If I set the “split render channels” file manualy vray saves the channels, but if I set this property by the maxscript, and if I do this for the first time, nothing happens. If I change this file name by the maxscript after the manual setup then channels are rendered.
Something happens when user sets file manually, something, that doesn’t happen with maxscript…

Are there some advantages in developing under that kind of license? Sorry, I don’t know what it is.

Thank you.

Here is the solution by Track @ scriptspot - http://www.scriptspot.com/3ds-max/batch-camera-render#comment-5253

i just figured how to solve the original issue of this post :
output_splitfilename don’t like string containing escape characters in it.
for example “c:\render\temp\aaa.jpg” will lead in no picture saved when affecting the output_splitfilename with a string like this.
In this case, the \n will be interpretated as a carriage return and the \t as a tabulation.
I searched a lot on that, because i abolutely need it to work for the next solidrocks release.

I fall on very complex algorithms over the forums… hmmm.. finally i realised that only 4 problematic characters may happen : \n, \t, \r, \x.

So i decided to write a very simple script wich helps to put a path on output_splitfilename via maxscript using this little function :

fn Validthepath thepath =
(

			theValidFilename=""
			for i = 1 to thepath.count do
			(
				escfound = false
				--if thepath[i]=="\\" then theValidFilename+="\\"	
				if thepath[i]=="\n" then
				(
					theValidFilename+="\\n"
					escfound = true
				)
				if thepath[i]=="\r" then 
				(
					theValidFilename+="\\r"
					escfound = true
				)
				if thepath[i]=="\t" then 
				(
					theValidFilename+="\\t"
					escfound = true
				)
				if thepath[i]=="\x" then
				(
					theValidFilename+="\\x"escfound = true
				)

				if escfound == false then theValidFilename+=thepath[i]
			)
			return thevalidfilename
)

how to use :
let’s say your variable mysavepath = “c:\render\temp\aaa.jpg”
just type :
renderers.current.VrayEngine.output_splitfilename = Validthepath mysavepath

And voila ! aaa.jpg is created :wink:
note : it seems to correctly affect the render elements as well.

Perfect ! SolidRocks for Vray 3.0 is coming soon !

hmm sorry.. my mistake, not working on fresh scene test. grrr..
but how to say to Vray Where to save files ??? damn this output_splitfilename is very annyonning…

ok my script is still usefull to be sure to remove escape chars from the path.

After that, it’s also needed to “give” a bitmap to vray output_splitbitmap value to make it work.
finally the solution came from here :
http://forums.chaosgroup.com/showthread.php?67555-scripting-output-path-filename-and-extention-How&highlight=output\_splitfilename
Many thanks for sushidelic for that tip.

note : it seems that the bitmap don’t have to be into the same final peth than the desired one. It’s just to “activate” Vray on this stuff.