Scripting V-Ray Options

Currently trying to make a Python script that will make changes to V-Ray options. The only thing I could find is the command below and it just opens the V-Ray options window.

import rhinoscriptsyntax as rs
rs.Command ("~visOptions")

I need to adjust Image Sampler and DMC Sampler.

I did find:

rs.RenderAntialias(0)

I believe that only impacts the Rhino Render.

If you want to adjust the Image Sampler and the DMC Sampler for V-Ray using Rhinoscript the easiest way would be like this:

Call Main()
Sub Main()
  Dim VRay
  Set VRay = Rhino.GetPluginObject("V-Ray for Rhino")
  VRay.SetAdaptiveDMCNoiseThreshold(0.1)	
End Sub

Other functions you could use are

VRay.SetAdaptiveDMCNoiseThreshold(0.1)
VRay.SetAdaptiveDMCMinMaxSubdivs(10, 20)
VRay.SetAdaptiveSubdivisionThreshold(0.1)
VRay.SetAdaptiveSubdivisionNormals(1, 0.0)
VRay.SetAdaptiveSubdivisionSamples(1)
VRay.SetFixedRateSubdivs(10)

Matthew Newberg
V-Ray For Rhino Developer

2 Likes

Matthew Newberg,

Fantastic! That is a huge help. I do have a few more questions.

VRay.SetAdaptiveDMCNoiseThreshold(0.1)

This does not appear to have an effect on the Noise Threshold under the DMC sampler. What I am specifically looking for is to adjust the ‘Adaptive amount’, ‘Noise threshold’, and ‘Min samples’ under the DMC sampler.

Thanks for all your help!

~Ariel

Ariel,

I guess what you are looking for are:

VRay.SetDMCAdaptiveAmount(0.01)
VRay.SetDMCMinimumSamples(10)
VRay.SetDMCNoiseThreshold(0.01)
VRay.SetDMCSubdivisionMultiplier(0.01)
VRay.SetDMCPathSampler(0)

Let me know what you think.

Matthew,

That’s perfect! Thank you so much for your help.

For anyone working in Python this is what I was able to get to work:

import rhinoscriptsyntax as rs

vRay = rs.GetPlugInObject(“V-Ray for Rhino”)
vRay.SetDMCAdaptiveAmount(0.01)
vRay.SetDMCMinimumSamples(10)
vRay.SetDMCNoiseThreshold(0.01)
vRay.SetDMCSubdivisionMultiplier(0.01)
vRay.SetDMCPathSampler(0)
vRay.SetAdaptiveDMCNoiseThreshold(0.1)
vRay.SetAdaptiveDMCMinMaxSubdivs(10, 20)
vRay.SetAdaptiveSubdivisionThreshold(0.1)
vRay.SetAdaptiveSubdivisionNormals(1, 0.0)
vRay.SetAdaptiveSubdivisionSamples(1)
vRay.SetFixedRateSubdivs(10)

1 Like

Matthew,

I just realized that I need Adaptive Subdivision min and max levels not Adaptive DMC.
I need this:

VRay.SetAdaptiveDMCMinMaxSubdivs(-1, 2)

I tired the one below but that didn’t work.

VRay.SetAdaptiveSubdivisionMax(2)

Any thoughts?

Thanks,

Ariel

Ariel,

Can you save out vropt files with your settings before and after the item you are looking to change and post them here. Might be easier to figure out which setting you are asking about.

Matthew,

I thought an image might be a little clearer. Here are the four that I need.

Thanks for all your help!

Ariel

For Max Rate you will need to use:

VRay.SetAdaptiveSubdivisionMinMaxRate -1, 2

For the DMC Sampler you will need:

VRay.SetDMCAdaptiveAmount 0.85
VRay.SetDMCNoiseThreshold 0.01
VRay.SetDMCMinimumSamples 8

It might be helpful if you use a tlb viewer (http://www.benf.org/other/olewoo/) to open the file in (C:\ProgramData\ASGVIS\VfR564\VRayForRhino.tlb).

I noticed it is an older .tlb file, but it appears to have many of the functions people use in it.

Mathew,

Thank you so much for all the great help. The .tlb file (which was very well hidden) will be a great help in the future.

Thanks again,

Ariel

Mathew,

Sorry to bother you again. Using the file that you showed me I looked up ‘Indirect Illumination (GI)’ > ‘Secondary bounces’ for Vray options and came up with the code below.

Call Main()
Sub Main()
Dim VRay
Set VRay = Rhino.GetPluginObject(“V-Ray for Rhino”)
VRay.SetDMCGISecondaryBounce(0.9)
End Sub

I get the error: “Object doesn’t support this property or method:”

Have you had this issue?

Thanks,

Ariel

This code should work:

VRay.SetDMCGISecondaryBounces 2

Matthew,

That code doesn’t throw any errors but I am not getting the change I am looking for. I am correct thinking this is the value it should be changing correct? Or should it be something like SetGISecondaryBounceMultiplier?

Thanks,

Ariel

Try:

	VRay.SetSecondaryEngine 0.6, 1

Matthew,

Fantastic! You have been an invaluable help.

Thanks,

Ariel


For anyone working in Python:

import rhinoscriptsyntax as rs
vRay = rs.GetPlugInObject(“V-Ray for Rhino”)
vRay.SetBatchRenderOn(True)
vRay.SetShadowsOn(True)
vRay.SetDMCAdaptiveAmount(0.95)
vRay.SetDMCMinimumSamples(5)
vRay.SetDMCNoiseThreshold(0.01)
vRay.SetSecondaryEngine(0.6, 1)