Skip to content

Commit

Permalink
Merge branch 'outputsandOsl'
Browse files Browse the repository at this point in the history
  • Loading branch information
ezequielmastrasso committed Nov 24, 2021
2 parents 7030471 + 18d91f8 commit bd27532
Show file tree
Hide file tree
Showing 11 changed files with 2,007 additions and 35 deletions.
90 changes: 90 additions & 0 deletions osl/jiBubbles.oso
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
OpenShadingLanguage 1.00
# Compiled by oslc 1.7.4.pixar38bde12
# options:
shader jiBubbles
param color Position 0 0 0 %read{0,0} %write{2147483647,-1}
param point offset 0 0 0 %read{0,0} %write{2147483647,-1}
param int seed 0 %read{5,10} %write{2147483647,-1}
param int maxNum 10 %read{4,4} %write{2147483647,-1}
param float minSize 0.5 %read{13,16} %write{2147483647,-1}
param float maxSize 1.5 %read{13,13} %write{2147483647,-1}
param float gamma 1 %read{22,22} %write{2147483647,-1}
param point spread 1 1 1 %read{7,8} %write{2147483647,-1}
oparam color outRGB 0 0 0 %read{2147483647,-1} %write{4,26}
local color Pos %read{4,26} %write{0,0}
local float bubbles %read{4,26} %write{1,26}
local float ___305_i %read{4,26} %write{3,26}
local color ___306_randPos %read{4,26} %write{4,26}
local float ___306_randSize %read{4,26} %write{4,26}
const int $const1 0 %read{1,1} %write{2147483647,-1}
const float $const2 0 %read{3,21} %write{2147483647,-1}
temp int $tmp1 %read{2,26} %write{3,26}
temp color $tmp2 %read{4,26} %write{4,26}
temp float $tmp3 %read{4,26} %write{4,26}
temp color $tmp4 %read{4,26} %write{4,26}
temp point $tmp5 %read{4,26} %write{4,26}
const float $const4 2 %read{8,8} %write{2147483647,-1}
temp float $tmp6 %read{4,26} %write{4,26}
const int $const5 847 %read{10,10} %write{2147483647,-1}
temp int $tmp7 %read{4,26} %write{4,26}
temp float $tmp8 %read{4,26} %write{4,26}
temp float $tmp9 %read{4,26} %write{4,26}
temp float $tmp10 %read{4,26} %write{4,26}
temp float $tmp11 %read{4,26} %write{4,26}
const float $const7 1 %read{15,26} %write{2147483647,-1}
temp float $tmp12 %read{4,26} %write{4,26}
temp float $tmp13 %read{4,26} %write{4,26}
temp float $tmp14 %read{4,26} %write{4,26}
temp color $tmp15 %read{4,26} %write{4,26}
const string $const8 "clamp" %read{19,19} %write{2147483647,-1}
temp float $tmp16 %read{4,26} %write{4,26}
temp float $tmp17 %read{4,26} %write{4,26}
code ___main___
# jiBubbles.osl:25
# color Pos = Position - offset;
sub Pos Position offset %filename{"jiBubbles.osl"} %line{25} %argrw{"wrr"}
# jiBubbles.osl:27
# float bubbles = 0;
assign bubbles $const1 %line{27} %argrw{"wr"}
# jiBubbles.osl:29
# for (float i = 0.0; i < maxNum ; ++i) {
for $tmp1 4 5 26 27 %line{29} %argrw{"r"}
assign ___305_i $const2 %argrw{"wr"}
lt $tmp1 ___305_i maxNum %argrw{"wrr"}
# jiBubbles.osl:30
# color randPos = cellnoise(i,seed) * spread - (spread/2);
assign $tmp3 seed %line{30} %argrw{"wr"}
cellnoise $tmp2 ___305_i $tmp3 %argrw{"wrr"}
mul $tmp4 $tmp2 spread %argrw{"wrr"}
div $tmp5 spread $const4 %argrw{"wrr"}
sub ___306_randPos $tmp4 $tmp5 %argrw{"wrr"}
# jiBubbles.osl:31
# float randSize = minSize + cellnoise(i,seed+847) * (maxSize - minSize) / 1;
add $tmp7 seed $const5 %line{31} %argrw{"wrr"}
assign $tmp8 $tmp7 %argrw{"wr"}
cellnoise $tmp6 ___305_i $tmp8 %argrw{"wrr"}
sub $tmp9 maxSize minSize %argrw{"wrr"}
mul $tmp10 $tmp6 $tmp9 %argrw{"wrr"}
div $tmp11 $tmp10 $const7 %argrw{"wrr"}
add ___306_randSize minSize $tmp11 %argrw{"wrr"}
# jiBubbles.osl:32
# bubbles = max( bubbles, 1-( pow( clamp(distance(randPos,Pos/randSize),0,1), gamma)) );
div $tmp15 Pos ___306_randSize %line{32} %argrw{"wrr"}
distance $tmp14 ___306_randPos $tmp15 %argrw{"wrr"}
functioncall $const8 22 %argrw{"r"}
# /opt/pixar/RenderManProServer-21.3/lib/osl/include/stdosl.h:144
# PERCOMP1 (inversesqrt)
min $tmp16 $tmp14 $const7 %filename{"/opt/pixar/RenderManProServer-21.3/lib/osl/include/stdosl.h"} %line{144} %argrw{"wrr"}
max $tmp13 $tmp16 $const2 %argrw{"wrr"}
# jiBubbles.osl:32
# bubbles = max( bubbles, 1-( pow( clamp(distance(randPos,Pos/randSize),0,1), gamma)) );
pow $tmp12 $tmp13 gamma %filename{"jiBubbles.osl"} %line{32} %argrw{"wrr"}
sub $tmp17 $const7 $tmp12 %argrw{"wrr"}
max bubbles bubbles $tmp17 %argrw{"wrr"}
# jiBubbles.osl:33
# outRGB = bubbles;
assign outRGB bubbles %line{33} %argrw{"wr"}
# jiBubbles.osl:29
# for (float i = 0.0; i < maxNum ; ++i) {
add ___305_i ___305_i $const7 %line{29} %argrw{"wrr"}
end
149 changes: 149 additions & 0 deletions osl/jiPMask.oso
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
OpenShadingLanguage 1.00
# Compiled by oslc 1.11.6
# options:
shader jiPMask
param string Mapping "PWorld" %meta{string,widget,"popup"} %meta{string,options,"PWorld|PRef"} %read{6,6} %write{2147483647,-1}
param color Pos 0 0 0 %read{11,23} %write{2147483647,-1}
param color Radius 1 1 1 %read{13,25} %write{2147483647,-1}
param float whitepoint 1 %meta{float,min,0} %meta{float,max,1} %read{28,28} %write{2147483647,-1}
param float blackpoint 0 %meta{float,min,0} %meta{float,max,1} %read{29,29} %write{2147483647,-1}
param float gamma 1 %read{45,45} %write{2147483647,-1}
oparam float Mask 0 %read{2147483647,-1} %write{46,46}
oparam color PRef 0 0 0 %read{2147483647,-1} %write{4,4}
oparam color PWorld 0 0 0 %read{2147483647,-1} %write{5,5}
global point P %read{1,3} %write{2147483647,-1}
local point PosRef %read{4,8} %write{1,1}
local point PosWorld %read{5,9} %write{3,3}
local color Position %read{10,22} %write{8,9}
local float XPos %read{33,33} %write{15,15}
local float YPos %read{34,34} %write{21,21}
local float ZPos %read{36,36} %write{27,27}
local float mult %read{41,41} %write{28,28}
local float invMult %read{39,39} %write{32,32}
const string $const1 "object" %read{1,1} %write{2147483647,-1}
const string $const2 "transform" %read{0,2} %write{2147483647,-1}
const string $const3 "common" %read{1,3} %write{2147483647,-1}
const string $const4 "world" %read{3,3} %write{2147483647,-1}
const string $const5 "PRef" %read{6,6} %write{2147483647,-1}
temp int $tmp1 %read{7,7} %write{6,6}
const int $const6 0 %read{10,13} %write{2147483647,-1}
temp float $tmp2 %read{12,12} %write{10,10}
temp float $tmp3 %read{12,12} %write{11,11}
temp float $tmp4 %read{15,15} %write{12,12}
temp float $tmp5 %read{14,14} %write{13,13}
const float $const7 9.99999975e-05 %read{14,26} %write{2147483647,-1}
temp float $tmp6 %read{15,15} %write{14,14}
const int $const8 1 %read{16,19} %write{2147483647,-1}
temp float $tmp7 %read{18,18} %write{16,16}
temp float $tmp8 %read{18,18} %write{17,17}
temp float $tmp9 %read{21,21} %write{18,18}
temp float $tmp10 %read{20,20} %write{19,19}
temp float $tmp11 %read{21,21} %write{20,20}
const int $const9 2 %read{22,25} %write{2147483647,-1}
temp float $tmp12 %read{24,24} %write{22,22}
temp float $tmp13 %read{24,24} %write{23,23}
temp float $tmp14 %read{27,27} %write{24,24}
temp float $tmp15 %read{26,26} %write{25,25}
temp float $tmp16 %read{27,27} %write{26,26}
const float $const10 1 %read{28,45} %write{2147483647,-1}
temp float $tmp17 %read{31,31} %write{30,30}
temp float $tmp18 %read{30,30} %write{29,29}
temp float $tmp19 %read{32,32} %write{31,31}
const float $const11 2 %read{32,36} %write{2147483647,-1}
temp float $tmp20 %read{46,46} %write{44,44}
temp float $tmp21 %read{39,39} %write{38,38}
temp float $tmp22 %read{35,35} %write{33,33}
temp float $tmp23 %read{35,35} %write{34,34}
temp float $tmp24 %read{37,37} %write{35,35}
temp float $tmp25 %read{37,37} %write{36,36}
temp float $tmp26 %read{38,38} %write{37,37}
temp float $tmp27 %read{40,40} %write{39,39}
temp float $tmp28 %read{41,41} %write{40,40}
temp float $tmp29 %read{43,43} %write{41,41}
const float $const12 0 %read{44,44} %write{2147483647,-1}
const string $const13 "clamp" %read{42,42} %write{2147483647,-1}
temp float $tmp30 %read{44,44} %write{43,43}
temp float $tmp31 %read{46,46} %write{45,45}
code ___main___
# jiPMask.osl:21
# point PosRef = transform("object", P);
functioncall $const2 2 %filename{"jiPMask.osl"} %line{21} %argrw{"r"}
# /opt/solidangle/mtoa/2019/osl/include/stdosl.h:263
# point transform (string to, point p) { return transform("common",to,p); }
transform PosRef $const3 $const1 P %filename{"/opt/solidangle/mtoa/2019/osl/include/stdosl.h"} %line{263} %argrw{"wrrr"}
# jiPMask.osl:22
# point PosWorld = transform("world", P);
functioncall $const2 4 %filename{"jiPMask.osl"} %line{22} %argrw{"r"}
# /opt/solidangle/mtoa/2019/osl/include/stdosl.h:263
# point transform (string to, point p) { return transform("common",to,p); }
transform PosWorld $const3 $const4 P %filename{"/opt/solidangle/mtoa/2019/osl/include/stdosl.h"} %line{263} %argrw{"wrrr"}
# jiPMask.osl:23
# PRef = PosRef;
assign PRef PosRef %filename{"jiPMask.osl"} %line{23} %argrw{"wr"}
# jiPMask.osl:24
# PWorld = PosWorld;
assign PWorld PosWorld %line{24} %argrw{"wr"}
# jiPMask.osl:27
# if (Mapping == "PRef")
eq $tmp1 Mapping $const5 %line{27} %argrw{"wrr"}
if $tmp1 9 10 %argrw{"r"}
# jiPMask.osl:28
# Position = PosRef;
assign Position PosRef %line{28} %argrw{"wr"}
# jiPMask.osl:30
# Position = PosWorld;
assign Position PosWorld %line{30} %argrw{"wr"}
# jiPMask.osl:32
# float XPos = (Position[0]-Pos[0])/(Radius[0]+0.0001);
compref $tmp2 Position $const6 %line{32} %argrw{"wrr"}
compref $tmp3 Pos $const6 %argrw{"wrr"}
sub $tmp4 $tmp2 $tmp3 %argrw{"wrr"}
compref $tmp5 Radius $const6 %argrw{"wrr"}
add $tmp6 $tmp5 $const7 %argrw{"wrr"}
div XPos $tmp4 $tmp6 %argrw{"wrr"}
# jiPMask.osl:33
# float YPos = (Position[1]-Pos[1])/(Radius[1]+0.0001);
compref $tmp7 Position $const8 %line{33} %argrw{"wrr"}
compref $tmp8 Pos $const8 %argrw{"wrr"}
sub $tmp9 $tmp7 $tmp8 %argrw{"wrr"}
compref $tmp10 Radius $const8 %argrw{"wrr"}
add $tmp11 $tmp10 $const7 %argrw{"wrr"}
div YPos $tmp9 $tmp11 %argrw{"wrr"}
# jiPMask.osl:34
# float ZPos = (Position[2]-Pos[2])/(Radius[2]+0.0001);
compref $tmp12 Position $const9 %line{34} %argrw{"wrr"}
compref $tmp13 Pos $const9 %argrw{"wrr"}
sub $tmp14 $tmp12 $tmp13 %argrw{"wrr"}
compref $tmp15 Radius $const9 %argrw{"wrr"}
add $tmp16 $tmp15 $const7 %argrw{"wrr"}
div ZPos $tmp14 $tmp16 %argrw{"wrr"}
# jiPMask.osl:36
# float mult = 1/whitepoint;
div mult $const10 whitepoint %line{36} %argrw{"wrr"}
# jiPMask.osl:37
# float invMult = pow(1/sqrt(1-blackpoint),2);
sub $tmp18 $const10 blackpoint %line{37} %argrw{"wrr"}
sqrt $tmp17 $tmp18 %argrw{"wr"}
div $tmp19 $const10 $tmp17 %argrw{"wrr"}
pow invMult $tmp19 $const11 %argrw{"wrr"}
# jiPMask.osl:39
# Mask = pow(clamp(mult*(1-(invMult*(sqrt(pow(XPos,2)+pow(YPos,2)+pow(ZPos,2))))),0,1),1/gamma);
pow $tmp22 XPos $const11 %line{39} %argrw{"wrr"}
pow $tmp23 YPos $const11 %argrw{"wrr"}
add $tmp24 $tmp22 $tmp23 %argrw{"wrr"}
pow $tmp25 ZPos $const11 %argrw{"wrr"}
add $tmp26 $tmp24 $tmp25 %argrw{"wrr"}
sqrt $tmp21 $tmp26 %argrw{"wr"}
mul $tmp27 invMult $tmp21 %argrw{"wrr"}
sub $tmp28 $const10 $tmp27 %argrw{"wrr"}
mul $tmp29 mult $tmp28 %argrw{"wrr"}
functioncall $const13 45 %argrw{"r"}
# /opt/solidangle/mtoa/2019/osl/include/stdosl.h:141
# float clamp (float x, float minval, float maxval) { return max(min(x,maxval),minval); }
min $tmp30 $tmp29 $const10 %filename{"/opt/solidangle/mtoa/2019/osl/include/stdosl.h"} %line{141} %argrw{"wrr"}
max $tmp20 $tmp30 $const12 %argrw{"wrr"}
# jiPMask.osl:39
# Mask = pow(clamp(mult*(1-(invMult*(sqrt(pow(XPos,2)+pow(YPos,2)+pow(ZPos,2))))),0,1),1/gamma);
div $tmp31 $const10 gamma %filename{"jiPMask.osl"} %line{39} %argrw{"wrr"}
pow Mask $tmp20 $tmp31 %argrw{"wrr"}
end
104 changes: 104 additions & 0 deletions osl/jiTraceAOVs.oso
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
OpenShadingLanguage 1.00
# Compiled by oslc 1.11.6
# options:
shader jiTraceAOVs
param string trace_component "P" %meta{string,help,"The name of the component to reflect. OSL globals such as P, N, u, v as well as arbitrary userdata such as Pref are supported."} %read{11,25} %write{2147483647,-1}
param color trace_color 1 1 1 %meta{string,help,"The color to be used if trace_component is not found."} %read{29,29} %write{2147483647,-1}
param string traceset "" %meta{string,help,"The name of the traceset (optional). Can be used to exclude all geo of an environment if it contains multiple shapes."} %read{2,3} %write{2147483647,-1}
param int inclusive 1 %meta{string,widget,"checkBox"} %meta{string,help,"ON is inclusive. OFF is exclusive."} %read{0,0} %write{2147483647,-1}
oparam color out 0 0 0 %read{2147483647,-1} %write{24,29}
global point P %read{9,19} %write{2147483647,-1} %derivs
global vector I %read{5,8} %write{2147483647,-1} %derivs
global normal N %read{5,20} %write{2147483647,-1} %derivs
local color out_component %read{28,28} %write{25,25}
local string traceset_name %read{9,9} %write{2,3}
local int hit %read{10,10} %write{9,9}
local point ___338_trace_P %read{19,19} %write{18,18}
local int ___339_trace_msg %read{26,26} %write{25,25}
const int $const1 1 %read{0,26} %write{2147483647,-1}
temp int $tmp1 %read{1,1} %write{0,0}
const string $const2 "-%s" %read{2,2} %write{2147483647,-1}
temp vector $tmp2 %read{9,9} %write{8,8} %derivs
const string $const3 "reflect" %read{4,4} %write{2147483647,-1}
temp float $tmp3 %read{6,6} %write{5,5} %derivs
temp float $tmp4 %read{7,7} %write{6,6} %derivs
const float $const5 2 %read{6,6} %write{2147483647,-1}
temp vector $tmp5 %read{8,8} %write{7,7} %derivs
const string $const6 "traceset" %read{9,9} %write{2147483647,-1}
const string $const7 "distance" %read{11,11} %write{2147483647,-1}
temp int $tmp6 %read{12,12} %write{11,11}
temp int $tmp7 %read{13,17} %write{12,16}
const int $const8 0 %read{12,15} %write{2147483647,-1}
const string $const9 "dist" %read{14,14} %write{2147483647,-1}
temp int $tmp8 %read{15,15} %write{14,14}
temp int $tmp9 %read{16,16} %write{15,15}
temp int $tmp10 %read{2147483647,-1} %write{18,18}
const string $const10 "trace" %read{18,25} %write{2147483647,-1}
const string $const11 "P" %read{18,18} %write{2147483647,-1}
temp float $tmp11 %read{23,23} %write{22,22}
temp vector $tmp12 %read{21,21} %write{19,19}
temp normal $tmp13 %read{21,21} %write{20,20}
temp vector $tmp14 %read{22,22} %write{21,21}
temp float $tmp15 %read{24,24} %write{23,23}
const float $const13 100 %read{23,23} %write{2147483647,-1}
temp int $tmp16 %read{27,27} %write{26,26}
code ___main___
# jiTraceAOVs.osl:23
# if (inclusive < 1)
lt $tmp1 inclusive $const1 %filename{"jiTraceAOVs.osl"} %line{23} %argrw{"wrr"}
if $tmp1 3 4 %argrw{"r"}
# jiTraceAOVs.osl:24
# traceset_name = format("-%s", traceset);
format traceset_name $const2 traceset %line{24} %argrw{"wrr"}
# jiTraceAOVs.osl:26
# traceset_name = traceset;
assign traceset_name traceset %line{26} %argrw{"wr"}
# jiTraceAOVs.osl:29
# int hit = trace(P, reflect(I,N), "traceset", traceset_name);
functioncall $const3 9 %line{29} %argrw{"r"}
# /opt/solidangle/mtoa/2019/osl/include/stdosl.h:212
# vector reflect (vector I, vector N) { return I - 2*dot(N,I)*N; }
dot $tmp3 N I %filename{"/opt/solidangle/mtoa/2019/osl/include/stdosl.h"} %line{212} %argrw{"wrr"}
mul $tmp4 $const5 $tmp3 %argrw{"wrr"}
mul $tmp5 $tmp4 N %argrw{"wrr"}
sub $tmp2 I $tmp5 %argrw{"wrr"}
# jiTraceAOVs.osl:29
# int hit = trace(P, reflect(I,N), "traceset", traceset_name);
trace hit P $tmp2 $const6 traceset_name %filename{"jiTraceAOVs.osl"} %line{29} %argrw{"wrrrr"} %argderivs{1,2}
# jiTraceAOVs.osl:30
# if (hit)
if hit 30 30 %line{30} %argrw{"r"}
# jiTraceAOVs.osl:33
# if (trace_component == "distance" || trace_component == "dist")
eq $tmp6 trace_component $const7 %line{33} %argrw{"wrr"}
neq $tmp7 $tmp6 $const8 %argrw{"wrr"}
if $tmp7 14 17 %argrw{"r"}
eq $tmp8 trace_component $const9 %argrw{"wrr"}
neq $tmp9 $tmp8 $const8 %argrw{"wrr"}
assign $tmp7 $tmp9 %argrw{"wr"}
if $tmp7 25 30 %argrw{"r"}
# jiTraceAOVs.osl:36
# getmessage("trace", "P", trace_P);
getmessage $tmp10 $const10 $const11 ___338_trace_P %line{36} %argrw{"wrrw"}
# jiTraceAOVs.osl:37
# out = length( (trace_P - P) * abs(N)) / 100;
sub $tmp12 ___338_trace_P P %line{37} %argrw{"wrr"}
abs $tmp13 N %argrw{"wr"}
mul $tmp14 $tmp12 $tmp13 %argrw{"wrr"}
length $tmp11 $tmp14 %argrw{"wr"}
div $tmp15 $tmp11 $const13 %argrw{"wrr"}
assign out $tmp15 %argrw{"wr"}
# jiTraceAOVs.osl:42
# int trace_msg = getmessage("trace", trace_component, out_component);
getmessage ___339_trace_msg $const10 trace_component out_component %line{42} %argrw{"wrrw"}
# jiTraceAOVs.osl:44
# if (trace_msg == 1)
eq $tmp16 ___339_trace_msg $const1 %line{44} %argrw{"wrr"}
if $tmp16 29 30 %argrw{"r"}
# jiTraceAOVs.osl:45
# out = out_component;
assign out out_component %line{45} %argrw{"wr"}
# jiTraceAOVs.osl:47
# out = trace_color;
assign out trace_color %line{47} %argrw{"wr"}
end
Loading

0 comments on commit bd27532

Please sign in to comment.