forked from openNuke/toolset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bumpNormals.nk
422 lines (422 loc) · 7.64 KB
/
bumpNormals.nk
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
#http://www.nukepedia.com/gizmos/other/bumpnormals Michael Garrett 15/06/2010
set cut_paste_input [stack 0]
version 9.0 v1
push $cut_paste_input
add_layer {UV UV.u UV.v}
add_layer {surface_normal surface_normal.x surface_normal.y surface_normal.z}
Group {
name Bump_Normals
help "Generate bump for a 3D normals pass in world space. The input bump texture can either be flat or a 3D render."
selected true
xpos 367
ypos -31
addUserKnob {20 BumpNormals l "Bump Normals"}
addUserKnob {41 from0 l "bump channel" t "Choose the channel that is used to generate the bump texture." T Bump2Vectors.from0}
addUserKnob {41 size l "blur amount" T Bump2Vectors.size}
addUserKnob {41 value l strength T Bump2Vectors.value}
addUserKnob {41 flipx l "flip x" T Bump2Vectors.flipx}
addUserKnob {41 flipy l "flip y" T Bump2Vectors.flipy}
addUserKnob {26 ""}
addUserKnob {4 bumptexturetype l "bump texture type" t "Use \"flat\" if the input bump is a flat texture that will be wrapped onto the surface using UV coordinates. Use \"prerendered 3D\" if you are using an existing 3D texture pass to provide the bump detail." M {flat "prerendered 3D" "" "" ""}}
addUserKnob {41 in_1 l "bump uv channels" t "Choose a prerendered UV channel. This only has an effect when the bump texture type is set to \"flat\"." T Shuffle1.in}
addUserKnob {41 in l "normal in" T MakeBump.in}
addUserKnob {41 out l "normal out" T MakeBump.out}
addUserKnob {6 normalise -STARTLINE}
addUserKnob {20 Info}
addUserKnob {22 documentation l " Documentation / Feedback " T "import webbrowser\nwebbrowser.open('http://opennuke.github.io/RotateNormal_nk/')" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {26 version l version: T 1.0}
addUserKnob {26 created l created: T "15/06/2010 by <a href=\\'http://www.nukepedia.com/gizmos/other/bumpnormals'> Michael Garrett.</a>"}
addUserKnob {26 source T "http://www.nukepedia.com/gizmos/other/bumpnormals\n"}
addUserKnob {26 licence l licence: T "<a href=\"https://github.com/openNuke/toolset/blob/master/LICENCE\">READ ME</a>"}
}
Input {
inputs 0
name in
xpos 21
ypos -410
}
Dot {
name Dot1
xpos 55
ypos -322
}
set N3b3b8b70 [stack 0]
Dot {
name Dot4
xpos -41
ypos -322
}
Dot {
name Dot3
xpos -41
ypos -58
}
set N3b3c1240 [stack 0]
push $N3b3b8b70
Expression {
channel0 {forward.u -forward.v none -backward.v}
expr0 x/width
channel1 {-forward.u forward.v none -backward.v}
expr1 y/height
channel2 none
expr2 0
channel3 {none none none -rgba.alpha}
name Expression1
xpos 77
ypos -266
}
push $N3b3b8b70
Shuffle {
in UV
out forward
name Shuffle1
xpos -30
ypos -266
}
Switch {
inputs 2
which {{bumptexturetype i}}
name Switch1
xpos 28
ypos -183
}
Input {
inputs 0
name bump
xpos 189
ypos -286
number 1
}
Group {
name Bump2Vectors
xpos 189
ypos -232
addUserKnob {20 User}
addUserKnob {41 from0 l "bump channel" T Copy1.from0}
addUserKnob {41 size l "blur amount" T Blur2.size}
addUserKnob {41 value l strength T Multiply2.value}
addUserKnob {41 flipx l "flip x" T SwitchXB.flipx}
addUserKnob {41 flipy l "flip y" T SwitchYB.flipy}
}
Input {
inputs 0
name bump
xpos 240
ypos -309
}
set N3b3f9fa0 [stack 0]
push $N3b3f9fa0
Copy {
inputs 2
to0 rgba.red
name Copy1
xpos 240
ypos -225
}
Shuffle {
in rgb
green red
blue red
alpha black
out rgb
name Shuffle1
xpos 240
ypos -171
}
Clamp {
channels rgb
maskChannelMask -rgba.alpha
name Clamp1
xpos 240
ypos -146
}
Blur {
channels rgb
name Blur2
xpos 240
ypos -121
}
Multiply {
channels rgb
value 6
name Multiply2
xpos 240
ypos -96
}
set N3fe13b80 [stack 0]
Shuffle {
green black
blue black
alpha black
name Shuffle3
xpos 199
ypos -48
}
set N3fe1dd10 [stack 0]
Position {
translate {1 0}
name Position2
xpos 199
ypos 7
}
set N3fe2aad0 [stack 0]
push $N3fe1dd10
Position {
translate {-1 0}
name Position1
xpos 114
ypos 7
}
set N3fe32180 [stack 0]
Switch {
inputs 2
which {{flipy}}
name SwitchXB
selected true
xpos 93
ypos 56
addUserKnob {20 User}
addUserKnob {6 flipx l "flip x" +STARTLINE}
flipx true
}
push $N3fe32180
push $N3fe2aad0
Switch {
inputs 2
which {{parent.SwitchXB.which}}
name SwitchXA
xpos 199
ypos 57
}
ChannelMerge {
inputs 2
A rgba.red
operation minus
B rgba.red
output rgba.red
maskChannelMask -rgba.alpha
name ChannelMerge1
xpos 152
ypos 101
}
push $N3fe13b80
Shuffle {
red black
blue black
alpha black
name Shuffle4
xpos 288
ypos -49
}
set N3fe53060 [stack 0]
Position {
translate {0 1}
name Position4
xpos 376
ypos 4
}
set N3fe5fe50 [stack 0]
push $N3fe53060
Position {
translate {0 -1}
name Position3
xpos 288
ypos 5
}
set N3fe67500 [stack 0]
Switch {
inputs 2
which {{flipx}}
name SwitchYB
xpos 298
ypos 53
addUserKnob {20 User}
addUserKnob {6 flipy l "flip y" +STARTLINE}
}
push $N3fe67500
push $N3fe5fe50
Switch {
inputs 2
which {{parent.SwitchYB.which}}
name SwitchYA
xpos 404
ypos 54
}
ChannelMerge {
inputs 2
A rgba.green
operation minus
B rgba.green
output rgba.green
maskChannelMask -rgba.alpha
name ChannelMerge2
xpos 342
ypos 108
}
Copy {
inputs 2
from0 rgba.red
to0 rgba.red
name Copy2
xpos 243
ypos 161
}
Output {
name Output1
xpos 243
ypos 228
}
end_group
STMap {
inputs 2
channels rgb
uv forward
name STMap1
xpos 189
ypos -183
}
CopyBBox {
inputs 2
name CopyBBox1
xpos 189
ypos -62
}
push $N3b3c1240
Dot {
name Dot2
xpos -41
ypos 9
}
Group {
inputs 2
name MakeBump
xpos 189
ypos 5
addUserKnob {20 User}
addUserKnob {41 in l "normal in" T ShuffleN.in}
addUserKnob {41 out l "normal out" T ShuffleCopy1.out}
}
Input {
inputs 0
name normal
xpos 115
ypos -437
}
Dot {
name Dot3
xpos 149
ypos -328
}
set N404b4eb0 [stack 0]
Dot {
name Dot2
xpos 274
ypos -328
}
Shuffle {
in surface_normal
alpha black
name ShuffleN
xpos 240
ypos -271
}
Input {
inputs 0
name bumpvector
xpos 344
ypos -439
number 1
}
Dot {
name Dot1
xpos 378
ypos -204
}
MergeExpression {
inputs 2
expr0 Ar+Br+Bg
expr1 Ag+Br+Bg
expr2 Ab+Br+Bg
maskChannelMask -rgba.alpha
name MergeExpression1
xpos 240
ypos -208
}
set N404d2880 [stack 0]
Group {
name Normalise
xpos 324
ypos -150
}
Input {
inputs 0
name Input1
selected true
xpos -187
ypos -119
}
set N404e5c90 [stack 0]
push $N404e5c90
push $N404e5c90
MergeExpression {
inputs 2
channel0 rgb
expr0 sqrt((Ar*Br)+(Ag*Bg)+(Ab*Bb))
channel1 {-rgba.red -rgba.green -rgba.blue none}
channel2 {-rgba.red -rgba.green -rgba.blue none}
channel3 {none none none -rgba.alpha}
maskChannelMask -rgba.alpha
name MergeExpression3
xpos -260
ypos 49
}
MergeExpression {
inputs 2
expr0 Ar/Br
expr1 Ag/Bg
expr2 Ab/Bb
channel3 {none none none -rgba.alpha}
maskChannelMask -rgba.alpha
name MergeExpression4
xpos -178
ypos 165
}
Output {
name Output1
xpos -178
ypos 264
}
end_group
push $N404d2880
Switch {
inputs 2
which {{parent.parent.normalise i}}
name Switch1
xpos 240
ypos -96
}
push $N404b4eb0
ShuffleCopy {
inputs 2
red red
green green
blue blue
out surface_normal
name ShuffleCopy1
selected true
xpos 115
ypos -24
}
Output {
name Output1
xpos 115
ypos 50
}
end_group
Output {
name Output1
xpos 189
ypos 84
}
end_group