public override UnityEngine.Color GetColour(double x, double y)
        {
            // Normal is..
            Color  normal = Normals.GetColour(x, y);
            double height = Height.GetValue(x, y);
            double ratio  = Ratio.GetValue(x, y);

            // Next, dot it with a vertical vector. (0,0,1)
            // Simplifies to just normal.z (blue):
            float dot = normal.b;

            double k = 1.0 - ratio * ratio * (1.0 - dot * dot);

            if (k < 0.0)
            {
                return(SourceModule.GetColour(x, y));
            }

            double rdSqrt = -(ratio * dot + System.Math.Sqrt(k));

            // Also apply height to it here:
            rdSqrt *= height;

            // Refraction vector is.. (just straight offset x/y):
            x += rdSqrt * normal.r;
            y += rdSqrt * normal.g;
            // float refractionVectorZ=ratio + rdSqrt * normal.b;

            return(SourceModule.GetColour(x, y));
        }
Exemple #2
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1      = SourceModule.GetColour(x, y);
            float             satChange = (float)SaturationModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Boost sat:
            s *= (1f + satChange);

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
Exemple #3
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            double tX = X.GetValue(x, y);
            double tY = Y.GetValue(x, y);

            return(SourceModule.GetColour(x + tX, y + tY));
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            double scaleX = X.GetValue(x, y);
            double scaleY = Y.GetValue(x, y);

            return(SourceModule.GetColour(x * scaleX, y * scaleY));
        }
Exemple #5
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read:
            float a = SourceModule.GetColour(x, y).a;

            return(new Color(a, a, a, 1f));
        }
Exemple #6
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            UnityEngine.Color col1 = DegreeModule.GetColour(x, y);

            // Read colour:
            UnityEngine.Color col2 = SourceModule.GetColour(x, y);

            if (col1.r != 0f)
            {
                col1.r = (float)System.Math.Pow(col2.r, 1.0 / col1.r);
            }

            if (col1.g != 0f)
            {
                col1.g = (float)System.Math.Pow(col2.g, 1.0 / col1.g);
            }

            if (col1.b != 0f)
            {
                col1.b = (float)System.Math.Pow(col2.b, 1.0 / col1.b);
            }

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            double nx = (Matrix[0] * x) + (Matrix[2] * y);
            double ny = (Matrix[1] * x) + (Matrix[3] * y);

            return(SourceModule.GetColour(nx, ny));
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1             = SourceModule.GetColour(x, y);
            float             brightnessChange = (float)BrightnessModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Boost brightness:
            l *= 1f + brightnessChange;

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1      = SourceModule.GetColour(x, y);
            float             hueChange = (float)HueModule.GetValue(x, y);
            float             satChange = (float)SatModule.GetValue(x, y);
            float             lumChange = (float)LumModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Boost all 3:
            h  = (h + hueChange) % 1f;
            s *= 1f + satChange;
            l *= 1f + lumChange;

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
Exemple #10
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1      = SourceModule.GetColour(x, y);
            float             hueChange = (float)HueModule.GetValue(x, y);

            // Read hsl:
            float h = col1.r;
            float s = col1.g;
            float l = col1.b;

            HslRgb.ToHsl(ref h, ref s, ref l);

            // Cycle the hue:
            h = (h + hueChange) % 1f;

            // Back to colour:
            HslRgb.ToRgb(ref h, ref s, ref l);

            // Now RGB:
            col1.r = h;
            col1.g = s;
            col1.b = l;

            return(col1);
        }
Exemple #11
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read:
            float channel = SourceModule.GetColour(x, y).r;

            return(new Color(channel, channel, channel, 1f));
        }
Exemple #12
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // 2 points (horizontal line), rotated clockwise by Angle.
            // Length of the line is a constant.
            // Sample those two points, then simply compute the difference.

            // Read angle:
            double angle = AngleModule.GetValue(x, y);
            float  sA    = (float)System.Math.Sin(angle);
            float  cA    = (float)System.Math.Cos(angle);

            // Base points (rotate first)
            float rightX = cA * HalfLine;
            float rightY = sA * HalfLine;

            // Read colour:
            UnityEngine.Color col1 = SourceModule.GetColour(x - rightX, y - rightY);

            // Read colour:
            UnityEngine.Color col2 = SourceModule.GetColour(x + rightX, y + rightY);

            // Difference divided by distance:
            col1.r = (col2.r - col1.r) / LineLength;
            col1.g = (col2.g - col1.g) / LineLength;
            col1.b = (col2.b - col1.b) / LineLength;

            return(col1);
        }
Exemple #13
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);

            // Tone map RGB - Red:
            int index = (int)(col1.r * 255f);

            // Clip:
            if (index < 0)
            {
                index = 0;
            }
            else if (index > 255)
            {
                index = 255;
            }

            // Read:
            col1.r = MappingBuffer[index];

            // Green:

            index = (int)(col1.g * 255f);

            // Clip:
            if (index < 0)
            {
                index = 0;
            }
            else if (index > 255)
            {
                index = 255;
            }

            // Read:
            col1.g = MappingBuffer[index];

            // Blue:

            index = (int)(col1.b * 255f);

            // Clip:
            if (index < 0)
            {
                index = 0;
            }
            else if (index > 255)
            {
                index = 255;
            }

            // Read:
            col1.b = MappingBuffer[index];

            // Offset:
            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read coords:
            double lookX = (XModule == null)?0:XModule.GetValue(x, y);
            double lookY = (YModule == null)?0:YModule.GetValue(x, y);

            // Read colour:
            return(SourceModule.GetColour(lookX, lookY));
        }
        public override double GetValue(double x, double y)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            float channel = HsvRgb.Luminance(colour.r, colour.g, colour.b);

            return(channel);
        }
        public override double GetWrapped(double x, double y, int wrap)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            double channel = HsyRgb.Luminance(colour.r, colour.g, colour.b);

            return(channel);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            float channel = HsvRgb.Luminance(colour.r, colour.g, colour.b);

            return(new Color(channel, channel, channel, 1f));
        }
        public override double GetValue(double x, double y, double z)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            float channel = HslRgb.Saturation(colour.r, colour.g, colour.b);

            return(channel);
        }
