vray default render presets issue

I’m trying to set up default render settings for v-ray for new maya files. Currently here are the problems i’m running into and hope to get some help:

1) I’m saving my preferred settings as a .json file and picking it under render settings>presets>set preffered render settings>user>mysettings. This does not seem to work when I create a new scene because the vraySettings node is not created yet when maya tries to apply the new render default..

2) I tried to create a userSetup.mel file that attempts to create a vraySettings file using the "vrayCreateVRaySettingsNode()" but because during maya’s launch, the vray plugin is loaded after, I get a // Error: file: C:/Users/me/Documents/maya/2020/scripts/userSetup.mel line 2: Cannot find procedure "vrayCreateVRaySettingsNode". // error.

Is there a different way of doing this ?

Hey there,

The error you’re getting hints to me that V-Ray isn’t loaded. That’s the only reason I can think of why the command will not be accessible.
You’ll need to set it to auto-load from the plugin manager so that all vray commands are accessible.
You can also set V-Ray as your preferred renderer (Maya’s Window menu > Settings / Preferences > Preferences > Rendering > Preferred renderer) and this should take care of both issues.

Hope that helps.

That is the whole issue, vray does not load in an order that makes that command be available for maya to use. I have gone as far as loading vray through the userSetup.mel file and while vray is loaded 100% as the first thing, the vrayCreateVRaySettingsNode()comand does not do anything when it’s being run through the userSetup.mel file.

my userSetup.mel file could be wrong but at least the v-ray loading is successful.

//
loadPlugin vrayformaya.mll;
loadPlugin xgenVRay.py;
vrayCreateVRaySettingsNode();
python ("import maya.app.renderSetup.views.renderSetupPreferences as prefs ; prefs.loadUserPreset('my_vray_defaults_v01')");

Try executing
vrayCreateVRaySettingsNode() and the python line as deferred and see if that helps.

Not sure what the syntax for the deferred command is, ,especially around the python line. (not a coder)

for MEL it’s evalDeferred(<code>) https://help.autodesk.com/cloudhelp/…lDeferred.html
Not sure for the wrapped python line, but maybe it will be as simple as evalDeferred(python(<code>)).
In any case, let’s look at the python line later and comment it out for now and let’s solve this one step at a time.

My guess here is that you’re calling a vray command before vray has finished loading, and I want to see if calling the command on idle will make it work.

hello!

I run into the same issue ever since. Maya can’t load the vray preset. It seems that Maya wants to load it, before vray plugin is loaded.

best
stefan

Try if my suggestion from above helps - make sure you create the vray settings node on idle.

For mel it should be something like this: evalDeferred “vrayCreateVRaySettingsNode”
For python you can try something like:

import maya.cmds as cmds
import maya.mel as mel
cmds.evalDeferred(‘mel.eval(\‘vrayCreateVRaySettin gsNode\’)’)

I’m sorry but I don’t get it.
I’m not familiar with coding, but shouldn’t his work by default?
I just don’t want do dial in my default settings everytime I start a new project.

thanks for helping out!

Sorry, I thought this was a continuation of the original thread, where the question was how to code it :slight_smile:
Is this about loading a preset manually, or about setting in a ‘default’ preset to be automatically loaded?

sorry for confusion.
It’s about both, manually and loaded as default automatically. Nothing works on my end.
Tried Vray 4 and 5 on Maya 2020.4

OK, can you tell me if you’re getting any errors in the script editor and paste those here?
Can you also outline some steps for me? E.g. 1. Open fresh maya session 2. open render settings 3. import preset

Can you also try and create a new preset and then see if it imports?
And finally, if you can share one preset file for me to try, this would be very helpful.

One more thing - can you tell me the exact versions of Maya and V-Ray (i.e. is it Maya 2020, or 2020.1, 2020.4 you can get it from Help > About Maya, and for V-Ray you can get it from V-Ray > About V-Ray)

Maya 2020.4
Vray 5 hotfix 3 (v5.00.23 from Apr 20 2021)

I open Maya and have set Vray as the default render engine. The render settings should be loaded on startup. I saved a .json file in the defauilt location. (C:\Users\…\Documents\maya\Presets)
New presets don’t work either and manually loading them doesn’t work too.

This is in the Script editor on startup:

// Initializing V-Ray for Maya

