Sign in to follow this  
Followers 0
TechnoRobbo

TR's Croquis V 1.4 (Dwarf Horde Collaboration)

30 posts in this topic

TechnoRobbo's Croquis

(Dwarf Horde Collaboration)


​Quick Sketch Filter

3.5 compatible

v1.2 Slider and angle control by Red Ochre

v1.3 RetainColor and Invert Controls by BoltBait

v1.4 Pastel Effect by BoltBait


Menu: Effects->Artistic




CodeLab Source Code (it's a divide algorithm)

Hidden Content:

// Submenu: Artistic
// Name: TRs Croquis
// Title: TRs Croquis - v1.4
// Author: TechnoRobbo & Red Ochre & BoltBait
// URL: http://www.technorobbo.com
#region UICode
int Amount1 = 210; // [0,225] Contrast
int Amount2 = 0; // [0,255] Clip Lo
int Amount3 = 222; // [129,255] Clip Hi
double Amount4 = 0.5; // [0.1,10] Distance
double Amount5 = 45; // [-180,180] Angle
bool Amount6 = false; // [0,1] Retain Color
bool Amount7 = false; // [0,1] Invert
byte Amount8 = 0; // [1] Pastel Action|None|Invert|Rail
#endregion

private UnaryPixelOps.Invert invertOp = new UnaryPixelOps.Invert();

//private BinaryPixelOp multiplyOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Multiply); //for PDN 4
private UserBlendOp multiplyOp = new UserBlendOps.MultiplyBlendOp(); // Multiply for CodeLab 1.8 and Paint.NET 3.5x

void Render(Surface dst, Surface src, Rectangle rect)
{
    ColorBgra CP;
    Color rgb;
    double k;
    double l;
    float offX = (float)(Amount4 * Math.Cos(Amount5 * Math.PI / 180));
    float offY = (float)(Amount4 * Math.Sin(Amount5 * Math.PI / 180));
    
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            CP = src.GetBilinearSampleWrapped((float)x + offX,(float)y + offY);

            rgb = CP.ToColor();
            l = rgb.GetBrightness();

            CP = src[x,y];
            rgb = CP.ToColor();
            k = rgb.GetBrightness();
            k = (k==0)? 0: l/k;
            k *=k;
            k *=255;
            k = (k>255)?255:k;
            double inverse = 255 - Amount1;
            k -= Amount1;
            k = (k<0) ? 0:k;
            k= k * 255 / inverse;
            k =(k < Amount2) ? 0: (k > Amount3) ? 255:k;

            dst[x,y] = ColorBgra.FromBgra((byte)k , (byte)k ,(byte)k, CP.A);
            
            if (Amount7)
            {
                dst[x,y] = invertOp.Apply(dst[x,y]);
            }
            
            if (Amount6)
            {
                dst[x,y] = multiplyOp.Apply(dst[x,y],src[x,y]);
            }
            
            if (Amount8!=0)
            {
                ColorBgra CurrentPixel = dst[x,y];

                PaintDotNet.HsvColor hsv = PaintDotNet.HsvColor.FromColor(CurrentPixel.ToColor());
                int H = hsv.Hue;
                int S = hsv.Saturation;
                int V = hsv.Value;
                byte A = CurrentPixel.A;

                switch (Amount8)
                {
                    case 1: V = 100-V;
                        break;
                    case 2: V = 100;
                        break;
                }

                CurrentPixel = ColorBgra.FromColor(new PaintDotNet.HsvColor(H,S,V).ToColor());
                CurrentPixel.A = A;

                dst[x,y] = CurrentPixel;
            }
        }
    }
}

TRsCroquis.zip

8

Share this post


Link to post
Share on other sites

Great code! useful effect! Thank you!

1

Share this post


Link to post
Share on other sites

Version 1.1 ready for Download


v1.1 Slider and angle control by Red Ochre


0

Share this post


Link to post
Share on other sites

Wonderful effect and elegant code good.gif. Thank you.

0

Share this post


Link to post
Share on other sites

Thank you ReMake

 

and Thank you Miss Nite Nurse 79.

0

Share this post


Link to post
Share on other sites

Hello TR and thank you.

 

I just tried the filter and somehow I can not get my charcoal to draw like yours. My sketch is very pixelated even when I use the same setting of your video. I guess I need to sharpen the tip of my pencil. :)

croquis-4b80680.png

0

Share this post


Link to post
Share on other sites

I just did it but it did not change much.

- - - - - - - - - - - - -- 

EDIT: I adjusted the levels (more black and white) of the picture before applying the filter and this is what I obtained:croquis01-4b80893.png

Edited by Eli
1

Share this post