Exemple #19
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);

            // Read and apply alpha:
            col1.a = (float)AlphaModule.GetValue(x, y);

            return(col1);
        }
        public override double GetWrapped(double x, double y, int wrap)
        {
            // Read:
            Color colour = SourceModule.GetColour(x, y);

            // Get:
            float channel = LabRgb.B(colour.r, colour.g, colour.b);

            return(channel);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);

            col1.r = (float)System.Math.Acos(col1.r);
            col1.g = (float)System.Math.Acos(col1.g);
            col1.b = (float)System.Math.Acos(col1.b);

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            Color col1 = SourceModule.GetColour(x, y);

            col1.r = 1f - col1.r;
            col1.g = 1f - col1.g;
            col1.b = 1f - col1.b;

            return(col1);
        }
Exemple #23
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);

            return(new Color(
                       (col1.r * .393f) + (col1.g * .769f) + (col1.b * .189f),
                       (col1.r * .349f) + (col1.g * .686f) + (col1.b * .168f),
                       (col1.r * .272f) + (col1.g * .534f) + (col1.b * .131f),
                       col1.a
                       ));
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1     = SourceModule.GetColour(x, y);
            float             contrast = 1f + (float)ContrastModule.GetValue(x, y);

            // Boost:
            col1.r = ((col1.r - 0.5f) * contrast) + 0.5f;
            col1.g = ((col1.g - 0.5f) * contrast) + 0.5f;
            col1.b = ((col1.b - 0.5f) * contrast) + 0.5f;

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1   = SourceModule.GetColour(x, y);
            float             ctrast = 1f + (float)LuminanceModule.GetValue(x, y);

            // Boost:
            col1.r *= ctrast;
            col1.g *= ctrast;
            col1.b *= ctrast;

            return(col1);
        }
Exemple #26
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);

            // Threshold:
            double threshold = ThresholdModule.GetValue(x, y);

            // Smoothing range (+- half this):
            double smooth  = SmoothingRange.GetValue(x, y);
            double hSmooth = smooth * 0.5;

            // Get input colours intensity:
            double intensity = (col1.r + col1.g + col1.b) / 3.0;

            // High:
            UnityEngine.Color high;

            // Low:
            UnityEngine.Color low;

            // How does it compare to the minimum?
            double min = threshold - hSmooth;

            // Note: Equals here avoids a division by 0 when computing blending factor.
            if (intensity <= min)
            {
                low   = LowModule.GetColour(x, y);
                low.a = col1.a;
                return(low);
            }

            // And the max?
            if (intensity >= threshold + hSmooth)
            {
                high   = HighModule.GetColour(x, y);
                high.a = col1.a;
                return(high);
            }

            // Smooth. Blend between high and low.
            high = HighModule.GetColour(x, y);
            low  = LowModule.GetColour(x, y);

            // Blending factor is.. (NB: won't div by 0)
            float blend = (float)((intensity - min) / smooth);

            col1.r = low.r + (high.r - low.r) * blend;
            col1.g = low.g + (high.g - low.g) * blend;
            col1.b = low.b + (high.b - low.b) * blend;

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            UnityEngine.Color col1     = SourceModule.GetColour(x, y);
            float             contrast = 1f + (float)Contrast.GetValue(x, y);
            float             origin   = (float)Origin.GetValue(x, y);

            // Boost:
            col1.r = ((col1.r - origin) * contrast) + origin;
            col1.g = ((col1.g - origin) * contrast) + origin;
            col1.b = ((col1.b - origin) * contrast) + origin;

            return(col1);
        }
Exemple #28
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            UnityEngine.Color col1 = BaseModule.GetColour(x, y);

            // Read colour:
            UnityEngine.Color col2 = SourceModule.GetColour(x, y);

            col1.r = (float)System.Math.Log(col2.r, col1.r);
            col1.g = (float)System.Math.Log(col2.g, col1.g);
            col1.b = (float)System.Math.Log(col2.b, col1.b);

            return(col1);
        }
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Get the bounds:
            double minX   = MinXModule.GetValue(x, y);
            double rangeX = RangeXModule.GetValue(x, y);          // maxX = rangeX-minX
            double minY   = MinYModule.GetValue(x, y);
            double rangeY = RangeYModule.GetValue(x, y);          // maxY = rangeY-minY

            //Wrap and clip both:
            x = ((x - minX) % rangeX) + minX;
            y = ((y - minY) % rangeY) + minY;

            return(SourceModule.GetColour(x, y));
        }
Exemple #30
0
        public override UnityEngine.Color GetColour(double x, double y)
        {
            // Read colour:
            UnityEngine.Color col1 = SourceModule.GetColour(x, y);

            // Read colour:
            UnityEngine.Color col2 = ToNearestModule.GetColour(x, y);

            col1.r = col2.r * (float)System.Math.Floor(col1.r / col2.r);
            col1.g = col2.g * (float)System.Math.Floor(col1.g / col2.g);
            col1.b = col2.b * (float)System.Math.Floor(col1.b / col2.b);

            return(col1);
        }