Jump to content
How to Install Plugins ×

Seamless Texture Helper Plugin


BoltBait

Recommended Posts

What is the hardest part of creating seamless textures? Yes, making sure they look natural when they repeat. The usual problem is that no matter how hard you try, the seam is usually clearly visible.

I thought that it may make it easier if you work on the edges first (in the middle of the canvas), then move them to the edges of the physical canvas.

I know this probably sounds strange, but just take a look at the instructions section below for a better explanation.

You can download the precompiled effect DLL here: SeamlessHelper.dll

Just drop this file in your /program files/Paint.NET/effects directory and you should be all set.

Instructions for Use

The best way to use this is to follow these steps:

1) Create a canvas that is an even width and even height. For example, 200 x 200. It is critical that you do not use odd dimensions--they can be different (like 200x100, etc.) just not odd.

2) Start creating your texture by focusing on the middle of the canvas. Do not place anything too close to the edges at this point.

I will be creating a repeating texture of American coins. Here you can see this step:

http://boltbait.googlepages.com/Coins1.jpg

Notice that I am only concerned about covering the area marked in red. Do not include red lines, they are only here to illustrate the area that I'm trying to cover.

By the way, I found all the images of these coins by using Google Image Search. I made this composite image by using several layers and liberal use of the Feather plugin.

3) Flatten your image down to a single layer.

4) Run the Seamless Helper effect. Your image should now look like this:

http://boltbait.googlepages.com/Coins2.jpg

Notice how the coins have been moved to the edges. Your texture now has seamless edges!

To illustrate this more simply, take a look at this image (before on left, after on right):

http://boltbait.googlepages.com/Coins4.gif

  • The effect DLL basically splits your image into 4 parts
    and rearranges those parts as show above.

5) Now finish off the center of the image being careful to again stay away from the edges. I'll just add 3 quarters to the picture:

http://boltbait.googlepages.com/Coins3.jpg

6) Save the file in your favorite format (GIF, JPG, or PNG).

That's it! You have created a seamless texture!

You can quickly test these by putting it on your desktop and chose the "tile" option.

Once you've made a seamless texture, the next thing you'll need is the photo flood fill plugin. 😎

Source Code

The codelab script is fairly straight forward:

void Render(Surface dst, Surface src, Rectangle rect)
{
    Rectangle selection = EnvironmentParameters.SelectionBounds;
    int CenterX = ((selection.Right - selection.Left) / 2) + selection.Left;
    int CenterY = ((selection.Bottom - selection.Top) / 2) + selection.Top;
    int srcX = 0, srcY = 0;
    for(int y = rect.Top; y < rect.Bottom; y++)
    {
        for (int x = rect.Left; x < rect.Right; x++)
        {
            srcX = x;
            srcY = y;
            if (x < CenterX)
            {
                srcX += CenterX;
            }
            else
            {
                srcX -= CenterX;
            }
            if (y < CenterY)
            {
                srcY += CenterY;
            }
            else
            {
                srcY -= CenterY;
            }
            dst[x,y] = src[srcX,srcY];
        }
    }
} 
 
Link to comment
Share on other sites

I don't understand step 4 very well; you just added some more coins to your image on different layers? Is that correct?

Yes, after step 3 there is a big white space in the center of my drawing... So I added 3 quarters to the picture to finish it off.

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 months later...
  • 3 weeks later...

:D WOW I'm proud of me... and you

biiig thanx dude!

(Made this pic only with effects (like noise, median blur, emboss... and YOUR EFFECT))

randomtilesmaller846_thumb.jpg

I also got a better one but didn't find it on my hdd. I'll add it later... maybe :wink:

Link to comment
Share on other sites

  • 1 month later...

http://paintdotnet.12.forumer.com/viewtopic.php?p=48707#48707

From a request/idea on another topic...

To make a texture at once, I make an average with Source+Destination.

Test the code with CodeLab:

