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
148 lines (140 loc) · 4.87 KB
/
Copy pathtemplate.yaml
File metadata and controls
148 lines (140 loc) · 4.87 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
specificationVersion: 'jobtemplate-2023-09'
name: Blender Render
parameterDefinitions:
# Render Parameters
- name: BlenderSceneFile
type: PATH
objectType: FILE
dataFlow: IN
userInterface:
control: CHOOSE_INPUT_FILE
label: Blender Scene File
groupLabel: Render Parameters
fileFilters:
- label: Blender Scene Files
patterns: ["*.blend"]
- label: All Files
patterns: ["*"]
description: >
Choose the Blender scene file you want to render. Use the 'Job Attachments' tab
to add textures and other files that the job needs.
- name: Frames
type: STRING
userInterface:
control: LINE_EDIT
label: Frames
groupLabel: Render Parameters
default: 1-10
- name: OutputDir
type: PATH
objectType: DIRECTORY
dataFlow: OUT
userInterface:
control: CHOOSE_DIRECTORY
label: Output Directory
groupLabel: Render Parameters
default: "./output"
description: Choose the render output directory.
- name: OutputPattern
type: STRING
userInterface:
control: LINE_EDIT
label: Output File Pattern
groupLabel: Render Parameters
default: "output_####"
description: Enter the output filename pattern (without extension).
- name: Format
type: STRING
userInterface:
control: DROPDOWN_LIST
label: Output File Format
groupLabel: Render Parameters
description: Choose the file format to render as.
default: JPEG
allowedValues: [TGA, RAWTGA, JPEG, IRIS, IRIZ, PNG, HDR, TIFF, OPEN_EXR, OPEN_EXR_MULTILAYER, CINEON, DPX, DDS, JP2, WEBP]
- name: ResolutionX
type: INT
userInterface:
control: SPIN_BOX
label: Resolution X
groupLabel: Render Parameters
description: Override the render resolution width. Set to 0 to use the scene default.
default: 0
- name: ResolutionY
type: INT
userInterface:
control: SPIN_BOX
label: Resolution Y
groupLabel: Render Parameters
description: Override the render resolution height. Set to 0 to use the scene default.
default: 0
- name: Samples
type: INT
userInterface:
control: SPIN_BOX
label: Render Samples
groupLabel: Render Parameters
description: Override the number of render samples (Cycles/EEVEE). Set to 0 to use the scene default.
default: 0
# Software Environment
- name: CondaPackages
type: STRING
userInterface:
# This parameter is for a queue environment, not used directly in the job,
# so leave the GUI for the queue environment to display.
control: HIDDEN
default: blender
description: >
If you have a Queue Environment that creates a Conda environment from a parameter called CondaPackages, this
will set the default packages to use for the job.
- name: RezPackages
type: STRING
userInterface:
# This parameter is for a queue environment, not used directly in the job,
# so leave the GUI for the queue environment to display.
control: HIDDEN
default: blender
description: >
If you have a Queue Environment that creates a Rez environment from a parameter called RezPackages, this will
tell it to install blender.
steps:
- name: RenderBlender
parameterSpace:
taskParameterDefinitions:
- name: Frame
type: INT
range: "{{Param.Frames}}"
script:
actions:
onRun:
command: bash
args: ['{{Task.File.Run}}']
embeddedFiles:
- name: Run
type: TEXT
data: |
# Configure the task to fail if any individual command fails.
set -xeuo pipefail
mkdir -p '{{Param.OutputDir}}'
# Build a Python expression to apply any overrides
PYTHON_OVERRIDES=""
if [ "{{Param.ResolutionX}}" -gt 0 ] 2>/dev/null && [ "{{Param.ResolutionY}}" -gt 0 ] 2>/dev/null; then
PYTHON_OVERRIDES="${PYTHON_OVERRIDES}bpy.context.scene.render.resolution_x={{Param.ResolutionX}}; "
PYTHON_OVERRIDES="${PYTHON_OVERRIDES}bpy.context.scene.render.resolution_y={{Param.ResolutionY}}; "
PYTHON_OVERRIDES="${PYTHON_OVERRIDES}bpy.context.scene.render.resolution_percentage=100; "
fi
if [ "{{Param.Samples}}" -gt 0 ] 2>/dev/null; then
PYTHON_OVERRIDES="${PYTHON_OVERRIDES}bpy.context.scene.cycles.samples={{Param.Samples}}; "
PYTHON_OVERRIDES="${PYTHON_OVERRIDES}bpy.context.scene.eevee.taa_render_samples={{Param.Samples}}; "
PYTHON_OVERRIDES="${PYTHON_OVERRIDES}bpy.context.scene.cycles.use_denoising=False; "
fi
OVERRIDE_ARGS=""
if [ -n "$PYTHON_OVERRIDES" ]; then
OVERRIDE_ARGS="--python-expr"
fi
blender --background '{{Param.BlenderSceneFile}}' \
--render-output '{{Param.OutputDir}}/{{Param.OutputPattern}}' \
--render-format {{Param.Format}} \
--use-extension 1 \
${OVERRIDE_ARGS:+"$OVERRIDE_ARGS"} ${PYTHON_OVERRIDES:+"import bpy; $PYTHON_OVERRIDES"} \
--render-frame {{Task.Param.Frame}}