Page 1 of 6 12345 ... LastLast
Results 1 to 10 of 58

Thread: [Award Winner] Thatching for dummies...

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

    Tutorial [Award Winner] Thatching for dummies...

    Been having a ball tonight playing with a new idea I have had. It worked so well I just had to share it. Working on the community mapping I have some towns and were gonna need a lot of buildings and there is no way I am going to draw each and every one of them. So a long time ago I figured that I could make bits of building and use them as stamps in ViewingDale or any other kind of stamp based drawing package like DungeonForge I guess. Did that pretty successfully with tiled houses but when I tried thatching it was a lot harder because thatched houses have a lot of curved surfaces and whilst tiled roofs have defined gutters, thatch does not. Basically it didn't work and I gave up.

    That was a while ago and things have moved on. This tutorial is going to use some pretty advanced techniques in 3D and I don't know what package you might use for this and its going to be tough going unless you can automate the process too. But its the only way I have managed to get good results so far. Apologies in that I am not going to intimately describe key by key steps as all of the software I am using will be custom but the idea should apply to any 3D package that can do lighting with a paint package that can do alpha masking - gimp, PS, PSP etc all can for example.

    So how to create fast thatch for curved surfaces.

    The object to be thatched needs to be in 3D so as stated that this is for dummies here is one

    What you need to do now is get that object in your 3D app. This could be a house object of course so making that might be a bit easier. The point here is to show that its good for curved surfaces.

    You now need to set up two lights opposite the object, north and south and render it to give the first light image. Then you need to set it up so that the lights move around the object in steps. I am using 8 steps so that it goes :- 0, 22.5, 45, 67.5, 90, 112.5, 135, 157.5 and 180 is the same as 0 so no need. You need one more which is lit from above too. You can do that as an 9 frame scene and render all of the frames out in the scene at once.

    Right you have 9 mask renders. You need to get some thatch and I got mine from a composite of several at CGTextures.com as usual.

    Make one with thatch going north south. Then make another with a 22.5 rotation, then another at 45 etc all the way to 157.5

    For the top down mask I used several of the rotated thatches blended together to give a no-particular-direction thatch.

    Now multiply all of the thatches by the masks and add them up. You should get something like that of the final render.

    I have this scripted now so for any height map I can generate them thatched in no time. It could in theory do more than one house at the same time - maybe a whole village... The nice bit tho is that you now are freed from having to texture each part of every 3D object saving hours if not days of time.

    Hope that is useful to somebody daring enough to try. I will of course be adapting this for all sorts of roof materials so I am on the hunt for non-copyrighted 3D houses now. If you wanna build them then I can thatch them for you.

    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Demo_height.png 
Views:	160 
Size:	45.9 KB 
ID:	3418   Click image for larger version. 

Name:	Demo_light0.png 
Views:	115 
Size:	52.3 KB 
ID:	3419   Click image for larger version. 

Name:	Demo_light2.png 
Views:	120 
Size:	48.6 KB 
ID:	3420   Click image for larger version. 

Name:	Demo_thatch.png 
Views:	1190 
Size:	581.1 KB 
ID:	3421   Click image for larger version. 

Name:	Demo_thatch2.png 
Views:	182 
Size:	674.2 KB 
ID:	3422  


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

    Post

    And the final image since I reached my 5 image limit...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Demo_final.png 
Views:	248 
Size:	1.41 MB 
ID:	3423  

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

    Post

    Hah hah... yes, we're cookin now.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Demo_cottage.png 
