forked from aws-deadline/deadline-cloud-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
151 lines (136 loc) · 4.84 KB
/
Copy pathtemplate.yaml
File metadata and controls
151 lines (136 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
specificationVersion: 'jobtemplate-2023-09'
name: 3ds Max V-Ray Render
description: |
This job bundle renders a 3ds Max scene using V-Ray with frame chunking support.
Features:
- Frame chunking for efficient parallel rendering
- VRIMG to EXR conversion with denoising preservation
- Automatic cleanup of temporary files
- Error handling and validation
Requirements:
- 3ds Max 2025 installed on Windows worker hosts
- V-Ray plugin for 3ds Max
parameterDefinitions:
# Render Parameters
- name: SceneFile
type: PATH
objectType: FILE
dataFlow: IN
userInterface:
control: CHOOSE_INPUT_FILE
label: 3ds Max Scene File
groupLabel: Render Parameters
fileFilters:
- label: 3ds Max Scene Files
patterns: ["*.max"]
- label: All Files
patterns: ["*"]
description: Choose the 3ds Max scene file you want to render.
- name: Frames
type: STRING
userInterface:
control: LINE_EDIT
label: Frames
groupLabel: Render Parameters
default: "0-10"
description: Frame range to render (e.g., 1-100, 1,5,10-20)
- name: OutputDirectory
type: PATH
objectType: DIRECTORY
dataFlow: OUT
userInterface:
control: CHOOSE_DIRECTORY
label: Output Directory
groupLabel: Render Parameters
description: Choose the render output directory.
- name: FramesPerTask
type: INT
userInterface:
control: SPIN_BOX
label: Frames Per Task
groupLabel: Render Parameters
default: 1
minValue: 1
description: Number of frames to render per task
steps:
- name: Render EXRs
parameterSpace:
taskParameterDefinitions:
- name: Frame
type: INT
range: "{{Param.Frames}}:{{Param.FramesPerTask}}"
script:
embeddedFiles:
- name: render_script
filename: render.bat
type: TEXT
runnable: true
data: |
@echo off
setlocal enabledelayedexpansion
echo Starting 3ds Max render...
echo Scene: {{Param.SceneFile}}
echo Original Frame Range: {{Param.Frames}}
set /a taskStart={{Task.Param.Frame}}
REM Check if this is a non-contiguous range (contains commas)
echo {{Param.Frames}} | findstr "," >nul
if !errorlevel! equ 0 (
REM Non-contiguous range - always render single frame
set /a taskEnd=!taskStart!
echo Non-contiguous range detected - rendering single frame: !taskStart!
) else (
REM Contiguous range - check if we need to limit the end frame
set /a taskEnd=!taskStart!+{{Param.FramesPerTask}}-1
REM Extract the actual end frame from the range to avoid going beyond it
for /f "tokens=2 delims=-" %%a in ("{{Param.Frames}}") do set maxFrame=%%a
if !taskEnd! gtr !maxFrame! set taskEnd=!maxFrame!
echo Contiguous range - rendering frames !taskStart! to !taskEnd!
)
REM Validate output directory
mkdir "{{Param.OutputDirectory}}" 2>nul
echo test > "{{Param.OutputDirectory}}\test.tmp" 2>nul || (
echo ERROR: Cannot write to output directory
exit /b 1
)
del "{{Param.OutputDirectory}}\test.tmp" 2>nul
REM Check vrimg2exr exists
if not exist "C:\ProgramData\Autodesk\ApplicationPlugins\VRay3dsMax2025\bin\vrimg2exr.exe" (
echo ERROR: vrimg2exr.exe not found
exit /b 1
)
REM Render frame range for this chunk
"C:\Program Files\Autodesk\3ds Max 2025\3dsmaxcmd.exe" -start:!taskStart! -end:!taskEnd! "{{Param.SceneFile}}"
if %ERRORLEVEL% NEQ 0 (
echo ERROR: 3dsmaxcmd failed with exit code %ERRORLEVEL%
exit /b %ERRORLEVEL%
)
if !taskStart! equ !taskEnd! (
echo 3ds Max render completed successfully for frame !taskStart!
) else (
echo 3ds Max render completed successfully for frames !taskStart! to !taskEnd!
)
echo Converting .vrimg files to .exr and moving to output...
set converted=0
for %%f in ("C:\temp\*.vrimg") do (
if exist "{{Param.OutputDirectory}}\%%~nf.exr" (
echo Skipping %%~nxf - EXR exists
) else (
echo Converting %%~nxf...
"C:\ProgramData\Autodesk\ApplicationPlugins\VRay3dsMax2025\bin\vrimg2exr.exe" "%%f" "{{Param.OutputDirectory}}\%%~nf.exr"
if !errorlevel! equ 0 (
echo Converted %%~nxf to EXR
del "%%f" >nul 2>&1
set /a converted+=1
) else (
echo Failed to convert %%~nxf
)
)
)
echo Converted !converted! files to EXR
del "C:\temp\*.vrimg" >nul 2>&1
dir "{{Param.OutputDirectory}}\*.exr" /b 2>nul || echo No EXR files
actions:
onRun:
command: "{{Task.File.render_script}}"
cancelation:
mode: NOTIFY_THEN_TERMINATE