Feedback

Please leave feedback and comments. I am always interested to hear how people get on using these LScripts!

Thursday, 19 December 2013

LScript - Image_Fluff&Dust


LScript (Layout) applies dirt,dust and fluff to rendered frames like on old film.

Changes
  • Added presets
  • Updated interface

Compatible with Newtek LightWave 9.6 and above.

// LScript Image Filter - www.StephenCulley.co.uk
//
// web   address: http://www.stephenculley.co.uk
// email address: email@stephenculley.co.uk

/*  
    LScript Image Filter - Fluff & Dust
    Image_Fluff&Dust.ls

*/

@version 2.5
@warnings
@script image
@name *Fluff & Dust

    // Title
    sTitle = "*Fluff & Dust";

    // Version
    sVersion = "v1.0";

    // Variable
    Global_nOpacity = 1.0;

    Dust_bEnable = true;
    Dust_vColor = <0,0,0>;
    Dust_iAmount = 25000; 
    Dust_nOpacity = 0.2;
    Dust_nMinSize = 0.1;
    Dust_nMaxSize = 1.0;

    Dirt_bEnable = true;
    Dirt_vColor = <0,0,0>;
    Dirt_iFrequency = 1;
    Dirt_iAmount = 500;
    Dirt_nOpacity = 0.1;
    Dirt_nMinSize = 1.0;
    Dirt_nMaxSize = 10.0;

    Fluff_bEnable = true;
    Fluff_vColor = <0,0,0>;
    Fluff_iFrequency = 1;
    Fluff_iMinAmount = 1;
    Fluff_iMaxAmount = 9;
    Fluff_iMinLength = 50;
    Fluff_iMaxLength = 100;
    Fluff_nMinOpacity = 0.05;
    Fluff_nMaxOpacity = 0.5;
    Fluff_nMinSize = 0.1;
    Fluff_nMaxSize = 1.0;     

    // Control
    ctrl_dust0,ctrl_dust1,ctrl_dust2,ctrl_dust3,ctrl_dust4,ctrl_dust5,
    ctrl_dirt0,ctrl_dirt1,ctrl_dirt2,ctrl_dirt3,ctrl_dirt4,ctrl_dirt5,ctrl_dirt6,
    ctrl_fluff0,ctrl_fluff1,ctrl_fluff2,ctrl_fluff3,ctrl_fluff4,ctrl_fluff5,ctrl_fluff6,ctrl_fluff7,ctrl_fluff8,ctrl_fluff9,ctrl_fluff10;

create
{
    setdesc(sTitle);
}

process: ifo
{

// Dust

    if(Dust_bEnable == true)
      {

      if(runningUnder() != SCREAMERNET) moninit(Dust_iAmount);

      vColor = Dust_vColor * (1/255);
      for(a = 1;a <= Dust_iAmount;++a)
        {
        v = ;
        circleenhancedIFO(ifo,
                          v, // Vector
                          max(Dust_nMinSize,randu() * Dust_nMaxSize), // Size
                          0.0,// fade
                          vColor.x,vColor.y,vColor.z, // Color
                          Dust_nOpacity * Global_nOpacity); // Opacity    

        if(runningUnder() != SCREAMERNET) if(monstep()) return;

        }
      }

// Dirt

    if(random(1,Dirt_iFrequency) == 1 && Dirt_bEnable == true)
      {

      if(runningUnder() != SCREAMERNET) moninit(Dirt_iAmount);

      vColor = Dirt_vColor * (1/255);
      for(a = 1;a <= Dirt_iAmount;++a)
      {
      v = ;
      circleenhancedIFO(ifo,
                        v, // Vector
                        max(Dirt_nMinSize,randu() * Dirt_nMaxSize), // Size
                        0.0,// fade
                        vColor.x,vColor.y,vColor.z, // Color
                        Dirt_nOpacity * Global_nOpacity); // Opacity    

      if(runningUnder() != SCREAMERNET) if(monstep()) return;

      }
    }

// Fluff

    if(random(1,Fluff_iFrequency) == 1 && Fluff_bEnable == true)
      {
      Fluff_iAmount = random(Fluff_iMinAmount,Fluff_iMaxAmount);

      if(runningUnder() != SCREAMERNET) moninit(Fluff_iAmount);

      vColor = Fluff_vColor * (1/255);
      for(a = 1;a <= Fluff_iAmount;++a)
        {
        iL = random(Fluff_iMinLength,Fluff_iMaxLength);
        s2 = max(Fluff_nMinSize,randu() * Fluff_nMaxSize); 
        v2 = ;
        o2 = max(Fluff_nMinOpacity,randu() * Fluff_nMaxOpacity);  
        for(l = 1;l <= iL;++l)
          {
          s1 = s2; 
          v1 = v2;
          s2 = max(Fluff_nMinSize,randu() * Fluff_nMaxSize); 
          v2 = ;
          o1 = o2; 
          o2 = max(Fluff_nMinOpacity,randu() * Fluff_nMaxOpacity); 
          lineenhancedIFO(ifo,
                          v1, // Vector
                          v2, // Vector
                          s1, // Size
                          s2, // Size
                          vColor.x,vColor.y,vColor.z, // Color
                          o1 * Global_nOpacity, // Opacity
                          vColor.x,vColor.y,vColor.z, // Color
                          o2 * Global_nOpacity); // Opacity
          }

        if(runningUnder() != SCREAMERNET) if(monstep()) return;

        }
      }

}

