-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVrayRenderElements.ms
More file actions
137 lines (115 loc) · 4.73 KB
/
VrayRenderElements.ms
File metadata and controls
137 lines (115 loc) · 4.73 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
-------------------------------------------------------------------------------
-- VrayRenderElements.ms
-- By Ilya Floussov (ilya@conceptfarm.ca)
-- June 267h 2017
-- Adds a set of vray render elements, clears existing.
-------------------------------------------------------------------------------
macroScript VrayRenderElements
category:"ilya_s Scripts"
tooltip:"Add Vray Render Elements"
buttontext:"VrayRenderElements"
(
materialElements = #(MultiMatteElement , MultiMatteElement , MultiMatteElement , MultiMatteElement ,MultiMatteElement, MultiMatteElement ,MultiMatteElement)
objectElements = #(MultiMatteElement , MultiMatteElement, MultiMatteElement, MultiMatteElement, MultiMatteElement)
otherElementsStill =#(VRayZDepth, VRayBumpNormals, VRayRawReflection, VRayRawRefraction, VRayRawLighting, VRayRawShadow,VRaySelfIllumination,VRaySpecular,VRayDiffuseFilter,VrayDenoiser,VRayLightSelect,VRayLightSelect,VRayLightSelect)
otherElementsAni = #(VRayZDepth, VRayBumpNormals, VRayRawReflection, VRayRawLighting, VRaySelfIllumination,VRaySpecular,VRayDiffuseFilter, VrayGlobalIllumination, VRayReflection,VRayRefraction,VrayLighting,VrayRawGlobalIllumination,VrayDenoiser)
global re
fn getRenderElementByClass elementClass =
(
result = #()
re = maxOps.GetCurRenderElementMgr()
for n = 0 to (re.numrenderelements() - 1) do
(
thisElement = re.getrenderelement n
if ((classof thisElement) as string == elementClass as string) then (append result thisElement)
)
result
)
fn baseMaterialElements =
(
-- get the current render element manager
re.removeallrenderelements() -- remove all renderelements
for i = 1 to materialElements.count do
(
re.addrenderelement (materialElements[i] elementname:("MtlMatte" + (i as string)+"_"))
thisElement = re.GetRenderElement (i-1)
thisElement.enabled = true
thisElement.filterOn = true
thisElement.R_gbufIDOn = true
thisElement.R_gbufID = (3*(i-1)+1)
thisElement.G_gbufIDOn = true
thisElement.G_gbufID = (3*(i-1)+2)
thisElement.B_gbufIDOn = true
thisElement.B_gbufID = (3*(i-1)+3)
thisElement.MatID = true
)
for i = 1 to objectElements.count do
(
re.addrenderelement (objectElements[i] elementname:("ObjMatte" + (i as string)+"_"))
thisElement = re.GetRenderElement (i+(materialElements.count - 1))
thisElement.enabled = true
thisElement.filterOn = true
thisElement.R_gbufIDOn = true
thisElement.R_gbufID = (3*(i-1)+1)
thisElement.G_gbufIDOn = true
thisElement.G_gbufID = (3*(i-1)+2)
thisElement.B_gbufIDOn = true
thisElement.B_gbufID = (3*(i-1)+3)
thisElement.MatID = false
)
)
rollout AddRendElements "Add Render Elements"
(
button still_btn "Still Image" width:80 height:16
button ani_btn "Animation" width:80 height:16
on still_btn pressed do
(
baseMaterialElements()
for n in otherElementsStill do (re.addrenderelement (n elementname:(n as string)))
zdepthArray = getRenderElementByClass VrayZDepth
for i = 1 to zdepthArray.count do
(
zdepthArray[i].zdepth_use_camera_clip_boudaries = false
if zdepthArray.count > 1 then (zdepthArray[i].elementName = zdepthArray[i].elementName + "_" + i as string)
)
lightSelArray = getRenderElementByClass VrayLightSelect
for i = 1 to lightSelArray.count do
(
lightSelArray[i].mode = 1
if lightSelArray.count > 1 then (lightSelArray[i].elementName = lightSelArray[i].elementName + "_" + i as string)
)
DenoiseArray = getRenderElementByClass VrayDenoiser
for i = 1 to DenoiseArray.count do
(
DenoiseArray[i].mode = 2
if DenoiseArray.count > 1 then (DenoiseArray[i].elementName = DenoiseArray[i].elementName + "_" + i as string)
)
DestroyDialog AddRendElements
)
on ani_btn pressed do
(
baseMaterialElements()
for n in otherElementsAni do (re.addrenderelement (n elementname:(n as string)))
zdepthArray = getRenderElementByClass VrayZDepth
for i = 1 to zdepthArray.count do
(
zdepthArray[i].zdepth_use_camera_clip_boudaries = false
zdepthArray[i].zdepth_min = units.decodeValue "2.0m"
zdepthArray[i].zdepth_max = units.decodeValue "250.0m"
if zdepthArray.count > 1 then (zdepthArray[i].elementName = zdepthArray[i].elementName + "_" + i as string)
)
DenoiseArray = getRenderElementByClass VrayDenoiser
for i = 1 to DenoiseArray.count do
(
DenoiseArray[i].mode = 2
if DenoiseArray.count > 1 then (DenoiseArray[i].elementName = DenoiseArray[i].elementName + "_" + i as string)
)
DestroyDialog AddRendElements
)
)
on execute do
(
createDialog AddRendElements
re = maxOps.GetCurRenderElementMgr()
)
)