-
Notifications
You must be signed in to change notification settings - Fork 32
/
jiFakeParallax.oso
249 lines (249 loc) · 12.3 KB
/
jiFakeParallax.oso
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
OpenShadingLanguage 1.00
# Compiled by oslc 1.11.17
# options:
shader jiFakeParallax
param string filename "" %meta{string,widget,"filename"} %meta{string,help,"The texture file to project."} %read{6,74} %write{2147483647,-1} %derivs
param string depth_channel "average" %meta{string,widget,"popup"} %meta{string,options,"average|r|g|b"} %read{8,16} %write{2147483647,-1}
param int steps 1 %read{32,32} %write{2147483647,-1} %derivs
param vector scale 1 1 1 %read{2,2} %write{2147483647,-1} %derivs
param vector offset 0 0 0 %read{3,3} %write{2147483647,-1} %derivs
param int invert_depth 1 %meta{string,widget,"boolean"} %meta{string,help,"Whether to invert the depth projection or not. ON means that black pixels push in and white pixels stays on top of the surface and vice-versa."} %read{27,27} %write{2147483647,-1}
param float depth 1 %meta{float,min,0} %meta{float,max,5} %read{39,39} %write{2147483647,-1} %derivs
param float roughness 0 %meta{float,min,0} %meta{float,max,1} %read{72,72} %write{2147483647,-1}
oparam color out 0 0 0 %read{2147483647,-1} %write{79,79}
global vector I %read{60,60} %write{2147483647,-1} %derivs
global normal Ng %read{46,46} %write{2147483647,-1} %derivs
global float u %read{1,1} %write{2147483647,-1} %derivs
global float v %read{0,0} %write{2147483647,-1} %derivs
global vector dPdu %read{47,47} %write{2147483647,-1} %derivs
local normal ___330_NN %read{37,77} %write{37,77} %derivs
local normal ___330_tangent %read{37,77} %write{37,77} %derivs
local normal ___330_bitangent %read{37,77} %write{37,77} %derivs
local matrix ___330_tangentspace %read{37,77} %write{37,77} %derivs
local normal ___330_II %read{37,77} %write{37,77} %derivs
local vector ___330_RO %read{37,77} %write{37,77} %derivs
local point ___330_PPO %read{37,77} %write{37,77} %derivs
local point uvs %read{4,77} %write{3,3} %derivs
local color breakup_tex_col %read{10,23} %write{6,6} %derivs
local float breakup_tex %read{29,77} %write{10,29} %derivs
local vector proj_uvs %read{37,77} %write{37,77} %derivs
local color out_color %read{37,79} %write{30,77}
local int ssteps %read{34,78} %write{33,33} %derivs
local int steps_loop %read{37,77} %write{34,34}
local int ___332_s %read{37,77} %write{36,77} %derivs
local float ___333_cur_depth %read{37,77} %write{37,77} %derivs
local float ___333_dd %read{37,77} %write{37,77} %derivs
temp vector $tmp1 %read{2,2} %write{1,1} %derivs
temp float $tmp2 %read{1,1} %write{0,0} %derivs
const int $const1 0 %read{4,70} %write{2147483647,-1}
const float $const2 0 %read{1,58} %write{2147483647,-1}
temp vector $tmp3 %read{3,3} %write{2,2} %derivs
temp float $tmp4 %read{6,6} %write{4,4} %derivs
const int $const3 1 %read{5,77} %write{2147483647,-1}
temp float $tmp5 %read{6,6} %write{5,5} %derivs
const string $const4 "wrap" %read{6,74} %write{2147483647,-1}
const string $const5 "periodic" %read{6,74} %write{2147483647,-1}
const string $const6 "rgb_to_float" %read{7,7} %write{2147483647,-1}
const string $const7 "r" %read{8,8} %write{2147483647,-1}
temp int $tmp6 %read{9,9} %write{8,8}
const string $const8 "g" %read{12,12} %write{2147483647,-1}
temp int $tmp7 %read{13,13} %write{12,12}
const string $const9 "b" %read{16,16} %write{2147483647,-1}
temp int $tmp8 %read{17,17} %write{16,16}
const int $const10 2 %read{18,64} %write{2147483647,-1}
temp float $tmp9 %read{22,22} %write{20,20} %derivs
temp float $tmp10 %read{22,22} %write{21,21} %derivs
temp float $tmp11 %read{24,24} %write{22,22} %derivs
temp float $tmp12 %read{24,24} %write{23,23} %derivs
temp float $tmp13 %read{25,25} %write{24,24} %derivs
const float $const12 3 %read{25,25} %write{2147483647,-1}
temp int $tmp14 %read{28,28} %write{27,27}
const float $const13 1 %read{29,59} %write{2147483647,-1}
const int $const14 100 %read{32,32} %write{2147483647,-1}
const string $const15 "clamp" %read{31,31} %write{2147483647,-1}
temp int $tmp15 %read{33,33} %write{32,32} %derivs
temp int $tmp16 %read{37,77} %write{37,77}
temp int $tmp17 %read{35,77} %write{36,77}
const float $const16 0.100000001 %read{39,39} %write{2147483647,-1}
temp float $tmp18 %read{37,77} %write{37,77} %derivs
temp float $tmp19 %read{37,77} %write{37,77} %derivs
temp float $tmp20 %read{37,77} %write{37,77} %derivs
temp float $tmp21 %read{37,77} %write{37,77} %derivs
const string $const17 "calc_projection" %read{45,45} %write{2147483647,-1}
temp matrix $tmp22 %read{37,77} %write{37,77} %derivs
const string $const18 "world" %read{58,58} %write{2147483647,-1}
temp float $tmp23 %read{37,77} %write{37,77} %derivs
temp float $tmp24 %read{37,77} %write{37,77} %derivs
temp float $tmp25 %read{37,77} %write{37,77} %derivs
temp float $tmp26 %read{37,77} %write{37,77} %derivs
temp float $tmp27 %read{37,77} %write{37,77} %derivs
temp float $tmp28 %read{37,77} %write{37,77} %derivs
temp float $tmp29 %read{37,77} %write{37,77} %derivs
temp float $tmp30 %read{37,77} %write{37,77} %derivs
temp float $tmp31 %read{37,77} %write{37,77} %derivs
temp normal $tmp32 %read{37,77} %write{37,77} %derivs
temp normal $tmp33 %read{37,77} %write{37,77} %derivs
temp vector $tmp34 %read{37,77} %write{37,77} %derivs
const float $const20 -1 %read{63,63} %write{2147483647,-1}
temp float $tmp35 %read{37,77} %write{37,77} %derivs
temp float $tmp36 %read{37,77} %write{37,77} %derivs
temp float $tmp37 %read{37,77} %write{37,77} %derivs
temp color $tmp38 %read{37,77} %write{37,77}
temp float $tmp39 %read{37,77} %write{37,77} %derivs
temp float $tmp40 %read{37,77} %write{37,77} %derivs
const string $const21 "blur" %read{74,74} %write{2147483647,-1}
temp float $tmp41 %read{37,77} %write{37,77}
const float $const22 0.5 %read{73,73} %write{2147483647,-1}
temp float $tmp42 %read{37,77} %write{37,77}
temp int $tmp43 %read{2147483647,-1} %write{37,77}
temp color $tmp44 %read{79,79} %write{78,78}
code ___main___
# jiFakeParallax.osl:63
# point uvs = vector(u, -v, 0) * scale + offset;
neg $tmp2 v %filename{"jiFakeParallax.osl"} %line{63} %argrw{"wr"}
vector $tmp1 u $tmp2 $const2 %argrw{"wrrr"}
mul $tmp3 $tmp1 scale %argrw{"wrr"}
add uvs $tmp3 offset %argrw{"wrr"}
# jiFakeParallax.osl:66
# color breakup_tex_col = texture(filename, uvs[0], uvs[1], "wrap", "periodic");
compref $tmp4 uvs $const1 %line{66} %argrw{"wrr"}
compref $tmp5 uvs $const3 %argrw{"wrr"}
texture breakup_tex_col filename $tmp4 $tmp5 $const4 $const5 %argrw{"wrrrrr"} %argderivs{2,3}
# jiFakeParallax.osl:67
# float breakup_tex = rgb_to_float(breakup_tex_col, depth_channel);
functioncall $const6 27 %line{67} %argrw{"r"}
# jiFakeParallax.osl:32
# if (channel == "r")
eq $tmp6 depth_channel $const7 %line{32} %argrw{"wrr"}
if $tmp6 12 27 %argrw{"r"}
# jiFakeParallax.osl:33
# return in_col[0];
compref breakup_tex breakup_tex_col $const1 %line{33} %argrw{"wrr"}
return
# jiFakeParallax.osl:34
# else if (channel == "g")
eq $tmp7 depth_channel $const8 %line{34} %argrw{"wrr"}
if $tmp7 16 27 %argrw{"r"}
# jiFakeParallax.osl:35
# return in_col[1];
compref breakup_tex breakup_tex_col $const3 %line{35} %argrw{"wrr"}
return
# jiFakeParallax.osl:36
# else if (channel == "b")
eq $tmp8 depth_channel $const9 %line{36} %argrw{"wrr"}
if $tmp8 20 27 %argrw{"r"}
# jiFakeParallax.osl:37
# return in_col[2];
compref breakup_tex breakup_tex_col $const10 %line{37} %argrw{"wrr"}
return
# jiFakeParallax.osl:39
# return (in_col[0] + in_col[1] + in_col[2]) / 3;
compref $tmp9 breakup_tex_col $const1 %line{39} %argrw{"wrr"}
compref $tmp10 breakup_tex_col $const3 %argrw{"wrr"}
add $tmp11 $tmp9 $tmp10 %argrw{"wrr"}
compref $tmp12 breakup_tex_col $const10 %argrw{"wrr"}
add $tmp13 $tmp11 $tmp12 %argrw{"wrr"}
div breakup_tex $tmp13 $const12 %argrw{"wrr"}
return
# jiFakeParallax.osl:68
# if (invert_depth > 0)
gt $tmp14 invert_depth $const1 %line{68} %argrw{"wrr"}
if $tmp14 30 30 %argrw{"r"}
# jiFakeParallax.osl:69
# breakup_tex = 1-breakup_tex;
sub breakup_tex $const13 breakup_tex %line{69} %argrw{"wrr"}
# jiFakeParallax.osl:74
# color out_color = 0;
assign out_color $const1 %line{74} %argrw{"wr"}
# jiFakeParallax.osl:75
# int ssteps = clamp(steps, 1, 100);
functioncall $const15 34 %line{75} %argrw{"r"}
# /home/julius/bin/gaffer-1.0.2.0-linux-python2/shaders/stdosl.h:142
# int clamp (int x, int minval, int maxval) { return max(min(x,maxval),minval); }
min $tmp15 steps $const14 %filename{"/home/julius/bin/gaffer-1.0.2.0-linux-python2/shaders/stdosl.h"} %line{142} %argrw{"wrr"}
max ssteps $tmp15 $const3 %argrw{"wrr"}
# jiFakeParallax.osl:76
# int steps_loop = ssteps + 1;
add steps_loop ssteps $const3 %filename{"jiFakeParallax.osl"} %line{76} %argrw{"wrr"}
# jiFakeParallax.osl:78
# for (int s=1; s < steps_loop; s++)
for $tmp17 37 39 76 78 %line{78} %argrw{"r"}
assign ___332_s $const3 %argrw{"wr"}
lt $tmp16 ___332_s steps_loop %argrw{"wrr"}
neq $tmp17 $tmp16 $const1 %argrw{"wrr"}
# jiFakeParallax.osl:81
# float cur_depth = (depth * 0.1) / ssteps * s;
mul $tmp18 depth $const16 %line{81} %argrw{"wrr"}
assign $tmp20 ssteps %argrw{"wr"}
div $tmp19 $tmp18 $tmp20 %argrw{"wrr"}
assign $tmp21 ___332_s %argrw{"wr"}
mul ___333_cur_depth $tmp19 $tmp21 %argrw{"wrr"}
# jiFakeParallax.osl:82
# float dd = cur_depth * breakup_tex;
mul ___333_dd ___333_cur_depth breakup_tex %line{82} %argrw{"wrr"}
# jiFakeParallax.osl:85
# proj_uvs = calc_projection(dd, uvs);
functioncall $const17 70 %line{85} %argrw{"r"}
# jiFakeParallax.osl:13
# normal NN = Ng;
assign ___330_NN Ng %line{13} %argrw{"wr"}
# jiFakeParallax.osl:14
# normal tangent = normalize(dPdu);
normalize ___330_tangent dPdu %line{14} %argrw{"wr"}
# jiFakeParallax.osl:15
# normal bitangent = cross(tangent, NN);
cross ___330_bitangent ___330_tangent ___330_NN %line{15} %argrw{"wrr"}
# jiFakeParallax.osl:17
# tangent[0], tangent[1], tangent[2], 0.0,
compref $tmp23 ___330_tangent $const1 %line{17} %argrw{"wrr"}
compref $tmp24 ___330_tangent $const3 %argrw{"wrr"}
compref $tmp25 ___330_tangent $const10 %argrw{"wrr"}
# jiFakeParallax.osl:18
# bitangent[0], bitangent[1], bitangent[2], 0.0,
compref $tmp26 ___330_bitangent $const1 %line{18} %argrw{"wrr"}
compref $tmp27 ___330_bitangent $const3 %argrw{"wrr"}
compref $tmp28 ___330_bitangent $const10 %argrw{"wrr"}
# jiFakeParallax.osl:19
# NN[0], NN[1], NN[2], 0.0,
compref $tmp29 ___330_NN $const1 %line{19} %argrw{"wrr"}
compref $tmp30 ___330_NN $const3 %argrw{"wrr"}
compref $tmp31 ___330_NN $const10 %argrw{"wrr"}
# jiFakeParallax.osl:16
# matrix tangentspace = 1.0 / matrix("world",
matrix $tmp22 $const18 $tmp23 $tmp24 $tmp25 $const2 $tmp26 $tmp27 $tmp28 $const2 $tmp29 $tmp30 $tmp31 $const2 $const2 $const2 $const2 $const13 %line{16} %argrw{"wrrrrrrrrrrrrrrrrr"}
div ___330_tangentspace $const13 $tmp22 %argrw{"wrr"}
# jiFakeParallax.osl:21
# normal II = transform(tangentspace, normal(-I)) * -1;
neg $tmp34 I %line{21} %argrw{"wr"}
assign $tmp33 $tmp34 %argrw{"wr"}
transformn $tmp32 ___330_tangentspace $tmp33 %argrw{"wrr"}
mul ___330_II $tmp32 $const20 %argrw{"wrr"}
# jiFakeParallax.osl:24
# vector RO = II * (d / abs(II[2]));
compref $tmp36 ___330_II $const10 %line{24} %argrw{"wrr"}
abs $tmp35 $tmp36 %argrw{"wr"}
div $tmp37 ___333_dd $tmp35 %argrw{"wrr"}
mul ___330_RO ___330_II $tmp37 %argrw{"wrr"}
# jiFakeParallax.osl:25
# point PPO = PP + RO;
add ___330_PPO uvs ___330_RO %line{25} %argrw{"wrr"}
# jiFakeParallax.osl:26
# return PPO;
assign proj_uvs ___330_PPO %line{26} %argrw{"wr"}
# jiFakeParallax.osl:86
# out_color += texture(filename, proj_uvs[0], proj_uvs[1], "wrap", "periodic", "blur", roughness * cur_depth * 0.5);
compref $tmp39 proj_uvs $const1 %line{86} %argrw{"wrr"}
compref $tmp40 proj_uvs $const3 %argrw{"wrr"}
mul $tmp41 roughness ___333_cur_depth %argrw{"wrr"}
mul $tmp42 $tmp41 $const22 %argrw{"wrr"}
texture $tmp38 filename $tmp39 $tmp40 $const4 $const5 $const21 $tmp42 %argrw{"wrrrrrrr"} %argderivs{2,3}
add out_color out_color $tmp38 %argrw{"wrr"}
# jiFakeParallax.osl:78
# for (int s=1; s < steps_loop; s++)
assign $tmp43 ___332_s %line{78} %argrw{"wr"}
add ___332_s ___332_s $const3 %argrw{"wrr"}
# jiFakeParallax.osl:89
# out = out_color/ssteps;
assign $tmp44 ssteps %line{89} %argrw{"wr"}
div out out_color $tmp44 %argrw{"wrr"}
end