// IFO

circleenhancedIFO: ifo,v,s,f,r,g,b,o // vector,size,fade,red,green,blue,opacity
{
    // Size <= 1
    if(s <= 1)
      {
      o *= s;
      if (v.x >= 1 && v.x <= ifo.width && v.y >= 1 && v.y <= ifo.height)
        { 
        if(o >= 1.0)
          {
          ifo.red[v.x,v.y] = r;
          ifo.green[v.x,v.y] = g;
          ifo.blue[v.x,v.y] = b;
          }
        else if(o > 0.0)
          {
          ifo.red[v.x,v.y] = (ifo.red[v.x,v.y] * (1-o)) + (r * o);
          ifo.green[v.x,v.y] = (ifo.green[v.x,v.y] * (1-o)) + (g * o);
          ifo.blue[v.x,v.y] = (ifo.blue[v.x,v.y] * (1-o)) + (b * o);
          }
        }
      return; 
      }
    // Half Size
    s *= 0.5; 
    // Grid
    x0 = floor(v.x - s - 1);
    y0 = floor(v.y - s - 1);
    x1 = floor(v.x + s + 1);
    y1 = floor(v.y + s + 1);
    // Offscreen
    if(x1 < 1 || x0 > ifo.width){break;}
    if(y1 < 1 || y0 > ifo.height){break;}
    // Grid
    if(x0 < 1){x0 = 1;}
    if(y0 < 1){y0 = 1;}
    if(x1 > ifo.width){x1 = ifo.width;}
    if(y1 > ifo.height){y1 = ifo.height;}
    // Fade
    _f = s * f;
    // Draw
    for(y = y0;y <= y1;++y)
      {
      for(x = x0;x <= x1;++x)
        {
        // Opacity          
        _o = 0.0;
        d = distance2D(v,);
        f_01 = maprange01(_f,s,d);        
        if(f_01 <= 0.0){_o = o;} // Inside
        else if(f_01 <= 1.0)
          {
          _o = o * (1 - f_01);
   }      
        if(_o >= 1.0)
          {
          ifo.red[x,y] = r;
          ifo.green[x,y] = g;
          ifo.blue[x,y] = b;
          }
        else if (_o > 0.0)
          {
          ifo.red[x,y] = (ifo.red[x,y] * (1-_o)) + (r * _o);
          ifo.green[x,y] = (ifo.green[x,y] * (1-_o)) + (g * _o);
          ifo.blue[x,y] = (ifo.blue[x,y] * (1-_o)) + (b * _o);
          }
        }
      }
}

lineenhancedIFO: ifo,v1,v2,s1,s2,r1,g1,b1,o1,r2,g2,b2,o2 // vector1,vector2,size1,size2,red1,green1,blue1,opacity1,red2,green2,blue2,opacity2
{
    // Size < 1
    if(s1 < 1){o1 *= s1;}
    if(s2 < 1){o2 *= s2;}
    // Half Size
    s1 *= 0.5;
    s2 *= 0.5;
    // Interpolation
    d = distance2D(v1,v2);
    if(d <> 0.0)
      {
      vInt = (v2 - v1) * (1 / d);
      sInt = (s2 - s1) * (1 / d);
      rInt = (r2 - r1) * (1 / d);
      gInt = (g2 - g1) * (1 / d);
      bInt = (b2 - b1) * (1 / d);
      oInt = (o2 - o1) * (1 / d);
      }
    else
      {
      vInt = <0.0,0.0,0.0>;
      sInt = max(s1,s2);
      rInt = max(r1,r2);
      gInt = max(g1,g2);
      bInt = max(b1,b2);
      oInt = max(o1,o2);
      }
    // Clip
    cx0 = -1.0;
    cy0 = -1.0;
    cx1 = -1.0;
    cy1 = -1.0;
    // Offset
    vOffset = @ <0.0,0.0,0.0>,<-0.25,-0.25,0.0>,<0.25,-0.25,0.0>,<-0.25,0.25,0.0>,<0.25,0.25,0.0> @;
    // Draw
    for(i = 0;i <= floor(d);++i)
      {
      // Interpolate
      v = v1 + (vInt * i);
      s = s1 + (sInt * i);
      r = r1 + (rInt * i);
      g = g1 + (gInt * i);
      b = b1 + (bInt * i);
      o = o1 + (oInt * i);
      // Grid
      x0 = floor(v.x - s - 1);
      y0 = floor(v.y - s - 1);
      x1 = floor(v.x + s + 1);
      y1 = floor(v.y + s + 1);
      if(x0 < 1){x0 = 1;}
      if(y0 < 1){y0 = 1;}
      if(x1 > ifo.width){x1 = ifo.width;}
      if(y1 > ifo.height){y1 = ifo.height;}
      // Draw
      for(y = y0;y <= y1;++y)
        {
        for(x = x0;x <= x1;++x)
          {
          if (x >= 1 && x <= ifo.width && y >= 1 && y <= ifo.height)
            { 
            if(clip2D(,cx0,cy0,cx1,cy1) == true)
              {               
              // Opacity          
              _o = 0.0;
              ld = linedistance2D(,v1,v2);
              if(ld < (s - 1)){_o = o;} // Inside
              else if(ld <= (s + 1))
                {
                smo = 0;
                for(sm = 1;sm <= 5;++sm)
                  {              
                 if(linedistance2D( + vOffset[sm],v1,v2) <= s){++smo;} 
                  }
                if(smo > 0.0){_o = o * (0.2 * smo);}else{_o = 0.0;}
                }
              if(_o >= 1.0)
                {
                ifo.red[x,y] = r;
                ifo.green[x,y] = g;
                ifo.blue[x,y] = b;
                }
              else if (_o > 0.0)
                {
                ifo.red[x,y] = (ifo.red[x,y] * (1-_o)) + (r * _o);
                ifo.green[x,y] = (ifo.green[x,y] * (1-_o)) + (g * _o);
                ifo.blue[x,y] = (ifo.blue[x,y] * (1-_o)) + (b * _o);
                }
              }
            }
          }
        }       
      // Update Clip
      cx0 = x0; 
      cy0 = y0; 
      cx1 = x1; 
      cy1 = y1; 
      }
}

// MAP RANGE

maprange01: n1,n2,i
{    
    if(n2-n1 == 0.0){return(0.0);}
  else
    {return((1/(n2-n1)) * (i-n1));}
}

// VECTOR 2D

clip2D: v,x0,y0,x1,y1 // b
{
    if((v.x >= x0) && (v.x <= x1) && (v.y >= y0) && (v.y <= y1)){return(false);}
  else
    return(true);
}

