Skip to content
Permalink
Browse files

Add 3dsMax 2020 shader pack

  • Loading branch information...
Zap Andersson
Zap Andersson committed Apr 2, 2019
1 parent 7cf866d commit 062ed95c4b5bcca7dcc915d80660d104ff384f6f
Showing with 1,028 additions and 62 deletions.
  1. +3 −3 3ds Max Shipping Shaders/BlackBody.osl
  2. +5 −5 3ds Max Shipping Shaders/Candy.osl
  3. +3 −4 3ds Max Shipping Shaders/Color1of10.osl
  4. +3 −4 3ds Max Shipping Shaders/Color1of5.osl
  5. +64 −0 3ds Max Shipping Shaders/ColorKey.osl
  6. +26 −0 3ds Max Shipping Shaders/ColorSpace.osl
  7. +12 −6 3ds Max Shipping Shaders/ColorTweak.osl
  8. +127 −5 3ds Max Shipping Shaders/Composite.osl
  9. +40 −0 3ds Max Shipping Shaders/Falloff.osl
  10. +3 −4 3ds Max Shipping Shaders/Float1of10.osl
  11. +3 −4 3ds Max Shipping Shaders/Float1of5.osl
  12. +2 −2 3ds Max Shipping Shaders/GetMtlID.osl
  13. +2 −1 3ds Max Shipping Shaders/GetUVW.osl
  14. +52 −0 3ds Max Shipping Shaders/Halftone.osl
  15. +3 −2 3ds Max Shipping Shaders/IdxRndCol.osl
  16. +3 −2 3ds Max Shipping Shaders/IdxRndFlt.osl
  17. +3 −2 3ds Max Shipping Shaders/IdxRndVec.osl
  18. +18 −0 3ds Max Shipping Shaders/MatCapUV.osl
  19. +21 −0 3ds Max Shipping Shaders/Normal.osl
  20. +17 −2 3ds Max Shipping Shaders/OSLBitmap.osl
  21. +22 −10 3ds Max Shipping Shaders/RandomBitmap.osl
  22. +26 −0 3ds Max Shipping Shaders/RandomIndex.osl
  23. +49 −0 3ds Max Shipping Shaders/SimpleGradient.osl
  24. +238 −0 3ds Max Shipping Shaders/SimpleTiles.osl
  25. +44 −0 3ds Max Shipping Shaders/Threads.osl
  26. +23 −0 3ds Max Shipping Shaders/ToonWidth.osl
  27. +28 −0 3ds Max Shipping Shaders/TriTone.osl
  28. +19 −3 3ds Max Shipping Shaders/UberBitmap.osl
  29. +55 −0 3ds Max Shipping Shaders/Waveform.osl
  30. +112 −0 3ds Max Shipping Shaders/Weave.osl
  31. +2 −3 OSL/ADN-Stable/File1of10.osl
@@ -1,6 +1,6 @@
// Blackbody Color Shader
// Blackbody.osl, by Zap Andersson
// Modified: 2018-02-08
// Modified: 2018-12-09
// 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

@@ -16,7 +16,7 @@ shader Blackbody
)
{
Col = blackbody(mix(Min, Max, Input));
if (Normalize)
Col = normalize(Col);
if (Normalize)
Col = normalize(vector(Col));
Col *= Intensity;
}
@@ -3,7 +3,7 @@
// very cool random candy cover...
//
// Candy.osl, by Zap Andersson
// Modified: 2018-02-08
// Modified: 2018-09-25
// 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

@@ -30,7 +30,7 @@ shader Candy
point pnt = UVW / Scale;
float pri = -1;

