And the final image since I reached my 5 image limit...
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.
Nice! And no need for particle effects, kinda nifty.
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?
Last edited by ravells; 05-03-2008 at 06:33 AM.
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.
I was so impressed I had to try to see if I could do something similar with Gimp:
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...
Last edited by RobA; 04-27-2010 at 03:47 PM.
My tutorials: Using GIMP to Create an Artistic Regional Map ~ All My Tutorials
My GIMP Scripts: Rotating Brush ~ Gradient from Image ~ Mosaic Tile Helper ~ Random Density Map ~ Subterranean Map Prettier ~ Tapered Stroke Path ~ Random Rotate Floating Layer ~ Batch Image to Pattern ~ Better Seamless Tiles ~ Tile Shuffle ~ Scale Pattern ~ Grid of Guides ~ Fractalize path ~ Label Points
My Maps: Finished Maps ~ Challenge Entries ~ My Portfolio: www.cartocopia.com
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.