Link to post
Share on other sites

lfmdh6l7.png  Techno Robbo! Very nice plugin. Thank you for your effort. h4ojtkbq.gif   I have 2 version, with or without color. I hope have done right.   xblf4ioa.gif

 

8hwpwpgs.png

Edited by Seerose
2

Share this post


Link to post
Share on other sites

Eli - The first one looks like it is highlighting the 'compressed' areas of a jpeg perhaps?

... but always keep your pencil sharp anyway! :D

0

Share this post


Link to post
Share on other sites

Yup - jpeg's have patterned compression artifacts that get highlighted by plugins that enhance edges.

0

Share this post


Link to post
Share on other sites

Thanks Red and TR.

 

Is there a method to reduce those artifacts? If so could that be included in the filter?

0

Share this post


Link to post
Share on other sites

Version 1.3 Ready for Download 


v1.3 Retain Color and Invert Controls by BoltBait


 


(a Dwarf Horde Collaboration)


 


So go to one of BoltBaits Post and give him a +1


0

Share this post


Link to post
Share on other sites

So go to one of BoltBaits Post and give him a +1

 

Haha! Thanks!

Here's something to try:

After running the plugin with both check boxes checked, you should get something that looks like colored chalk on an old blackboard. Then run this CodeLab script:

 

// Name: HSV Invert
// Submenu: Color
// Author: BoltBait
// URL: http://www.BoltBait.com
// Keywords: hsv|invert|color
// Title: BoltBait's HSV Quick Invert - v1.0
// Desc: Quickly invert H, S, or V in the HSV color space.
#region UICode
byte Amount1 = 0; // HSV Editing|Invert V|Invert S|Invert H|Maximize S|Maximize V
#endregion

void Render(Surface dst, Surface src, Rectangle rect)
{
    for (int y = rect.Top; y < rect.Bottom; y++)
    {
        if (IsCancelRequested) return;
        for (int x = rect.Left; x < rect.Right; x++)
        {
            ColorBgra CurrentPixel = src[x,y];

            HsvColor hsv = HsvColor.FromColor(CurrentPixel.ToColor());
            int H = hsv.Hue;
            int S = hsv.Saturation;
            int V = hsv.Value;
            byte A = CurrentPixel.A;

            switch (Amount1)
            {
                case 0: V = 100-V;
                    break;
                case 1: S = 100-S;
                    break;
                case 2: H += 180;
                    if (H>360) H -= 360;
                    break;
                case 3: S = 100;
                    break;
                case 4: V = 100;
                    break;
            }

            CurrentPixel = ColorBgra.FromColor(new HsvColor(H,S,V).ToColor());
            CurrentPixel.A = A;

            dst[x,y] = CurrentPixel;
        }
    }
}
2

Share this post


Link to post
Share on other sites

Hello BoltBait,

 

Will there be a dll for the script? (I do not understand code)  :roll: . 

0

Share this post


Link to post
Share on other sites

...Will there be a dll for the script? (I do not understand code)   :roll: . 

 

Today is not 1'st April, but still fun good.gif.

 

...So go to one of BoltBaits Post and give him a +1

0

Share this post


Link to post
Share on other sites

No need to understand code in order to copy-and-paste that block of code into CodeLab.

0

Share this post


Link to post
Share on other sites

Thanks BoltBait,

 

It really made me sweat the idea of using CodeLAb but I was so curious about the outcome of the script that I decided to try it . So this is the outcome :

croquis-color-chalk1-4b84bd3.png

I added a little gray on another layer.

 

Postedit:

 

I am sorry TR, I just realized that charcoal is... BLACK. 

Edited by Eli
3

Share this post


Link to post
Share on other sites

 

 

I am sorry TR, I just realized that charcoal is... BLACK

At it's base this plugin has a charcoal sketch like result. But that was the outcome not the intent. I changed the description since it's obviously a tool like any other with no real rules on how you eventually use it.

0

Share this post


Link to post
Share on other sites

It is funny how things evolve.

0

Share this post


Link to post
Share on other sites

Version 1.4 Incorporates part of not all BoltBait's Pastel Effect

for the full effect use BoltBait's Plugin.


Ready for Download


Croquis.png?raw=1

3

Share this post


Link to post
Share on other sites

Neon_sign_animated.gif

 

I've found it to be quite convenient for producing line art of basic 3D models, like below derisive.gif

 

reaper_base_and_line_art_side_to_side.jp

 

JC_you_rock.gifJC_ThankYou.gif

4

Share this post


Link to post
Share on other sites

 

 

lbqml3v5.png Maximilian! Very pretty presentation. mqlcrqcf.png

1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0