Page 1 of 2 12 LastLast
Results 1 to 10 of 42

Thread: [Award Winner] Tutorial on how to create seamless textures out of anything

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    Quote Originally Posted by RobA View Post
    I had posted more detailed steps on the manual method previously here:
    http://www.cartographersguild.com/sh...=5842#post5842

    -Rob A>
    Rob, I checked out this post as follows...

    Quote Originally Posted by RobA View Post
    One way to get rid of the pattern artifacts (in the grass layer) is to apply a high pass filter effect (using the following steps)

    1. duplicate the grass layer
    2. gaussian blur the new layer
    3. invert the blurred layer
    4. desaturate the now inverted, blurred layer
    4. switch layer mode to overlay
    5. play with the opacity if required
    6. merge down
    7. adjust levels (if desired)

    Try it to see how it works. Depending on the blur radius, the effect will vary.

    -Rob A>
    What you are doing here is generating the low pass version and removing that from the image leaving the high pass only which would even out the brightness. Its that step of desaturating thats a bit odd. What I reckon you need for this technique is to take an image and call it A. Clone it to B and again to C. Take C and blur it so massively that its one uniform shade. Take B and remove C from it - thats sort of like the ultimate desaturation. Take that result and blur it a little and then remove this image from A. Then you would be removing the low frequencies but not the DC component so it should give the high pass but keep the DC colour. Its the same as doing the high pass and adding back in the DC of course as its A - (B - C) which is A - B + C. I'm still not sure how you can actually achieve this without the colour values going negative which would be clamped and then it wont work correctly. The only way I can see of getting around this is to split the images up into parts lighter than DC and parts darker than DC and process separately. I'll try this out offline and see if I can get that to work.

  2. #2
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    I tried this technique and its fine so here are the steps. Its a lot like RobA's but it wont have the desaturation stage and its probably more predictable because of it.

    Get an image 1.
    Blur it quite a lot 2.
    Blur it until its a constant colour 3.
    Use Image arithmetic to generate 2 - 3 => 4
    Use Image arithmetic to generate 3 - 2 => 5
    Take 1 and subtract 4 and add 5 => 6

    ...which is the equivalent to the spatial filtered image for high pass but with DC left in. You can do these stages to the tiled image if required.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	FilteringPSP.png 
Views:	209 
Size:	1.16 MB 
ID:	2167  

  3. #3

    Default

    IIR the desaturation was due to combining that layer using an overlay blend...it seemed to give the results I was looking for...Now I need to go back and play with yours (which makes the most sense having read that reference you provided on FFT and image processing.) I'd rep you for the reference, but I can't

    -Rob A>

  4. #4
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    I reckon that the desat is having a similar effect as keeping some of the DC component. By removing the blur (merging the negative of it) the desat stage is to not take as much of that DC away as if you would if you didn't do it. If you didn't then the image would drop to near black.

    Anyway, I am a big fan of ImageMagick (.org) and so I was thinking of a) getting some scripts together to do the tiling and the flattening of the images into tiles and then b) convert script into cgi and make a web page out of it so that you can upload an image and then push a button to get its tiled equiv. That would be well handy for everyone not least me.

    Anyone know if this web host run Perl based CGI ?

  5. #5
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    I have written the script file now and I am including a zip below. To use this script you will need to put the contents of the zip in a fresh directory and ensure that you have a version of ImageMagick installed.

    To run it, put an image to be tiled into that directory and call it start.png. Open up a command prompt and navigate to the directory. Type :-

    Code:
    GenTiled.bat 1 start.png
    The first parameter is how much flattening you want. 0 is none, 1 is low, 2 is medium, 3 is high.

    It should run for a while printing out a little status message now and again until it quits. You should get the image Final.png and Array.png which is a 3x3 tiled array of them to look at and see how well itd done it.

    You can change the starting image filename to whatever you want and it can be of any size and aspect but the Final.png will always be of size 1024x1024 and of PNG type unless you modify the script.

    It takes a little too long to run as a CGI script. I dont think my ISP would approve of the processing power consumed. If any of you are running a private web server then you could convert to a CGI script which would make an easy interface for the conversion.

    Bugs and comments welcome as usual.
    Attached Files Attached Files

  6. #6

    Default

    I tried it out and it works beautifully! The only think that would be nice is a resize back down to the original image size...

    I'd offer to host it on my personal server, but it really doesn't have the horsepower

    -Rob A>

  7. #7
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    I have seen a lot of people with tiling issues recently in maps and so I thought Id put a few demos of this automated seamless generator up. These textures come from www.CGTextures.com which is an excellent place to get a load of different types. Each set takes less than a minute to generate so theres no reason not to have them tiled any more. Some before and after images...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	StartSnake.jpg 
Views:	696 
Size:	124.9 KB 
ID:	3826   Click image for larger version. 

Name:	Final_Snake.jpg 
Views:	1043 
Size:	114.0 KB 
ID:	3827  
    Last edited by Redrobes; 05-24-2008 at 08:02 AM.

  8. #8
    Guild Journeyer Airith's Avatar
    Join Date
    Sep 2007
    Location
    Canada
    Posts
    110

    Post

    Quote Originally Posted by Redrobes View Post
    *snip*
    To run it, put an image to be tiled into that directory and call it start.png. Open up a command prompt and navigate to the directory. Type :-
    Code:
    GenTiled.bat 1 start.png
    *snip*
    Just wanted to say, that you need the contents of the zip in the ImageMagick directory. Took me forever to figure this out, it worked though so I hope it's not just me xD btw: This worked great, now I'm looking for more pictures to make seamless

    and if anyone isn't familiar with cmd prompt (ME ) then to get to the .bat, type "cd <directory of .bat>" and then just enter the code. I spent a lot of time trying to figure out the really easy stuff
    Last edited by Airith; 07-15-2008 at 05:52 PM.
    And our time is flyin', see the candle burnin' low
    Is the new world rising, from the shambles of the old
    ~The Rover - Led Zeppelin

  9. #9
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,201
    Blog Entries
    8

    Post

    Quote Originally Posted by Airith View Post
    Just wanted to say, that you need the contents of the zip in the ImageMagick directory.
    No you dont. BUT, you do need to ensure that the 'convert.exe' of imagemagick is the one that is used when you run it on the command line. By default you will get the Windows OS conversion utility - in typical MS lets call everything by its most generic name - syndrome (Although IM could have helped itself by calling its command IMConvert.exe too). So when you set up IM, go to the 'path' settings on the computer/advanced/environment vars and double check that IM is before sys32 and then it will be fine. You can test by running up cmd.exe, ensure that the current directory is not sys32 and type convert.exe. If you get a message about converting OS then thats bad. If you get a huge list of image conversion command options then thats good and it should be alright. I would recommend checking and changing the path anyway.

    You should have pinged me if you were having trouble. Its good to know that you tried to have a go tho. Glad it worked ok - its not perfect but its not too bad at most stuff, esp where the pattern is pretty random.

  10. #10

    Default

    How can I homogenize only corners brightness? does someone some way with imagemagick or Gimp?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •