Random Color Node - Addon

by mod3d in Addons


For Blender versions (up to and including 3.4): Rendering is supported ONLY on the Cycles Engine and CPU.


In Blender versions starting from 3.5 and higher added OSL support with OptiX on the GPU.


How to activate the Open Shading Language.


 Light Version:

Extract the archive and drag and drop the files into Blender's Text Editor.



The Basic Version installs like any other add-on.
After activation, click the Append Scripts button in the RCN Tab.

 4 files will appear in the Text Editor.
Three scripts RCN_ .osl   and Documentation file .txt

After selecting a script in the node, press the compile button (two circular arrows next to the script name).


Сolor combination



#
#
#

RCN_Rand.


Selection of a pseudorandom values between Min and Max.

The green sockets act as switches between functions. The value corresponds to the sequence number of the function in the node.
#
Type_Color - Change color(integer values 0, 1, 2).

    0 - Red;
    1 - Green;
    2 - Blue;
#
Seed - seed;
#
Min - minimum;
#
Max - maximum;
#
Probability - (default = 1, Clamp off). This parameter varies from 0 to 1. It affects the probability of Clamp values appearing in random places.

    If Probability = 1 - the Clamp is off, and value between Min and Max is output;
    If Probability = 0 - value between Min and Max is off, and the Clamp value is output;
    If less than 1 but greater than 0 - the Clamp value is generated in random places;

    The closer this value is to 1, the more often the output value between Min and Max. Conversely, the closer this value is to 0, the more often the Clamp value will appear on the output;
#
Period - Frequency of switching between Clamp and [Min, Max]. (not equal to 0). Only works when the Clamp is activated.
#
Clamp - Clamp type (integer values 0, 1, 2, 3, 4). Activated if 0 <= Probability < 1.
    0 - the output will be 0;
    1 - the output will be the SMALLER of the two values[Min, Max];
    2 - the output will be the GREATER of the two values[Min, Max];
    3 - will be selected from [0, Min, Max];
    4 - will be selected from [Stop_1, Stop_2, Stop_3];


Clamp 0, 1 and 2.



#
Clamp_A - from 0 to 1;
Clamp_B - from 0 to 1;

    Sliders for setting the distribution.
    Activates when the Clamp is set to 3 or 4.

    When you change the Seed, there is a comparison with a pseudorandom numbers.
#
Clamp is 3.
    If this numbers is less than Clamp_A - the output will be 0;
    If this numbers is more or equal to Clamp_A but less than Clamp_B - the output will be LESS of [Min, Max];
    If this numbers is bigger than Clamp_B - the output will be GREATER from [Min, Max];

#
Custom values, activated when Clamp is 4.

    Stop_1
    Stop_2
    Stop_3

    If this numbers is less than Clamp_A - the output will be Stop_1;
    If this numbers is more or equal to Clamp_A but less than Clamp_B - the output will be Stop_2;
    If this numbers is bigger than Clamp_B - the output will be Stop_3;

Clamp 3 and 4.



#

#
#
#


RCN_Wave.

Smooth color change with a sine wave.

The green sockets act as switches between functions. The value corresponds to the sequence number of the function in the node.
#
Type_Color - Change color(integer values 0, 1, 2).

    0 - Red;
    1 - Green;
    2 - Blue;

#
Wave - type of wave (integer values 0, 1, 2, 3).

    0 - wave in the range[- Max, Max];
    1 - wave in the range[Min, Max];
    2 - saw;
    3 - absolute wave. Positive values only;



#
Seed - seed;
#
Min - min amplitude;
#
Max - max amplitude;
#
Frequency - frequency (not equal to 0);
#
Shift - shift of start position;
#
Probability - (default = 1, clamp off). This parameter varies from 0 to 1. It affects the probability of Clamp values appearing in random places.

    If Probability = 1 - the Clamp is off, and a Wave value is output;
    If Probability = 0 - Wave is off, and the Clamp value is output;
    If less than 1 but greater than 0 - the Clamp value is generated in random places.

    The closer this value is to 1, the more often the output value is Wave. Conversely, the closer this value is to 0, the more often the Clamp value will appear on the output.

