Skip to content

Commit a6a5b1a

Browse files
authored
allow Vray scripts to use extra cli arguements (#95)
1 parent e323d18 commit a6a5b1a

File tree

7 files changed

+319
-10
lines changed

7 files changed

+319
-10
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ for convenience. For more information see
162162

163163
## Additional Options
164164

165+
### Maya Additional Options
166+
165167
The default given is `-verb -b 1 -ai:lve 0`. Here's a breakdown of what those flags mean:
166168

167169
* `-verb` Print Mel commands before they are executed
@@ -177,6 +179,12 @@ of each other.
177179
To view all of the possible arguments see [this page](/docs/mds/ARNOLD.md) for the Arnold renderer. Flags for
178180
other renderers are not documented here, but could be if requested.
179181

182+
### VRay Additional Options
183+
184+
The default for VRay is `-verbose=3` which is the default log output level.
185+
186+
See [the VRAY help page](/docs/mds/VRAY.md) for all the available flags you can use here.
187+
180188
## Running Maya UI in a VDI
181189

182190
It's possible for users to run the AutoDesk Maya UI through a virtual deskop application in OpenOndemand (VDI).

app/controllers/scripts_controller.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class ScriptsController < ApplicationController
22

33
def new
44
@project = Project.find(params[:project_id])
5-
init_script
5+
@script = default_script
66
end
77

88
def create
@@ -113,14 +113,13 @@ def get_jobs(params)
113113
@jobs = @script.jobs.where(script_id: params[:script_id])
114114
end
115115

116-
def init_script
117-
@script = @project.scripts.build(
118-
file: @project.directory,
119-
extra: '-verb -b 1 -ai:lve 0',
116+
def default_script
117+
@project.scripts.build(
120118
email: true,
121119
walltime: 1,
122-
type: @project.script_type,
123-
skip_existing: true
120+
skip_existing: true,
121+
extra: @project.default_script_extra,
122+
type: @project.script_type
124123
)
125124
end
126125

app/models/maya_project.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ def scenes
1313
def script_type
1414
'MayaScript'
1515
end
16+
17+
def default_script_extra
18+
'-verb -b 1 -ai:lve 0'
19+
end
1620
end

app/models/project.rb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
# Project class is meant to be subclassed for specific functionality
14
class Project < ApplicationRecord
25
validates :name, presence: true, length: { minimum: 5 }, uniqueness: true
36
validates :directory, presence: true
@@ -17,8 +20,13 @@ class Project < ApplicationRecord
1720
self.inheritance_column = :type
1821

1922
def directory_must_be_valid
20-
unless Dir.exist? directory
21-
errors.add(:directory, "the directory must be valid")
22-
end
23+
errors.add(:directory, 'the directory must be valid') unless Dir.exist? directory
24+
end
25+
26+
# subclasses should override this. It's kind of an awkward place to put this
27+
# knowledge of where the default Script.extra should be, but a script is tied
28+
# to a project so, it's the best place for now.
29+
def default_script_extra
30+
''
2331
end
2432
end

app/models/v_ray_project.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ def scenes
1313
def script_type
1414
'VRayScript'
1515
end
16+
17+
def default_script_extra
18+
'-verboseLevel=3'
19+
end
1620
end

docs/mds/VRAY.md

Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
# Vray command line options
2+
3+
```text
4+
Usage:
5+
vray -server
6+
or
7+
vray <option> <option> ...
8+
9+
where option (case-sensitive) is one of the following:
10+
([] means optional string, {} means the string can be repeated
11+
zero or more times)
12+
13+
SYSTEM OPTIONS:
14+
15+
-help - print this help text and exit.
16+
17+
-version - print the V-Ray version and exit.
18+
19+
-credits - print copyright notices for V-Ray and available plugins.
20+
21+
-configFile - the path and file name to the vray config file
22+
Note that additional paths for V-Ray plugins can also be specified
23+
with the VRAY_PLUGINS environment variable.
24+
(default is vrayconfig.xml in the same folder as vray.exe).
25+
26+
-numThreads=nnn - set the number of rendering threads
27+
(default is 0 - automatic)
28+
29+
INPUT FILES:
30+
31+
-sceneFile="filename.vrscene" - the scene file to render.
32+
33+
-include="includePath{;includePath}" - specify path(s) for include files.
34+
More than one -include options can be specified.
35+
36+
-remapPath="fromPath=toPath{;fromPath=toPath}" - specify path remapping pair.
37+
More than one -remapPath options can be specified.
38+
39+
-remapPathFile="remapFile.xml" - specify path to an XML file with
40+
path remapping data.
41+
Example file:
42+
43+
<RemapPaths>
44+
<RemapItem>
45+
<From>Z:/export</From>
46+
<To>/mnt/export</To>
47+
</RemapItem>
48+
</RemapPaths>
49+
50+
-parameterOverride="<plugin-parameter-id>=<value>" - make it possible to
51+
change values for plugin parameters without editing the vrscene file.
52+
<plugin-parameter-id> - can be two formats - PluginType::parameterName
53+
or pluginName.parameterName.
54+
<value> - its format depends on the type of the parameter you want to
55+
override. Supported types are bool, int, float, color, acolor, texture
56+
and float texture. For bool, int and float a simple number is expected
57+
For color - Color(1, 0.0, 1.0) is expected. For acolor - AColor(1.0, 0,
58+
0, 0.3). For texture the format should be the same as for acolor or the
59+
name of a plugin to connect to the parameter. For float texture
60+
parameters either one float or a name of a plugin is expected.
61+
More than one -parameterOverride options can be specified and they will
62+
be executed in the order they are specified on the command line.
63+
Examples:
64+
-parameterOverride="SettingsImageSampler::type=3"
65+
-parameterOverride="TexFresnel::fresnel_ior=1.3"
66+
-parameterOverride="[email protected]=Color(1.0,0.2,1.0)"
67+
-parameterOverride="[email protected]_tex=checker1"
68+
69+
-camera="<sceneName>" - specify which camera should be used for rendering.
70+
The name should correspond to the camera settings scene_name param.
71+
72+
RENDER OUTPUT:
73+
74+
-imgFile="fileName" - write the resulting image to the given file.
75+
If the file name is empty, no image will be written.
76+
77+
-imgWidth=nnn - set the output image width.
78+
(default is 640 or as specified in the .vrscene file)
79+
80+
-imgHeight=nnn - set the output image height.
81+
(default is 480 or as specified in the .vrscene file)
82+
83+
-region=x0;y0;x1;y1 - set the region to render.
84+
The integer values are in pixels, relative to the upper-left corner
85+
of the image.
86+
(default is full image or as specified in the .vrscene file)
87+
88+
-region=none - ignore any the region specified in the .vrscene file
89+
90+
-crop=x0;y0;x1;y1 - set the crop region to render.
91+
The integer values are in pixels, relative to the upper-left corner
92+
of the image.
93+
(default is full image or as specified in the .vrscene file)
94+
95+
-frames=b0[-e0[,s0]]{;bn[-en[,sn]]} - specify the frames and/or frame
96+
intervals to render. More than one -frames option can be specified.
97+
bX is the start frame, eX is the end frame, and sX is the frame
98+
increment. If not specified, the frames from the scene description
99+
are rendered.
100+
101+
-noFrameNumbers=0/1 - controls whether the -frames option will cause
102+
frame numbers to be automatically appended to the names of the
103+
rendered image files.
104+
(default is 0 - the -frames option always causes frame numbers to
105+
be added to the output image files.)
106+
107+
108+
-skipExistingFrames=0/1 - if there is an output file for the current frame,
109+
then the frame will be skipped and next one (if any) will be started.
110+
(default is 0 - no frame skipping)
111+
112+
-resume=0/1 - if there is a resumable file existing for the current frame,
113+
the rendering will be resumed from it. Otherwise a new render will be
114+
started and resumable files will be saved. If the rendering is already
115+
complete, the frame will be skipped and the next one (if any)
116+
will be started.
117+
Render resuming with bucket sampling works with raw .vrimg files.
118+
Other formats are supported by saving a separate .vrimg file with
119+
the same name as the output image. Deep output and tiled EXR files
120+
are currently not supported.
121+
Resuming with progressive sampling works by saving a separate
122+
progressive resumable file (.vrprog) with the same name as the
123+
output image.
124+
(default is 0 - do not resume)
125+
126+
-progressiveAutoSave=fff - autosave resumable file every fff minutes
127+
during progressive rendering, fff is a floating-point number.
128+
Resuming must be enabled for this to have any effect.
129+
(default is 0.0 - autosave disabled)
130+
131+
VFB DISPLAY OPTIONS:
132+
133+
-display=0/1 - show the rendered image in a window
134+
(default is 1 - show the rendered image)
135+
136+
-autoClose=0/1 - automatically closes the displayed image when rendering
137+
is complete
138+
(default is 0 - wait for user to close the VFB).
139+
140+
-setfocus=0/1 - set the focus on the VFB window if displayed.
141+
(default is 1 - set the focus)
142+
143+
-displaySRGB=0/1/2 - determines if the sRGB option of the V-Ray VFB will be
144+
turned on or off initially: 0 - use sRGB state from the VFB settings
145+
plugin in the scene file (defaults to on); 1 - sRGB is on;
146+
2 - sRGB is off.
147+
This can also be specified with the VRAY_VFB_SRGB environment variable.
148+
The command line option overrides the environment variable.
149+
(default is 0)
150+
151+
-displayLUT=0/1 - determines if the LUT option of the V-Ray VFB will be
152+
turned on or off initially. This can also be specified with the
153+
VRAY_VFB_LUT environment variable. The command line option overrides
154+
the environment variable. The LUT file itself can be specified with
155+
the VRAY_VFB_LUT_FILE environment variable.
156+
(default is 0 - LUT is off)
157+
158+
-displayOCIO=0/1 - determines if the OCIO option of the V-Ray VFB will be
159+
turned on or off initially. This can also be specified with the
160+
VRAY_VFB_OCIO environment variable. The command line option overrides
161+
the environment variable. The OCIO configuration itself can be
162+
specified with the OCIO environment variable.
163+
(default is 0 - OCIO is off)
164+
165+
-displayAspect=0/1 - determines if the pixel aspect option of the V-Ray VFB
166+
will be turned on or off initially. This can also be specified with
167+
the VRAY_VFB_PIXEL_ASPECT environment variable. The command line
168+
option overrides the environment variable.
169+
(default is 0 - pixel aspect is off)
170+
171+
CONSOLE OUTPUT:
172+
173+
-verboseLevel=n - specifies the verbose level of information printed
174+
to the standard output: 0 - no information printed; 1 - only errors;
175+
2 - errors and warnings; 3 - errors, warnings and informational
176+
messages; 4 - all output
177+
(default is 3)
178+
179+
-detailedTiming=0/1 - specifies whether summary timing information would
180+
be printed to the standard output at the end of execution. 0 - disable;
181+
1 - enable;
182+
(default is 0)
183+
184+
-showProgress=n - specifies whether calculations progress should be
185+
printed to the standard output: 0 - do not display progress;
186+
1 - display progress only if verboseLevel is > 0; 2 - always.
187+
(default is 1)
188+
189+
-progressUpdateFreq=n - specifies the progress update frequency in ms.
190+
Only one of -progressUpdateFreq and -progressIncrement is used,
191+
depending on which is specified last on the command line.
192+
(default is 200ms)
193+
194+
-progressIncrement=n - specifies the progress increment in percentage.
195+
Only one of -progressUpdateFreq and -progressIncrement is used,
196+
depending on which is specified last on the command line.
197+
198+
-progressUseCR=0/1 - controls how to use carriage return when outputting
199+
render progress. 0 uses regular \n line endings and is useful when
200+
redirecting the output to a file; 1 uses \r to save screen space.
201+
(default is 1)
202+
203+
-progressUseColor=0/1 - specifies whether to colorize the output:
204+
1 - enable, 0 - disable
205+
(default is 1)
206+
207+
RT ENGINE:
208+
209+
-rtEngine=0/1/3/5/7 - renders with the RT engine instead of the regular
210+
V-Ray renderer: 0 - use the regular V-Ray renderer (no RT engine);
211+
1 - use the CPU version of the RT engine; 3 - use the OpenCL version
212+
of the RT engine; 5 - use the CUDA version of the RT engine; 7 - use
213+
the RTX version of the RT engine.
214+
(default is 0 - use the regular V-Ray renderer)
215+
216+
-rtTimeOut=fff - specifies a timeout value for a frame when using the RT
217+
engine. fff is a floating-point number representing time in minutes.
218+
(default is 0.0 - no timeout)
219+
220+
-rtNoise=fff - specifies noise threshold for a frame when using the RT
221+
engine. fff is a floating-point number.
222+
(default is 0.001)
223+
224+
-rtSampleLevel=N - specifies maximum paths per pixel when using the RT
225+
engine. N is an integer number.
226+
(default is 0 - no limit)
227+
228+
DISTRIBUTED RENDERING:
229+
230+
-server - Start in server mode waiting for connections.
231+
232+
-distributed=0/1/2 - specifies whether to use distributed rendering:
233+
0 - do not use distributed rendering; 1 - use distributed rendering
234+
including the local machine; 2 - use distributed rendering excluding
235+
the local machine.
236+
(default is 0 - no distributed rendering)
237+
238+
-renderhost="host{;host}" - use these host(s) for distributed rendering.
239+
Hosts can be specified either as computer names or by IPs. More than
240+
one -renderhost options can be specified.
241+
242+
-portNumber=n - specify the port number to use for distributed rendering.
243+
The port numbers of the render servers and the render client must
244+
match for DR to work. The port can also be overridden using the
245+
VRAY_DR_CONTROLPORT environment variable. This command line option
246+
overrides the environment variable.
247+
(default is 20207)
248+
249+
-transferAssets=0/1/2 - specifies whether missing assets should be
250+
transferred to the DR servers: 0 - do not transfer; 1 - transfer
251+
missing assets; 2 - check for assets in the asset cache folder before
252+
transferring them. The VRAY_ASSETS_CACHE_PATH environment variable can
253+
be used to specify the asset cache folder; if it is not specified,
254+
the assets are stored in a directory "vray_assets_cache" inside the
255+
temp folder for the current user.
256+
(default is 0 - do not transfer assets)
257+
258+
-cachedAssetsLimitType=0/1/2 - type of limitation used for cached assets
259+
on DR server: 0 - no limits; 1 - older than, assets older than
260+
specified period of hours will be deleted. 2 - cache size, if the
261+
assets cache grow over the specified size (GBs), the oldest assets
262+
will be deleted from cache.
263+
(default is 0 - no limits)
264+
265+
-cachedAssetsLimitValue=fff - specifies limit value for a cached assets.
266+
fff is a floating-point number representing the value. Meaning of the
267+
value depend of -cachedAssetsLimitType parameter.
268+
(default is 0.0)
269+
270+
-overwriteLocalCacheSettings=0/1 - specifies which settings for asset cache
271+
limitations to be taken into account. 0 - server's settings.
272+
1 - client's settings.
273+
(default is 0 - use server's settings for assets cache limitations)
274+
275+
-limitHosts=N - limit the number of render hosts used for distributed
276+
rendering to the first N idle hosts specified in the -renderHost
277+
options.
278+
(default is 0 - use all available hosts)
279+
280+
-autoCloseIfIdle=n - specify the minutes the server will wait in idle
281+
state before closing itself. A value of 0 means this feature is
282+
disabled otherwise it is the idle time in minutes.
283+
```
284+
285+

jobs/video_jobs/vray_submit.sh.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ vray.bin -sceneFile="<%= Shellwords.escape(file) %>" \
5454
-distributed=0 \
5555
-skipExistingFrames=<%= skip_existing ? '1' : '0' %> \
5656
-display=0 \
57+
<%= extra %> \
5758
-frames=<%= frames %>
5859

5960
STATUS=$?

0 commit comments

Comments
 (0)