distance2D: v1, v2 // n
{
    // Vector
    return(sqrt(((v2.x - v1.x) * (v2.x - v1.x)) +
                ((v2.y - v1.y) * (v2.y - v1.y))));
}

linedistance2D: v1,v2,v3 // n
{
    // Vector v1 from line v2 to v3
    nSqrLineMagnitude = sqrlinemagnitude2D(v2,v3);
    if(nSqrLineMagnitude < 0.00000000000001)
      {
      return(-1.0);
      }
    u = ((v1.x - v2.x) * (v3.x - v2.x) + (v1.y - v2.y) * (v3.y - v2.y)) / nSqrLineMagnitude;
    if(u < 0.0000001 or u > 1)
      {
      x = distance2D(v1,v2);
      y = distance2D(v1,v3);
      return(min(x,y));
      }
    else
      {
      x = v2.x + u * (v3.x - v2.x);
      y = v2.y + u * (v3.y - v2.y);
      return(distance2D(v1,));
      }
}

sqrlinemagnitude2D: v1,v2 // n
{
    return((v2.x - v1.x) * (v2.x - v1.x) + (v2.y - v1.y) * (v2.y - v1.y));
}

//

load: what,io
{
    if(what == SCENEMODE)
    {
        if(io.read().asStr() == sTitle + " " + sVersion)
            {
            // Global
            Global_nOpacity = io.read().asNum();

            // Dust
            Dust_bEnable = io.read().asInt();
            Dust_vColor = io.read().asVec();
            Dust_iAmount = io.read().asInt();
            Dust_nOpacity = io.read().asNum();
            Dust_nMinSize = io.read().asNum();
            Dust_nMaxSize = io.read().asNum();

            // Dirt
            Dirt_bEnable = io.read().asInt();
            Dirt_vColor = io.read().asVec();
            Dirt_iFrequency = io.read().asInt();
            Dirt_iAmount = io.read().asInt();
            Dirt_nOpacity = io.read().asNum();
            Dirt_nMinSize = io.read().asNum();
            Dirt_nMaxSize = io.read().asNum();

            // Fluff
            Fluff_bEnable = io.read().asInt();
            Fluff_vColor = io.read().asVec();
            Fluff_iFrequency = io.read().asInt();
            Fluff_iMinAmount = io.read().asInt();
            Fluff_iMaxAmount = io.read().asInt();
            Fluff_iMinLength = io.read().asInt();
            Fluff_iMaxLength = io.read().asInt();
            Fluff_nMinOpacity = io.read().asNum();
            Fluff_nMaxOpacity = io.read().asNum();
            Fluff_nMinSize = io.read().asNum();
            Fluff_nMaxSize = io.read().asNum();
            }
    }
}

save: what,io
{
    if(what == SCENEMODE)
    {
        // Header
        io.writeln(sTitle + " " + sVersion);

        // Global
        io.writeln(Global_nOpacity);

        // Dust
        io.writeln(Dust_bEnable);
        io.writeln(Dust_vColor);
        io.writeln(Dust_iAmount); 
        io.writeln(Dust_nOpacity);
        io.writeln(Dust_nMinSize);
        io.writeln(Dust_nMaxSize);

        // Dirt
        io.writeln(Dirt_bEnable);
        io.writeln(Dirt_vColor);
        io.writeln(Dirt_iFrequency);
        io.writeln(Dirt_iAmount);
        io.writeln(Dirt_nOpacity);
        io.writeln(Dirt_nMinSize);
        io.writeln(Dirt_nMaxSize);

        // Fluff
        io.writeln(Fluff_bEnable);
        io.writeln(Fluff_vColor);
        io.writeln(Fluff_iFrequency);
        io.writeln(Fluff_iMinAmount);
        io.writeln(Fluff_iMaxAmount);
        io.writeln(Fluff_iMinLength);
        io.writeln(Fluff_iMaxLength);
        io.writeln(Fluff_nMinOpacity);
        io.writeln(Fluff_nMaxOpacity);
        io.writeln(Fluff_nMinSize);
        io.writeln(Fluff_nMaxSize);   
    }
}