#
Clamp - Clamp type (integer values 0, 1, 2). Activated if 0 <= Probability < 1.

    0 - the output will be 0;
    1 - the output will be the SMALLER of the two values [Min, Max];
    2 - the output will be the GREATER of the two values [Min, Max];
#
Period - Frequency of switching between Clamp and Wave. (not equal to 0). Only works when the Clamp is activated.
#


#
#
#


RCN_3Range.

Expanded version of RCN_Rand, which gives access to 3 ranges settings.

The green sockets act as switches between functions. The value corresponds to the sequence number of the function in the node.
#
Type_Color - Change color(integer values 0, 1, 2).

    0 - Red;
    1 - Green;
    2 - Blue;
#
Factor_A - value from 0 to 1;
Factor_B - value from 0 to 1;




   These parameters set the distribution between the three ranges.


   When you change the Seed, a pseudorandom numbers is generated.

   And

   if this numbers
   from 0 to Factor_A - the output will be from the Left Range[Left_Min, Left_Max];

   if this numbers
   from Factor_A to Factor_B - the output will be from the Middle Range[Middle_Min, Middle_Max];

   if this numbers
   from Factor_B to 1 - the output will be a number from the Right Range[Right_Min, Right_Max];

#
Examples:

   Factor_A = 0;
   Factor_B = 0;
   Always generate value in [Right_Min, Right_Max];

   Factor_A = 1;
   Factor_B = 1;
   Always generate value in [Left_Min, Left_Max];

   Factor_A = 0;
   Factor_B = 0.5;
   Approximately 50% of the time, the value [Middle_Min, Middle_Max] is generated;
   And
   Approximately 50% of the time, the value [Right_Min, Right_Max] is generated;


   Factor_A = 0.5;
   Factor_B = 0.5;
   Approximately 50% of the time, the value [Left_Min, Left_Max] is generated;
   And
   Approximately 50% of the time, the value [Right_Min, Right_Max] is generated;


   This example uses ALL three ranges.

   Factor_A = 0.4;
   Factor_B = 0.75;

   if the pseudo-random numbers is less than 0.4 - the output will be a value from the Left Range[Left_Min, Left_Max];
   if the pseudo-random numbers is greater than or equal to 0.4 but less than 0.75 - the output will be a value from the Middle Range[Middle_Min, Middle_Max].
   if the pseudo-random numbers is greater than or equal to 0.75 - the output will be a value from the Right Range[Right_Min, Right_Max].

#
Seed - seed.
#
Min and Max for the Left Range.
   Left_Min
   Left_Max
#
Min and Max for the Middle Range.
   Middle_Min
   Middle_Max
#
Min and Max for the Right Range.
   Right_Min
   Right_Max
#
A separate parameter for each range. The principle of operation is the same as in the previous nodes.
#
Probability_Left   - probability for the Left Range.
Probability_Middle - probability for the Middle Range.
Probability_Right  - probability for the Right Range.

#
Clamp - Clamp type (integer values 0, 1, 2). Activated if 0 <= Probability < 1.

    0 - the output will be 0;
    1 - the output will be the SMALLER of the two values [Min, Max];
    2 - the output will be the GREATER of the two values [Min, Max];

    Clamp_Left   - Clamp for the Left Range.
    Clamp_Middle - Clamp for the Middle Range.
    Clamp_Right  - Clamp for the Right Range.

#
A separate parameter for each range. The principle of operation is the same as in the previous nodes.
Only works when the Clamp is activated.
#
Period_Left   - Frequency of switching between Clamp and value[Left_Min, Left_Max]. (not equal to 0).
Period_Middle - Frequency of switching between Clamp and value[Middle_Min, Middle_Max]. (not equal to 0).
Period_Right  - Frequency of switching between Clamp and value[Right_Min, Right_Max]. (not equal to 0).
#

#
#
#

Choose a product version:

Dev Fund Contributor
Published 12 months ago
Blender Version 3.6, 3.5, 3.4, 3.3
License GPL
Have questions before purchasing?

Contact the Creator with your questions right now.

Login to Message