Views:	185 
Size:	827.9 KB 
ID:	3424  

  4. #4

    Post

    Nice! And no need for particle effects, kinda nifty.

  5. #5

    Default

    That is beautiful...time consuming, for the likes of me but beautiful (but not as time consuming as really thatching a roof).

    If I make a bunch of houses will you thatch them for me using your magic script?

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

    Post

    Sure thing if I can use them in my co-op tile !

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

    Post

    Just need a height map 8 bit greyscale or a model that I can render one out from. I can take almost any kind of model but at the mo I don't have a sketchup format converter. I should be ok with 3dsmax, obj, lightwave, vrml + lots more like that.

    If your building it yourself then its not worth putting huge amounts of detail in as it seems that the thatch covers it up.

    Heres a basic hut. I have loads of huts and this is the best one I have. It took just a few seconds to generate.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Cottage2_C.png 
Views:	122 
Size:	1.27 MB 
ID:	3425  

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

    Post

    More cottage bits
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Cottage4.png 
Views:	116 
Size:	1.13 MB 
ID:	3426   Click image for larger version. 

Name:	Cottage5.png 
Views:	146 
Size:	1.07 MB 
ID:	3427   Click image for larger version. 

Name:	Cottage6.png 
Views:	127 
Size:	1.38 MB 
ID:	3428   Click image for larger version. 

Name:	Cottage7.png 
Views:	120 
Size:	1.03 MB 
ID:	3429   Click image for larger version. 

Name:	Cottage8.png 
Views:	101 
Size:	820.4 KB 
ID:	3430  


  9. #9

    Post

    I was so impressed I had to try to see if I could do something similar with Gimp:
    Attachment 3442

    I created a set layers of rotated thatch images, then set the layer mask for each as a bump mapped version of the heightfield with the light coming from the same direction as the thatch was rotated. I think I had the lighting elevation too low, and I only went with 45 degree rotations, cause I was just playing.

    I realized afterward that I should have scaled the thatch down a bit, but I think the basics are there.

    How did you blend the rotated layers to get the non-direction version?

    I think this might be worth scripting...

    -Rob A>

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

    Post

    Well done for having a go. I'll note some more tech details...

    What I ended up doing was to add a whole bunch of light sources in a line going vertical. Like a vertical fluorescent strip light in the direction of thatching and I created a single image render made from the brightest parts of those light renders. I used directional light sources not point or spot. Then I clamped the lighting so that only the very brightest parts of the image stayed white and all else went black. That basically made only the parts of the model which faced in the exact horizontal (X-Z plane) direction of the thatch white but at any vertical angle (Y angle). So for example a ball like an orange would have a segment lit white and all else black.

    So I had 8 image masks and an extra non directional thatch texture. The masking and compositing is done with a compositor that I have as part of GTS but the order I used was as follows.

    Start with an image which is all floor color - say black.
    Mask in the non directional thatch where the object is not floor only. That is to say if the height map is not black then render the non directional thatch.

    Then multiply LightMask7 (157.5deg) with Thatch7 and add in.
    Then multiply LightMask6 (135.0deg) with Thatch6 and add in.
    ...

    Then multiply LightMask0 (0.0deg) with Thatch0 and add in.

    And that should be it. So Thatch at 0.0 deg is the highest priority and the non directional thatch is least. I tried doing odd angled first like 22.5, 67.5 and then the 45's and then the 90's and then 0 but that didn't come out as well as doing them in rotation order. You could end up with small patches of one angle where everything around it was another completely different. By doing them in rotation order it seems to blend the angles better but the down side is that if you get the light clamping wrong then the bits of thatch which would be 90deg and well lit by the 90deg light mask could be wiped out by the overlap from the 22.5 Then when you get the final render all the angles are a bit out.

    I accept that this is not the easiest thing to set up but once you have it it seems to work time and time again.

    To get the non directed thatch I merely took 0 & 90 deg and put it in two layers in the bitmap editor and blended 50:50. I was hoping that I wouldn't have too much of that showing really. You cant have thatch pointing straight up as it would let the water in ! I don't know what real thatching does on the top of houses. I guess they put some flat thatching across. Sometimes you see these great bits like topiary with a thatched peacock or something very clever.
    Last edited by Redrobes; 05-05-2008 at 07:26 AM.

Page 1 of 6 12345 ... 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
  •