options
{
    reqbegin(sTitle + " " + sVersion);
    reqsize(340,402);

    // Control

    // Preset
    ctrl_pr0 = ctlpopup("Preset",1, @"Projected Film (Dirty)",
                                     "Dust (Light)",
                                     "Dust & Dirt (Heavy)",
                                     "Fluff"@);

    // Global
    ctlsep();
    ctrl_g0 = ctlnumber("Global Opacity",Global_nOpacity);
    ctlsep();
    ctrl_tab = ctltab("Dust","Dirt","Fluff","Developer");

    // Dust
    ctrl_dust0 = ctlcheckbox("Enable",Dust_bEnable);
    ctrl_dust1 = ctlcolor("Color",Dust_vColor);
    ctrl_dust2 = ctlinteger("Amount",Dust_iAmount);
    ctrl_dust3 = ctlnumber("Opacity",Dust_nOpacity);
    ctrl_dust4 = ctlnumber("Min Size",Dust_nMinSize);
    ctrl_dust5 = ctlnumber("Max Size",Dust_nMaxSize);

    ctlposition(ctrl_dust0,36,104,172,20,100);
    ctlposition(ctrl_dust1,36,134,212,20,100);
    ctlposition(ctrl_dust2,36,158,212,20,100);
    ctlposition(ctrl_dust3,36,180,212,20,100);
    ctlposition(ctrl_dust4,36,204,212,20,100);
    ctlposition(ctrl_dust5,36,228,212,20,100);

    ctlpage(1,ctrl_dust0,ctrl_dust1,ctrl_dust2,ctrl_dust3,
              ctrl_dust4,ctrl_dust5);

    // Dirt
    ctrl_dirt0 = ctlcheckbox("Enable",Dirt_bEnable);
    ctrl_dirt1 = ctlcolor("Color",Dirt_vColor);
    ctrl_dirt2 = ctlinteger("Frequency (1 = on)",Dirt_iFrequency);
    ctrl_dirt3 = ctlinteger("Amount",Dirt_iAmount);
    ctrl_dirt4 = ctlnumber("Opacity",Dirt_nOpacity);
    ctrl_dirt5 = ctlnumber("Min Size",Dirt_nMinSize);
    ctrl_dirt6 = ctlnumber("Max Size",Dirt_nMaxSize);

    ctlposition(ctrl_dirt0,36,104,172,20,100);
    ctlposition(ctrl_dirt1,36,134,212,20,100);
    ctlposition(ctrl_dirt2,36,158,212,20,100);
    ctlposition(ctrl_dirt3,36,180,212,20,100);
    ctlposition(ctrl_dirt4,36,204,212,20,100);
    ctlposition(ctrl_dirt5,36,228,212,20,100);
    ctlposition(ctrl_dirt6,36,252,212,20,100);

    ctlpage(2,ctrl_dirt0,ctrl_dirt1,ctrl_dirt2,ctrl_dirt3,
              ctrl_dirt4,ctrl_dirt5,ctrl_dirt6);

    // Fluff
    ctrl_fluff0 = ctlcheckbox("Enable",Fluff_bEnable);
    ctrl_fluff1 = ctlcolor("Color",Fluff_vColor);
    ctrl_fluff2 = ctlinteger("Frequency (1 = on)",Fluff_iFrequency);
    ctrl_fluff3 = ctlinteger("Min Amount",Fluff_iMinAmount);
    ctrl_fluff4 = ctlinteger("Max Amount",Fluff_iMaxAmount);
    ctrl_fluff5 = ctlinteger("Min Length",Fluff_iMinLength);
    ctrl_fluff6 = ctlinteger("Max Length",Fluff_iMaxLength);
    ctrl_fluff7 = ctlnumber("Min Opacity",Fluff_nMinOpacity);
    ctrl_fluff8 = ctlnumber("Max Opacity",Fluff_nMaxOpacity);
    ctrl_fluff9 = ctlnumber("Min Size",Fluff_nMinSize);
    ctrl_fluff10 = ctlnumber("Max Size",Fluff_nMaxSize);

    ctlposition(ctrl_fluff0,36,104,172,20,100);
    ctlposition(ctrl_fluff1,36,134,212,20,100);
    ctlposition(ctrl_fluff2,36,158,212,20,100);
    ctlposition(ctrl_fluff3,36,180,212,20,100);
    ctlposition(ctrl_fluff4,36,204,212,20,100);
    ctlposition(ctrl_fluff5,36,228,212,20,100);
    ctlposition(ctrl_fluff6,36,252,212,20,100);
    ctlposition(ctrl_fluff7,36,276,212,20,100);
    ctlposition(ctrl_fluff8,36,300,212,20,100);
    ctlposition(ctrl_fluff9,36,324,212,20,100);
    ctlposition(ctrl_fluff10,36,348,212,20,100);

    ctlpage(3,ctrl_fluff0,ctrl_fluff1,ctrl_fluff2,ctrl_fluff3,ctrl_fluff4,ctrl_fluff5,
              ctrl_fluff6,ctrl_fluff7,ctrl_fluff8,ctrl_fluff9,ctrl_fluff10);

    // Developer
    ctrl_dev = ctltext("","developer: Stephen Culley","http://www.stephenculley.co.uk");
    ctlposition(ctrl_dev,120,120,280,20,100);
    ctlpage(4,ctrl_dev);

    // Refresh
    ctlrefresh(ctrl_pr0,"refresh_preset"); // Preset

    return if !reqpost();

    Global_nOpacity = getvalue(ctrl_g0);

    Dust_bEnable = getvalue(ctrl_dust0);
    Dust_vColor = getvalue(ctrl_dust1);
    Dust_iAmount = getvalue(ctrl_dust2);
    Dust_nOpacity = getvalue(ctrl_dust3); 
    Dust_nMinSize = getvalue(ctrl_dust4); 
    Dust_nMaxSize = getvalue(ctrl_dust5); 

    Dirt_bEnable = getvalue(ctrl_dirt0);
    Dirt_vColor = getvalue(ctrl_dirt1);
    Dirt_iFrequency = getvalue(ctrl_dirt2);
    Dirt_iAmount = getvalue(ctrl_dirt3);
    Dirt_nOpacity = getvalue(ctrl_dirt4); 
    Dirt_nMinSize = getvalue(ctrl_dirt5); 
    Dirt_nMaxSize = getvalue(ctrl_dirt6); 

    Fluff_bEnable = getvalue(ctrl_fluff0);
    Fluff_vColor = getvalue(ctrl_fluff1);
    Fluff_iFrequency = getvalue(ctrl_fluff2);
    Fluff_iMinAmount = getvalue(ctrl_fluff3);
    Fluff_iMaxAmount = getvalue(ctrl_fluff4);
    Fluff_iMinLength = getvalue(ctrl_fluff5);
    Fluff_iMaxLength = getvalue(ctrl_fluff6);
    Fluff_nMinOpacity = getvalue(ctrl_fluff7);
    Fluff_nMaxOpacity = getvalue(ctrl_fluff8);
    Fluff_nMinSize = getvalue(ctrl_fluff9);
    Fluff_nMaxSize = getvalue(ctrl_fluff10);

    reqend();
}