// Sandard method for randomization:
// Standard method for randomization:
// Go through a 3x3x3 grid that we offset
for (float x = -1; x <= 1; x++)
{
@@ -41,10 +41,10 @@ shader Candy
// Point that sources all our randomization
// We run these through cell noises to get
// random values
point rndpoint = pnt + point(x, y, z);

// MAXX-44914 fix: Adds the 0.001 offset and floor()
point rndpoint = floor(pnt) + point(x, y, z) + 0.001;
// Compute a center
point dotcenter = floor(rndpoint) + noise("cell", rndpoint, 1);
point dotcenter = 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
@@ -1,6 +1,6 @@
// Pick one of ten inputs
// Color1of10.osl, by Zap Andersson
// Modified: 2018-02-08
// Modified: 2018-12-11
// 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

@@ -10,8 +10,7 @@ shader Color1of10
string category = "Switchers" ]]
(
int Index = 0
[[ string label = "Input index to use",
string help = "Pick the index (number) of the input 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" ]],
@@ -28,7 +27,7 @@ shader Color1of10
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 "
"This is used when cascading multiple switchers into each other and allows them "
"to cover different ranges." ]],
int Mod = 0
[[ string label = "Range: Number of inputs",
@@ -1,6 +1,6 @@
// Pick one of five inputs
// Color1of5.osl, by Zap Andersson
// Modified: 2018-02-08
// Modified: 2018-12-11
// 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

@@ -10,8 +10,7 @@ shader Color1of5
string category = "Switchers" ]]
(
int Index = 0
[[ string label = "Input index to use",
string help = "Pick the index (number) of the input 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" ]],
@@ -23,7 +22,7 @@ shader Color1of5
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 "
"This is used when cascading multiple switchers into each other and allows them "
"to cover different ranges." ]],
int Mod = 0
[[ string label = "Range: Number of inputs",
@@ -0,0 +1,64 @@
// Color-Key shader for green/bluescreen
// ColorKey.osl, by Zap Andersson
// Modified: 2019-01-03
// Copyright 2019 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 ColorKey
[[ string label = "Color Key",
string help="<font size=+1><b>Color Key</b></font><br>A simple color key shader for rough green/bluescreen<br>keying. Can do simple edge cutoffs in UV space<br>and apply a garbage mask if needed." ]]
(
// Inputs
color Input = 0.0
[[ string label = "Input Image",
string help = "Connect the input image you want to key here." ]],
color KeyColor = color(0,1,0)
[[ string label = "Key Color",
string help = "The color to key. Ideally, pick it from the image to be keyed, in the middle of the color range to be keyed." ]],
color Mask = color(1.0 * 1.0)
[[ string label = "Mask",
string help = "Connect any garbage mask here." ]],
color Fill = 0.0
[[ string label = "Fill Color",
string help = "The color to fill out the keyed out area with." ]],
float Low = 0.5
[[ string label = "Low Cutoff",
string help = "The low cutoff of the color difference." ]],
float High = 0.7
[[ string label = "High Cutoff",
string help = "The high cutoff of the color difference." ]],
float Gamma = 1.0
[[ string label = "Computation Gamma",
string help = "Tweaks the color range midtones before computing the difference. "
"Trying different values here and adjusting the High/Low cutoff can yeild a better result. " ]],
point UVW = point(u,v,0)
[[ string label = "UV Input",
string help = "UV Input (defaults to map channel 1)" ]],
float LowU = 0.0
[[ string label = "U Cutoff",
string help = "Low edge of simple 2d cutoff in U direction" ]],
float HighU = 1.0
[[ string label = "U Cutoff",
string help = "High edge of simple 2d cutoff in U direction" ]],
float LowV = 0.0
[[ string label = "V Cutoff",
string help = "Low edge of simple 2d cutoff in V direction" ]],
float HighV = 1.0
[[ string label = "V Cutoff",
string help = "High edge of simple 2d cutoff in U direction" ]],
// Outputs
output color Col = 0.0,
output float Key = 0.0,
)
{
float x = distance(pow(Input, Gamma), pow(KeyColor, Gamma));

if (UVW[0] > LowU && UVW[0] < HighU &&
UVW[1] > LowV && UVW[1] < HighV)
{
Key = smoothstep(Low, High, x) * luminance(Mask);
Col = Input * Key;
}

Col = mix(Fill, Input, Key);
}
@@ -0,0 +1,26 @@
// ColorSpace shader
// ColorSpace.osl, by Changsoo Eun, adapted by Zap Andersson
// Modified: 2018-12-10
// 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 ColorSpace
[[ string help = "Convert RGB / HSV / YIQ / XYZ / xyY",
string label = "Color Space",
string category = "Math\Color" ]]
(
string FromSpace = "hsv"
[[ string widget = "mapper",
string options = "rgb:rgb|hsv (hue, saturation, and value):hsv|hsl (hue, saturation, and lightness):hsl|YIQ (for the NTSC television standard):YIQ|XYZ (CIE XYZ coordinates):XYZ|xyY (CIE xyY coordinates):xyY",
string label = "From space:"]],
string ToSpace = "rgb"
[[ string widget = "mapper",
string options = "rgb:rgb|hsv (hue, saturation, and value):hsv|hsl (hue, saturation, and lightness):hsl|YIQ (for the NTSC television standard):YIQ|XYZ (CIE XYZ coordinates):XYZ|xyY (CIE xyY coordinates):xyY",
string label = "To space:"]],

vector In = 0.0,
output color Out = 0.0,
)
{
Out = transformc(FromSpace , ToSpace, In);
}
@@ -1,12 +1,12 @@
// Tweak a color.
// ColorTweak.osl, by Zap Andersson
// Modified: 2018-02-08
// Copyright 2018 Autodesk Inc, All rights reserved. This file is licensed under Apache 2.0 license
// Modified: 2019-01-04
// Copyright 2019 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 ColorTweak
[[ string help = "Tweaks a color",
string label= "Tweak (color)",
[[ string help = "Tweaks a color (Levels)",
string label= "Tweak/Levels (color)",
string category = "Math\Color" ]]
(
color Input = 0.0,
@@ -17,12 +17,15 @@ shader ColorTweak
[[ string help = "The input value that maps to the darkest output. Incoming black level. " ]],
color InputMax = 1.0
[[ string help = "The input value that maps to the brightst output. Incoming white level. " ]],
float MidTones = 1.0
[[ string help = "Adjusts the MidTones/Gamma.",
float min = 0.01, float max = 9.99 ]],
color OutputMin = 0.0
[[ string help = "The output black level." ]],
color OutputMax = 1.0
[[ string help = "The output white level." ]],

int Clamp = 0
int Clamp = 1
[[ string widget = "checkBox",
string help = "Clamp the output to the 0-1 range for each component" ]],

@@ -41,5 +44,8 @@ shader ColorTweak
// Convert back to RGB
col = transformc("hsv", "rgb", hsv);

Out = mix(OutputMin, OutputMax, col);
Out = mix(OutputMin, OutputMax, pow(col, 1.0/MidTones));

if (Clamp)
Out = clamp(Out, 0.0, 1.0);
}
@@ -1,6 +1,6 @@
// Alpha-composits one color over another
// Composite.osl, by Zap Andersson
// Modified: 2018-02-08
// Composite.osl, by Zap Andersson & Changsoo Eun
// Modified: 2018-02-11
// 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

@@ -17,6 +17,13 @@ shader Composite
[[ string label = "Bottom layer RGB" ]],
float BottomA = 1.0
[[ string label = "Bottom layer Alpha" ]],

string BlendMode = "Normal"
[[ string widget = "popup",
string help = "Normal, Average, Darken, Multiply, Color Burn, Linear Burn, Lighten, Screen, Color Dodge, Linear Dodge, Spotlight, Spotlight Blend, Overlay, Hard Light, Soft Light, Pin Light, Hard Mix, Difference, Exclusion, Subtract, Divide, Hue, Saturation, Color, Value",
string options = "Normal|Average|Darken|Multiply|Color Burn|Linear Burn|Lighten|Screen|Color Dodge|Linear Dodge|Spotlight|Spotlight Blend|Overlay|Hard Light|Soft Light|Pin Light|Hard Mix|Difference|Exclusion|Subtract|Divide|Hue|Saturation|Color|Value",
string label = "Blend Mode",
int editable = 0 ]],

int Premult = 0
[[ string widget="checkBox", string label = "Premultiplied Alpha", string help = "Assume top layer has premultiplied Alpha" ]],
@@ -28,16 +35,131 @@ shader Composite
output float Alpha = 1.0,
)
{
// Put in bottom layers contribution
// Put in bottom layer's contribution
Out = BottomRGB * (1.0 - TopA);
Alpha = BottomA * (1.0 - TopA);

// Blend mode code courtesy of Changsoo Eun
color blended = 0.0;
if (BlendMode == "Normal")
blended = TopRGB;
else if (BlendMode == "Average")
blended = (BottomRGB+TopRGB)/2.0;
else if (BlendMode == "Darken")
blended = min(BottomRGB, TopRGB);
else if (BlendMode == "Multiply")
blended = (BottomRGB * TopRGB);
else if (BlendMode == "Color Burn"){
if (TopRGB == 0.0)
blended = TopRGB;
else
blended = max(1.0 - (1.0 - BottomRGB) / TopRGB, 0.0);
}
else if (BlendMode == "Linear Burn")
blended = max((BottomRGB + TopRGB - 1.0), color (0.0));
else if (BlendMode == "Lighten")
blended = max(BottomRGB, TopRGB);
else if (BlendMode == "Screen")
blended = TopRGB + BottomRGB - TopRGB * BottomRGB;
else if (BlendMode == "Color Dodge"){
if (TopRGB == color (1.0))
blended = color (1.0);
else
blended = min(BottomRGB / (1.0 - TopRGB), color (1.0));
}
else if (BlendMode == "Linear Dodge")
blended = min((BottomRGB + TopRGB), color (1.0));
else if (BlendMode == "Spotlight")
blended = min(2.0 * TopRGB * BottomRGB, 1.0);
else if (BlendMode == "Spotlight Blend")
blended = min(TopRGB * BottomRGB + BottomRGB, 1.0);
else if (BlendMode == "Overlay"){
float BottomRGBl = luminance (BottomRGB);
if (BottomRGBl <= 0.5)
blended = (2.0 * BottomRGB * TopRGB);
else
blended = (1.0 - 2.0 * (1.0 - TopRGB) * (1.0 - BottomRGB));
}
else if (BlendMode == "Soft Light"){
float TopRGBl = luminance (TopRGB);
if (TopRGBl <= 0.5)
blended = BottomRGB * (BottomRGB + 2.0 * TopRGB * (1.0 - BottomRGB));
else
blended = BottomRGB + (2.0 * TopRGB - 1.0) * (sqrt(BottomRGB) - BottomRGB);
}
else if (BlendMode == "Hard Light"){
float TopRGBl = luminance (TopRGB);
if (TopRGBl <= 0.5)
blended = 2.0 * TopRGB * BottomRGB;
else
blended = 1.0 - 2.0 * (1.0 - TopRGB) * (1.0 - BottomRGB);
}
else if (BlendMode == "Pin Light"){
float PinLight (float b, float a){
if ((a > 0.5 && a > b) || (a < 0.5 && a < b))
return a;
else
return b;
}
blended[0] = PinLight (BottomRGB[0], TopRGB[0]);
blended[1] = PinLight (BottomRGB[1], TopRGB[1]);
blended[2] = PinLight (BottomRGB[2], TopRGB[2]);
}
else if (BlendMode == "Hard Mix"){
float HardMix (float b, float a){
if ((a + b) <= 1.0)
return 0.0;
else
return 1.0;
}
blended[0] = HardMix (BottomRGB[0], TopRGB[0]);
blended[1] = HardMix (BottomRGB[1], TopRGB[1]);
blended[2] = HardMix (BottomRGB[2], TopRGB[2]);
}
else if (BlendMode == "Difference"){
float Difference (float b, float a){
return abs(a - b);
}
blended[0] = Difference (BottomRGB[0], TopRGB[0]);
blended[1] = Difference (BottomRGB[1], TopRGB[1]);
blended[2] = Difference (BottomRGB[2], TopRGB[2]);
}
else if (BlendMode == "Exclusion"){
blended = TopRGB + BottomRGB - 2.0 * TopRGB * BottomRGB;
}
else if (BlendMode == "Subtract"){
blended = max(BottomRGB - TopRGB, 0.0);
}
else if (BlendMode == "Divide"){
blended = BottomRGB / TopRGB;
}
else if (BlendMode == "Hue"){
vector hsvBottomRGB = transformc ("hsv", BottomRGB);
vector hsvTopRGB = transformc ("hsv", TopRGB);
blended = color ("hsv", hsvTopRGB[0], hsvBottomRGB[1], hsvBottomRGB[2]);
}
else if (BlendMode == "Saturation"){
vector hsvBottomRGB = transformc ("hsv", BottomRGB);
vector hsvTopRGB = transformc ("hsv", TopRGB);
blended = color ("hsv", hsvBottomRGB[0], hsvTopRGB[1], hsvBottomRGB[2]);
}
else if (BlendMode == "Color"){
vector hsvBottomRGB = transformc ("hsv", BottomRGB);
vector hsvTopRGB = transformc ("hsv", TopRGB);
blended = color ("hsv", hsvTopRGB[0], hsvTopRGB[1], hsvBottomRGB[2]);
}
else if (BlendMode == "Value"){
vector hsvBottomRGB = transformc ("hsv", BottomRGB);
vector hsvTopRGB = transformc ("hsv", TopRGB);
blended = color ("hsv", hsvBottomRGB[0], hsvBottomRGB[1], hsvTopRGB[2]);
}

// If premultiplied mode, we assume alpha is already multiplied into
// the RGB values of the top layer, and top layer should be added as-is
float topmul = Premult?1.0:TopA;

// Put in top layers contribution
Out += TopRGB * topmul;
// Put in top layer's contribution
Out += blended * topmul;
Alpha += TopA;

// Clamp, to stay within sanity
Oops, something went wrong.

0 comments on commit 062ed95

Please sign in to comment.
You can’t perform that action at this time.