BoltBait 2,176 Report post Posted November 15, 2006 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: 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: 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): 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: 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. 8) Source Code The codelab script is fairly straight forward: 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 CurrentPixel; int srcX = 0, srcY = 0; for(int y = rect.Top; y < rect.Bottom; y++) { for (int x = rect.Left; x < rect.Right; x++) { if (selectionRegion.IsVisible(x, y)) { 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]; } } } } Quote Share this post Link to post Share on other sites
barkbark00 3 Report post Posted November 15, 2006 I could see this being very helpful Quote Share this post Link to post Share on other sites
TinSoldier 0 Report post Posted November 15, 2006 I don't understand step 4 very well; you just added some more coins to your image on different layers? Is that correct? Quote Share this post Link to post Share on other sites
BoltBait 2,176 Report post Posted November 15, 2006 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. Quote Share this post Link to post Share on other sites
crazyasslatino 0 Report post Posted November 20, 2006 thank god u made this! i always wanted something to make a tile background but never comes out right Quote Share this post Link to post Share on other sites
kirby145 2 Report post Posted December 4, 2006 Wow how did you do that it's like magic Quote Share this post Link to post Share on other sites
MadJik 955 Report post Posted December 4, 2006 Madjik would have say : logic! Quote Share this post Link to post Share on other sites
shaun1ee 0 Report post Posted April 5, 2007 Not to worry, I managed to sort it Thanks MadJik for the reply anyway Quote Share this post Link to post Share on other sites
Enormator 2 Report post Posted April 21, 2007 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)) I also got a better one but didn't find it on my hdd. I'll add it later... maybe :wink: Quote Share this post Link to post Share on other sites
MadJik 955 Report post Posted June 6, 2007 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: Quote Share this post Link to post Share on other sites
MadJik 955 Report post Posted June 6, 2007 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: Quote Share this post Link to post Share on other sites
barkbark00 3 Report post Posted June 6, 2007 When I run that I get the following error: Quote Share this post Link to post Share on other sites
barkbark00 3 Report post Posted June 6, 2007 When I run that I get the following error: Quote Share this post Link to post Share on other sites
MadJik 955 Report post Posted June 6, 2007 When I run that I get the following error: I've changed this line so often, but I forgot to update the post! Done! TY Quote Share this post Link to post Share on other sites
MadJik 955 Report post Posted June 6, 2007 When I run that I get the following error: I've changed this line so often, but I forgot to update the post! Done! TY Quote Share this post Link to post Share on other sites
MadJik 955 Report post Posted June 20, 2007 Seamless texture Maker http://paintdotnet.12.forumer.com/viewtopic.php?t=5334 Quote Share this post Link to post Share on other sites
R3VENGE 1 Report post Posted January 1, 2008 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 Quote Share this post Link to post Share on other sites
jimjimmy1995 0 Report post Posted January 21, 2011 I've been doing this manually grr this makes life easier. Quote Share this post Link to post Share on other sites
heartofdestany 0 Report post Posted April 3, 2014 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. Quote Share this post Link to post Share on other sites
sashwilko 431 Report post Posted April 3, 2014 (edited) 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 April 3, 2014 by sashwilko Quote Share this post Link to post Share on other sites
dustinechoes849 0 Report post Posted April 7, 2016 This is friggin' magic. Thanks! Quote Share this post Link to post Share on other sites
sunmaggot 20 Report post Posted September 23, 2017 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!!! 1 Quote Share this post Link to post Share on other sites
LionsDragon 742 Report post Posted September 23, 2017 @sunmaggot, wow, it looks like panne velvet! Excellent use of the plugin! Quote Share this post Link to post Share on other sites
sunmaggot 20 Report post Posted September 24, 2017 @LionsDragon It is grass Quote Share this post Link to post Share on other sites
LionsDragon 742 Report post Posted September 24, 2017 Well then it is the softest, most luxurious grass I've seen in some time! I envy your characters for getting to walk on it. Quote Share this post Link to post Share on other sites