refresh_preset:value
{
    if(value == 1) // Projected Film (Dirty)
      {
      setvalue(ctrl_dust0,1); // Dust Enable
      setvalue(ctrl_dust1,<0,0,0>); // Dust Color
      setvalue(ctrl_dust2,25000); // Dust Amount
      setvalue(ctrl_dust3,0.2); // Dust Opacity
      setvalue(ctrl_dust4,0.1); // Dust Min Size
      setvalue(ctrl_dust5,1.0); // Dust Max Size

      setvalue(ctrl_dirt0,1); // Dirt Enable
      setvalue(ctrl_dirt1,<0,0,0>); // Dirt Color
      setvalue(ctrl_dirt2,1); // Dirt Frequency
      setvalue(ctrl_dirt3,500); // Dirt Amount
      setvalue(ctrl_dirt4,0.1); // Dirt Opacity
      setvalue(ctrl_dirt5,1); // Dirt Min Size
      setvalue(ctrl_dirt6,10); // Dirt Max Size

      setvalue(ctrl_fluff0,1); // Fluff Enable
      setvalue(ctrl_fluff1,<0,0,0>); // Fluff Color
      setvalue(ctrl_fluff2,1); // Fluff Frequency
      setvalue(ctrl_fluff3,1); // Fluff Min Amount
      setvalue(ctrl_fluff4,9); // Fluff Max Amount
      setvalue(ctrl_fluff5,50); // Fluff Min Length
      setvalue(ctrl_fluff6,100); // Fluff Max Length
      setvalue(ctrl_fluff7,0.05); // Fluff Min Opacity
      setvalue(ctrl_fluff8,0.5); // Fluff Max Opacity
      setvalue(ctrl_fluff9,0.1); // Fluff Min Size
      setvalue(ctrl_fluff10,1.0); // Fluff Max Size
      }

    if(value == 2) // Dust (Light)
      {
      setvalue(ctrl_dust0,1); // Dust Enable
      setvalue(ctrl_dust1,<1.0,1.0,1.0>); // Dust Color
      setvalue(ctrl_dust2,5000); // Dust Amount
      setvalue(ctrl_dust3,0.2); // Dust Opacity
      setvalue(ctrl_dust4,0.1); // Dust Min Size
      setvalue(ctrl_dust5,5.0); // Dust Max Size

      setvalue(ctrl_dirt0,0); // Dirt Enable

      setvalue(ctrl_fluff0,0); // Fluff Enable
      }

    if(value == 3) // Dust & Dirt (Heavy)
      {
      setvalue(ctrl_dust0,1); // Dust Enable
      setvalue(ctrl_dust1,<1.0,1.0,1.0>); // Dust Color
      setvalue(ctrl_dust2,30000); // Dust Amount
      setvalue(ctrl_dust3,0.2); // Dust Opacity
      setvalue(ctrl_dust4,0.1); // Dust Min Size
      setvalue(ctrl_dust5,5.0); // Dust Max Size

      setvalue(ctrl_dirt0,1); // Dirt Enable
      setvalue(ctrl_dirt1,<1.0,1.0,1.0>); // Dirt Color
      setvalue(ctrl_dirt2,1); // Dirt Frequency
      setvalue(ctrl_dirt3,10); // Dirt Amount
      setvalue(ctrl_dirt4,0.1); // Dirt Opacity
      setvalue(ctrl_dirt5,200); // Dirt Min Size
      setvalue(ctrl_dirt6,200); // Dirt Max Size

      setvalue(ctrl_fluff0,0); // Fluff Enable
      }

    if(value == 4) // Fluff
      {
      setvalue(ctrl_dust0,0); // Dust Enable

      setvalue(ctrl_dirt0,0); // Dirt Enable

      setvalue(ctrl_fluff0,1); // Fluff Enable
      setvalue(ctrl_fluff1,<1.0,1.0,1.0>); // Fluff Color
      setvalue(ctrl_fluff2,1); // Fluff Frequency
      setvalue(ctrl_fluff3,2000); // Fluff Min Amount
      setvalue(ctrl_fluff4,2000); // Fluff Max Amount
      setvalue(ctrl_fluff5,10); // Fluff Min Length
      setvalue(ctrl_fluff6,20); // Fluff Max Length
      setvalue(ctrl_fluff7,0.05); // Fluff Min Opacity
      setvalue(ctrl_fluff8,0.5); // Fluff Max Opacity
      setvalue(ctrl_fluff9,0.1); // Fluff Min Size
      setvalue(ctrl_fluff10,1.0); // Fluff Max Size
      }

}


All scripts available at my Google Drive at
https://drive.google.com/open?id=1cR_q2GVUAJHumic1-A3eXV16acQnVTWs

No comments:

Post a comment