Changing the renderer to Vray

Hi all.

I've been reading a lot and done a lot of google searching but am having zero success.

All I want to know is what to write to switch the renderer to Vray.

I currently have tried

vr=renderers.current

and

renderers.current = V_Ray_Adv_1_50_SP6

both do nothing for me......

This should be so simple! But when i change to the vray renderer manually nothing prints to the listener.

Any help welcome.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
j_forrester's picture

For

For Scanline

renderers.current = Default_scanline_renderer ()

For Mental Ray

renderers.current = mental_ray_renderer ()

For Vray

renderers.current = Vray()

Script_Butler's picture

I have

Thanks for the reply.

I have input that and get V_Ray_Adv_1_50_SP6:V_Ray_Adv_1_50_SP6

when the renderer is on Default Scanline and i type in vr=renderers.current it get
vr=renderers.current

Default_Scanline_Renderer:Default_Scanline_Renderer in the listener. It doesn't change it to Vray like it has been suggested it should.

Cheers.

Script_Butler

barigazy's picture

The Solution

This one line of code work fine

for r in 1 to (rendererClass.classes).count where matchPattern ((rendererClass.classes)[r] as string) pattern:"V_Ray_Adv*" do Renderers.Production = RendererClass.Classes[r]()

barigazy

Script_Butler's picture

Isn't there a simpler way?

Thank you for that solution barigazy. I am such a beginner I wouldn't of had a clue it would involve such a complicated sting. (It's complicated to me anyway!!)

Is there not a simpler way though?

Cheers.

Script_Butler

barigazy's picture

another solution

First one line of code is flexibile.You can run any version of VRAY.
I use max2012 and Vray 2.3 and works well.
But in your case try this

renderers = rendererClass.classes
idx = finditem renderers V_Ray_Adv_1_50_SP6
Renderers.Production = renderers[idx]()


or just use

renderers.current = V_Ray_Adv_1_50_SP6()

barigazy

Script_Butler's picture

Lovely

Thanks again for the explanation. It would be silly of me not to use the first version really as if we upgrade to vray 2, which we will eventually, my script will continue working.

But having a simpler line of code also is great for me as a learner. It seems i needed the open/closed brackets. Can i just ask why these are needed?

Cheers.

Script_Butler

barigazy's picture

Because

Because *V_Ray_Adv_1_50_SP6()* is a function.
When you want to eveluate FN you need to use bruckets *()*
but not always. For more info about FN visit this link

http://docs.autodesk.com/3DSMAX/15/ENU/MAXScript-Help/index.html?url=fil...

barigazy

TsveTan's picture

""

Had you tried input renderers.current to the listener to see what syntax, supposing vray is current renderer when you write this?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.