-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0988a06
commit ba5c0bb
Showing
104 changed files
with
3,393 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Blackbody Color Shader | ||
// Blackbody.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader Blackbody | ||
[[ string help = "Modulates a color between two Kelvin temperatures" ]] | ||
( | ||
float Input = u, | ||
float Min = 0.0 [[ float min = 0.0, float max = 10000.0 ]], | ||
float Max = 5000.0 [[ float min = 0.0, float max = 10000.0 ]], | ||
int Normalize = 1 [[ string widget = "checkBox" ]], | ||
float Intensity = 1.0, | ||
output color Col = 0.0, | ||
) | ||
{ | ||
Col = blackbody(mix(Min, Max, Input)); | ||
if (Normalize) | ||
Col = normalize(Col); | ||
Col *= Intensity; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Random circles (or spheres, really) with outputs | ||
// for bump, random factor, etc. Can be made to make | ||
// very cool random candy cover... | ||
// | ||
// Candy.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader Candy | ||
[[ string help="Random circles with random colors and a tunable bump output. For random dots or candy sprinkles." ]] | ||
( | ||
// For convenience, default to object space | ||
// You can connect any other coordinate space | ||
// as input anyway... | ||
point UVW = transform("object", P) [[ string help = "The position input, defaulting to object space. Connect an UVW shader for other alternatives." ]], | ||
float Scale = 20.0, | ||
float Radius = 0.5 [[ float min=0.0, float max=2.0 ]], | ||
int RandomOverlap = 0 [[ string widget = "checkBox" ]], | ||
float BumpAmount = 1.0, | ||
float BumpShape = 1.0, | ||
|
||
output color Col = 0, | ||
output float Fac = 0, | ||
output float Bump = 0, | ||
output float Dist = 0, | ||
output float Rnd = 0 | ||
) | ||
{ | ||
point pnt = UVW / Scale; | ||
float pri = -1; | ||
|
||
// Sandard method for randomization: | ||
// Go through a 3x3x3 grid that we offset | ||
for (float x = -1; x <= 1; x++) | ||
{ | ||
for (float y = -1; y <= 1; y++) | ||
{ | ||
for(float z = -1; z <= 1; z++) | ||
{ | ||
// Point that sources all our randomization | ||
// We run these through cell noises to get | ||
// random values | ||
point rndpoint = pnt + point(x, y, z); | ||
|
||
// Compute a center | ||
point dotcenter = floor(rndpoint) + noise("cell", rndpoint, 1); | ||
float dist = distance(dotcenter, pnt); | ||
// Randomize the priority, all they all look "stacked" in | ||
// the same direction if they overlap | ||
float priority = noise("cell", rndpoint, 2); | ||
|
||
// If within the radius, and priority is higher | ||
if (dist < Radius && priority > pri) | ||
{ | ||
pri = priority; | ||
|
||
Col = noise("cell", rndpoint, 3); | ||
Dist = dist / Radius; | ||
Bump = pow(sin((1.0 - Dist) * 1.58), BumpShape) * BumpAmount; | ||
Fac = 1.0; | ||
Rnd = priority; | ||
|
||
// If we exit early, shader is more efficient, | ||
// but any "overlap" becomes completely sorted | ||
// in an X/Y/Z order and looks fake. | ||
if (!RandomOverlap) | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Pick one of ten inputs | ||
// Color1of10.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader Color1of10 | ||
[[ string help = "Pick one of 10 inputs", | ||
string label= "1 of 10 (color)", | ||
string category = "Switchers" ]] | ||
( | ||
int Index = 0 | ||
[[ string label = "Input index to use", | ||
string help = "Pick the index (number) of the input to use. "]], | ||
color I0 = color(1.0, 0.5, 0.4) [[ string label = "Input 0" ]], | ||
color I1 = color(1.0, 1.0, 0.4) [[ string label = "Input 1" ]], | ||
color I2 = color(0.5, 1.0, 0.4) [[ string label = "Input 2" ]], | ||
color I3 = color(0.5, 1.0, 1.0) [[ string label = "Input 3" ]], | ||
color I4 = color(0.0, 0.5, 1.0) [[ string label = "Input 4" ]], | ||
color I5 = color(1.0, 0.5, 1.0) [[ string label = "Input 5" ]], | ||
color I6 = color(1.0, 1.0, 1.0) [[ string label = "Input 6" ]], | ||
color I7 = color(0.6, 0.6, 0.6) [[ string label = "Input 7" ]], | ||
color I8 = color(0.2, 0.2, 0.2) [[ string label = "Input 8" ]], | ||
color I9 = color(0.1, 0.1, 0.1) [[ string label = "Input 9" ]], | ||
|
||
int StartIdx = 0 | ||
[[ string label = "Start Index", | ||
string help = | ||
"Offsets the input index so that this number will map to the first input. " | ||
"E.g. if set to 10, the first input (labeled Input 0) will map to index 10, rather than 0. " | ||
"This is used when cascading multiple switchers into each other and allow them " | ||
"to cover different ranges." ]], | ||
int Mod = 0 | ||
[[ string label = "Range: Number of inputs", | ||
string help = "If 0, returns all outputs and any outside the range uses the 'Outside Range' input. " | ||
"If a nonzero number, only uses that many inputs, repeated in a rotating fashion." ]], | ||
color Outside = 0.0 | ||
[[ string label = "Outside Range", | ||
string help = | ||
"The value to return when the index falls outside the set of available inputs. " | ||
"This can be used to connect a second switcher to support a larger number of inputs. "]], | ||
|
||
output color Out = color(0.1,0.2,0.3), | ||
) | ||
{ | ||
int idx = Index - StartIdx; | ||
|
||
if (Mod) | ||
idx = idx % Mod; | ||
|
||
if (idx < 0 || idx > 9) | ||
{ | ||
Out = Outside; | ||
} | ||
else | ||
{ | ||
#define OUT(X) if (idx == X) { Out = I##X; } else | ||
OUT(0) | ||
OUT(1) | ||
OUT(2) | ||
OUT(3) | ||
OUT(4) | ||
OUT(5) | ||
OUT(6) | ||
OUT(7) | ||
OUT(8) | ||
OUT(9) | ||
Out = Outside; | ||
#undef OUT | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Pick one of five inputs | ||
// Color1of5.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader Color1of5 | ||
[[ string help = "Pick one of 5 inputs", | ||
string label= "1 of 5 (color)", | ||
string category = "Switchers" ]] | ||
( | ||
int Index = 0 | ||
[[ string label = "Input index to use", | ||
string help = "Pick the index (number) of the input to use. "]], | ||
color I0 = color(1.0, 0.5, 0.4) [[ string label = "Input 0" ]], | ||
color I1 = color(1.0, 1.0, 0.4) [[ string label = "Input 1" ]], | ||
color I2 = color(0.5, 1.0, 0.4) [[ string label = "Input 2" ]], | ||
color I3 = color(0.5, 1.0, 1.0) [[ string label = "Input 3" ]], | ||
color I4 = color(1.0, 0.5, 1.0) [[ string label = "Input 4" ]], | ||
|
||
int StartIdx = 0 | ||
[[ string label = "Start Index", | ||
string help = | ||
"Offsets the input index so that this number will map to the first input. " | ||
"E.g. if set to 10, the first input (labeled Input 0) will map to index 10, rather than 0. " | ||
"This is used when cascading multiple switchers into each other and allow them " | ||
"to cover different ranges." ]], | ||
int Mod = 0 | ||
[[ string label = "Range: Number of inputs", | ||
string help = "If 0, returns all outputs and any outside the range uses the 'Outside Range' input. " | ||
"If a nonzero number, only uses that many inputs, repeated in a rotating fashion." ]], | ||
color Outside = 0.0 | ||
[[ string label = "Outside Range", | ||
string help = | ||
"The value to return when the index falls outside the set of available inputs. " | ||
"This can be used to connect a second switcher to support a larger number of inputs. "]], | ||
|
||
output color Out = 0.0, | ||
) | ||
{ | ||
int idx = Index - StartIdx; | ||
|
||
if (Mod) | ||
idx = idx % Mod; | ||
|
||
if (idx < 0 || idx > 4) | ||
{ | ||
Out = Outside; | ||
} | ||
else | ||
{ | ||
#define OUT(X) if (idx == X) { Out = I##X; } else | ||
OUT(0) | ||
OUT(1) | ||
OUT(2) | ||
OUT(3) | ||
OUT(4) | ||
Out = Outside; | ||
#undef OUT | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Adds (and optionaly scales) two colors | ||
// ColorAdd.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader ColorAdd | ||
[[ string help = "Adds (and optionaly scales) two colors", | ||
string label= "Add (color)", | ||
string category = "Math\Color" ]] | ||
( | ||
color A = 0.5 [[ string label = "A" ]], | ||
color B = 0.5 [[ string label = "B" ]], | ||
float A_Amount = 1.0 [[ string label = "A scale" ]], | ||
float B_Amount = 1.0 [[ string label = "B scale" ]], | ||
int Clamp = 0 | ||
[[ string widget="checkBox", string label = "Clamp Result" ]], | ||
|
||
output color Out = 0.0, | ||
) | ||
{ | ||
Out = A*A_Amount + B*B_Amount; | ||
if (Clamp) | ||
Out = clamp(Out, 0.0, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Clamps a color. | ||
// ColorClamp.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader ColorClamp | ||
[[ string help = "Clamps a color", | ||
string label= "Clamp (color)", | ||
string category = "Math\Color" ]] | ||
( | ||
color Input = 0.0, | ||
color Min = 0.0, | ||
color Max = 1.0, | ||
output color Out = 0.0, | ||
) | ||
{ | ||
Out = clamp(Input, Min, Max); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Complements a color. | ||
// ColorComp.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader ColorComp | ||
[[ string help = "Inverts (Complements) a color number (1 - Input)", | ||
string label= "Invert (color)", | ||
string category = "Math\Color" ]] | ||
( | ||
color Input = 0.0, | ||
output color Out = 0.0, | ||
) | ||
{ | ||
Out = 1 - Input; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Divides two colors | ||
// ColorDiv.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader ColorDiv | ||
[[ string help = "Divides two colors", | ||
string label= "Divide (color)", | ||
string category = "Math\Color" ]] | ||
( | ||
color A = 0.5, | ||
color B = 0.5, | ||
int Clamp = 0 | ||
[[ string widget="checkBox", string label = "Clamp Result" ]], | ||
|
||
output color Out = 0.0, | ||
) | ||
{ | ||
Out = A / B; | ||
if (Clamp) | ||
clamp(Out, 0.0, 1.0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Color Channel Juggler Shader | ||
// ColorJuggler.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader ColorJuggler | ||
[[ string help = "A utility to combine or split color components", | ||
string label = "Components (color)", | ||
string category = "Math\Color" ]] | ||
( | ||
color Input = 0.0 [[ string label="Input (RGB)" ]], | ||
float Ri = Input[0] [[ string label="R" ]], | ||
float Gi = Input[1] [[ string label="G" ]], | ||
float Bi = Input[2] [[ string label="B" ]], | ||
output color Out = 0 [[ string label="Out (RGB)" ]], | ||
output float R = 0.0, | ||
output float G = 0.0, | ||
output float B = 0.0 | ||
) | ||
{ | ||
Out = color(Ri,Gi,Bi); | ||
R = Out[0]; | ||
G = Out[1]; | ||
B = Out[2]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Returns the maximum of two colors | ||
// ColorMax.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader ColorMax | ||
[[ string help = "Returns the maximum of two colors", | ||
string label= "Max (color)", | ||
string category = "Math\Color" ]] | ||
( | ||
color A = 0.5, | ||
color B = 0.5, | ||
output color Out = 0.0, | ||
) | ||
{ | ||
Out = max(A, B); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Returns the minimum of two colors | ||
// ColorMin.osl, by Zap Andersson | ||
// Modified: 2018-02-08 | ||
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license | ||
// https://github.com/ADN-DevTech/3dsMax-OSL-Shaders/blob/master/LICENSE.txt | ||
|
||
shader ColorMin | ||
[[ string help = "Returns the minimum of two colors", | ||
string label= "Min (color)", | ||
string category = "Math\Color" ]] | ||
( | ||
color A = 0.5, | ||
color B = 0.5, | ||
output color Out = 0.0, | ||
) | ||
{ | ||
Out = min(A, B); | ||
} |
Oops, something went wrong.