evalDeferred “shaderBallRendererMenuUpdate”;
# Error: file: C:/Users/postamt/Documents/maya/2020/scripts/userSetup.mel line 2: AttributeError: file <maya console> line 3: ‘module’ object has no attribute ‘cacheEvaluator’ #
// Error: MGlobal::executePythonCommand( “typesParam='types=” “+VRaySunShape,” “+VRaySunTarget,” “+VRayLightSphereShape,” “+VRayLightDomeShape,” “+VRayLightMeterShape,” “+VRayLightRectShape,” “+VRayLightIESShape,” “+VRayClipperShape,” “+VRayMeshPreview,” “+VRayPlane,” “+VRayPluginNodeLightShape,” “+VRayFurPreview,” “+VRayEnvironmentPreview,” “+VRaySphereFade,” “+VRayMetaball,” “+VRayScene” “'\n” “import maya.cmds as cmds\n” “cmds.cacheEvaluator(” “newFilter=‘nodeTypes’,” “newFilterParam=typesParam,” “newAction=‘enableEvaluationCache’” “)”): (kFailure): Unexpected Internal Failure //
// Error: line 1: Cannot find procedure “cacheEvaluator”. //
// Error: MGlobal::executeCommand(DAC): (kFailure): Unexpected Internal Failure //
// Warning: V-Ray VolumeGrid: Loading shaders failed - no <*.txt> files in . //
VRayVolumeGridInit();
// Warning: file: C:\Users\postamt\Documents\maya\2020\prefs\filePat hEditorRegistryPrefs.mel line 4: filePathEditor: Attribute ‘aiImage.filename’ is invalid or is not designated ‘usedAsFilename’. //
// Warning: file: C:\Users\postamt\Documents\maya\2020\prefs\filePat hEditorRegistryPrefs.mel line 5: filePathEditor: Attribute ‘aiPhotometricLight.aiFilename’ is invalid or is not designated ‘usedAsFilename’. //
// Warning: file: C:\Users\postamt\Documents\maya\2020\prefs\filePat hEditorRegistryPrefs.mel line 6: filePathEditor: Attribute ‘aiStandIn.dso’ is invalid or is not designated ‘usedAsFilename’. //
// Warning: file: C:\Users\postamt\Documents\maya\2020\prefs\filePat hEditorRegistryPrefs.mel line 7: filePathEditor: Attribute ‘aiVolume.filename’ is invalid or is not designated ‘usedAsFilename’. //
updateRendererUI;
# pymel.core : Updating pymel with pre-loaded plugins: vrayvolumegrid, vrayformaya, renderSetup
updateRenderOverride;
file -f -new;
// untitled //
commandPort -securityWarning -name commandportDefault;
onSetCurrentLayout “Maya Classic”;
addOneTabToGlobalsWindow(“vray”, “Common”, “vrayCreateVRayCommonGlobalsTab”);
addOneTabToGlobalsWindow(“vray”, “VRay”, “vrayCreateVRayGlobalsTab”);
addOneTabToGlobalsWindow(“vray”, “GI”, “vrayCreateIndirectIlluminationTab”);
addOneTabToGlobalsWindow(“vray”, “Settings”, “vrayCreateSettingsTab”);
addOneTabToGlobalsWindow(“vray”, “Overrides”, “vrayCreateOverridesTab”);
addOneTabToGlobalsWindow(“vray”, “Render Elements”, “vrayCreateRenderElementsTab”);
addOneTabToGlobalsWindow(“vray”, “IPR”, “vrayCreateRTTab”);
// AbcExport v1.0 using Alembic 1.7.5 (built Feb 6 2018 18:28:08) //
// AbcImport v1.0 using Alembic 1.7.5 (built Feb 6 2018 18:28:08) //
optionVar -exists “vnnUIUserPrefs”;
// Result: 1 //
optionVar -query “vnnUIUserPrefs”;
// Result: {} //
addOneTabToGlobalsWindow(“vray”, “Common”, “vrayCreateVRayCommonGlobalsTab”);
addOneTabToGlobalsWindow(“vray”, “VRay”, “vrayCreateVRayGlobalsTab”);
addOneTabToGlobalsWindow(“vray”, “GI”, “vrayCreateIndirectIlluminationTab”);
addOneTabToGlobalsWindow(“vray”, “Settings”, “vrayCreateSettingsTab”);
addOneTabToGlobalsWindow(“vray”, “Overrides”, “vrayCreateOverridesTab”);
addOneTabToGlobalsWindow(“vray”, “Render Elements”, “vrayCreateRenderElementsTab”);
addOneTabToGlobalsWindow(“vray”, “IPR”, “vrayCreateRTTab”);
vray_default_settings.zip (1.8 KB)

Alright. I have two observations so far:

1. The errors don’t seem related to presets.
These errors seem to be related to the cacheEvaluator plugin. I would recommend keeping this plugin enabled for now.
This is a maya built-in plugin and it seems to cause problems when it loads after V-Ray. This should get rid of the errors for now.

2. The preset you attached has nothing about V-Ray. No V-Ray Settings are written there.
To me this hints that something goes wrong when exporting the preset. Importing this preset would basically result in no changes.
It’s clear if you inspect it with any text editor, no vraySettings.* attributes are stored.
For example, here’s a preset I exported with the same Maya and V-Ray versions (see attached zip).
If you try and import it (just unzip and place in C:\Users\…\Documents\maya\Presets, no need to restart Maya) it should change the resolution, the sampler type and so on).

For now, I don’t really have more ideas, but it would be great if you can help us further debug this.
As a start, you can try loading my preset and let me know if it works at all on your end.
VRayDefault.zip (6.49 KB)

I was able to load your preset file on startup with no issues. I guess those are your settings.
How do you save out those, that they are written successfully?

Yep, those are my settings.
I just set the values (image sampler, min subdivs 2, max subdivs 12, and so on) and then Presets > Export Render Settings.
I guess you do it in the same way?

exactly, I do it the same way.

Can you try if exporting presets for another renderer works?

This is a related issue I ran into recently -- presets saved as .json files cannot be loaded when Maya’s legacy render layers are set as the preferred layer system.

A lot of places still use the legacy layers for their simplicity. So this seems like quite a large oversight.

Sorry for the delay. I tried with Arnold and the presets loads on startup, as expected. I can loas presets from the menu in Arnold, but not with vray.