void Render(Surface dst, Surface src, Rectangle rect) 
{ 
 PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); 
 Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); 
 int CenterX = (int)(((selection.Right - selection.Left) / 2) + selection.Left); 
 int CenterY = (int)(((selection.Bottom - selection.Top) / 2) + selection.Top); 
 ColorBgra PixD,Pix1,Pix2; 
 int srcX = 0, srcY = 0;

 for(int y = rect.Top; y < rect.Bottom; y++) 
 { 
   for (int x = rect.Left; x < rect.Right; x++) 
   { 
     srcX = x; 
     srcY = y; 

     if (x < CenterX) srcX += CenterX; 
     else srcX -= CenterX; 

     if (y < CenterY) srcY += CenterY; 
     else srcY -= CenterY; 

     Pix1 = src[srcX,srcY]; 
     Pix2 = src[x,y];
     PixD = src[x,y];
     PixD.R = (byte)((float)(Pix1.R + Pix2.R + 0.5f)/2.0f);
     PixD.G = (byte)((float)(Pix1.G + Pix2.G + 0.5f)/2.0f);
     PixD.B = (byte)((float)(Pix1.B + Pix2.B + 0.5f)/2.0f);
     PixD.A = (byte)((float)(Pix1.A + Pix2.A + 0.5f)/2.0f);
     dst[x,y] = PixD;
   } 
 } 
}

Edit: correction of a bug :oops:

Link to comment
Share on other sites

http://paintdotnet.12.forumer.com/viewtopic.php?p=48707#48707

From a request/idea on another topic...

To make a texture at once, I make an average with Source+Destination.

Test the code with CodeLab:

void Render(Surface dst, Surface src, Rectangle rect) 
{ 
 PdnRegion selectionRegion = EnvironmentParameters.GetSelection(src.Bounds); 
 Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); 
 int CenterX = (int)(((selection.Right - selection.Left) / 2) + selection.Left); 
 int CenterY = (int)(((selection.Bottom - selection.Top) / 2) + selection.Top); 
 ColorBgra PixD,Pix1,Pix2; 
 int srcX = 0, srcY = 0;

 for(int y = rect.Top; y < rect.Bottom; y++) 
 { 
   for (int x = rect.Left; x < rect.Right; x++) 
   { 
     srcX = x; 
     srcY = y; 

     if (x < CenterX) srcX += CenterX; 
     else srcX -= CenterX; 

     if (y < CenterY) srcY += CenterY; 
     else srcY -= CenterY; 

     Pix1 = src[srcX,srcY]; 
     Pix2 = src[x,y];
     PixD = src[x,y];
     PixD.R = (byte)((float)(Pix1.R + Pix2.R + 0.5f)/2.0f);
     PixD.G = (byte)((float)(Pix1.G + Pix2.G + 0.5f)/2.0f);
     PixD.B = (byte)((float)(Pix1.B + Pix2.B + 0.5f)/2.0f);
     PixD.A = (byte)((float)(Pix1.A + Pix2.A + 0.5f)/2.0f);
     dst[x,y] = PixD;
   } 
 } 
}

Edit: correction of a bug :oops:

Link to comment
Share on other sites

  • 2 weeks later...
  • 6 months later...

this will help in my ut2k4 map textures. before i had pdn i just used paint and everything was out of place. now i can put it into line

section8.png

psn id: R3V-fiR3

Link to comment
Share on other sites

  • 3 years later...
  • 3 years later...

One question, Where in the menus is the option to use this?

I installed the plugin but can't find where it is accessed in order to use it.

Any help here would be most appreciated, thank you in advance.

Link to comment
Share on other sites

One question, Where in the menus is the option to use this?

I installed the plugin but can't find where it is accessed in order to use it.

Any help here would be most appreciated, thank you in advance.

You will find it in the Effects menu, just scroll down after clicking the Effects tab  :)

Edited by sashwilko

swIFX9v.png

 

 

 

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...

hsLJSlq.png

 

Spent 1 hour to create this. I used the plugin to create different tiles that can link together in all combinations. The grid is so subtle that it is almost hidden!!

 

Thank you very much for the plugin!!!

  • Like 1

道生一,一生二,二生三,三生萬物。

non-existence made one, one made two, two made three, three made matters.

道可道,非常道;名可名,非常名。

well-defined principles are not eternal principles, names that can be named are not eternal names.

Link to comment
Share on other sites

@LionsDragon It is grass :|

道生一,一生二,二生三,三生萬物。

non-existence made one, one made two, two made three, three made matters.

道可道,非常道;名可名,非常名。

well-defined principles are not eternal principles, names that can be named are not eternal names.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...