Home Technical Talk

Real quick tree texturing question

Hey, apologies for dropping threads simultaneously but the questions are unrelated.

When UV'ing a tree, is the main trunk/bark texture usually placed in the same 0-1 as the foliage?

I know how to get my trunk looking good in terms of thirding and tiling, but I'm not sure what the common method is. I'm using UE3 if it matters.

So should I use the same 0-1 on say a 1k map, or should I use a 2:1 map like a 1024x512 or something?

Also, for the 3D branches (some branches will be on planes with the foliage) is it a good idea to just rip them off of the already UV'd trunk so they receive the same texture or should I make branch UV's unique? I seem to get stretching/resolution issues when ripping them from the trunk, but I could be doing it wrong.

Thanks

Replies

  • Tom Ellis
    Ok been doing a bit of research, I haven't found a specific answer but should I be doing it a similar way to how SpeedTree handles textures?

    Can I use a second UV channel for the tiling bark texture and put the foliage in the other channel? Is this how it should be done or is there a better way?

    I've gone through like every tut on the wiki and it never covers the trunk texture. In fact most show the leaf cards on a single sheet which leads me to believe I should be using a second sheet in some capacity.
  • PredatorGSR
    Offline / Send Message
    PredatorGSR polycounter lvl 14
    Foliage should almost always be a separate shader, and usually a separate texture sheet. In most games, there are separate foliage shaders you use, as well as the fact that when you add an alpha, it usually makes the texture a dxt5 instead of dxt1, which quadruples the size, so you want to keep it as small as possible, which means only having foliage in the sheet. You also want to be able to use very small textures, which look fine from distance, while a trunk will usually be able to be seen up close and require higher resolution.

    It varies based on how the engine does foliage, but those are the guidelines I've worked with on a variety of engines.
  • Justin Meisse
    Offline / Send Message
    Justin Meisse polycounter lvl 18
    thirding, put them on the same texture so you have 1 draw call instead of 2. An extra UV channel is going to double the size of the models UV data. In max you can view this data by going to tools>channel info

    On a related note the channel info is useful tool for error checking your work, in the past I've had models mysteriously gain extra UV channels and vertex colors, you can select the erroneous channels, right click - clear them out.

    <edit> and what PredatorGSR said, it depends on your engine.

    also, I've always used dxt1 1 bit alpha, pretty much the same file size as dxt 1 with an alpha channel. I typically try to give alpha planes a higher pixel density because the 1 bit alpha will look pretty crunch at low rez.

    Check out the trees in Warhammer Online, waving branches were achieved by animating the UV's and normal thief was used to make the alpha planes light nicely.
  • Tom Ellis
    Thanks for the replies.

    Your suggestions seem to conflict! I'm using UE3, which I know supports multiple UV channels so 2 shader setups would be possible.

    Speedtree uses 2 or more I think but the Speedtree meshes have their own properties which allows 'branch material', 'leaf material' etc.

    I've been Reading through all the great info over in NAIMA's thread where EricChadwick has posted loads of help on vertex normals and lighting, as well as alpha info.

    So with UDK as the target engine, would it be advisable and common to use the 2 channels, one for bark, one for anything with an alpha?

    And going back to the branches, is cloning them around from a UVd trunk the best way to do it or would I get better results from UVing them separately and giving them unique texture space? I'm guessing it's not worth giving them unique textures since they'll barely be visible on a heavily leafed tree.
  • Rufuss
    So if you use a tiling bark texture.. how would you deal with seams?
  • Eric Chadwick
    I'm using UE3, which I know supports multiple UV channels so 2 shader setups would be possible.
    Possible, yes. Necessary, no. You don't NEED a separate UV channel for bark vs. foliage, because they don't share the same polygons. You only need multiple UV channels if you need two different UV layouts for the same set of polygons. Anyhow I hear UDK needs the 2nd UV for light mapping.
    And going back to the branches, is cloning them around from a UVd trunk the best way to do it or would I get better results from UVing them separately and giving them unique texture space? I'm guessing it's not worth giving them unique textures since they'll barely be visible on a heavily leafed tree.
    Right. I would suggest just using the same material as the trunk. You can scale the UVs on the branches if the texture gets too small. You can put the UV seam along the tops of the branches, no one will see it there.

    It is generally a good idea to pack the "dead branch" and "foliated branch" in the same texture sheet. It's also a good idea to have 2 or 3 foliated versions in there too, for variation.
  • Eric Chadwick
    Em has a good example here. You could put your dead branch in the remaining spot.
    http://www.polycount.com/forum/showthread.php?p=1162887#post1162887
  • Tom Ellis
    Thanks a lot Eric, big help as usual.

    I'll have a go and see what I get. I think UDK does indeed use UV2 for the lightmap so it'll have to be one sheet for each tree.

    With that in mind, using Em's layout approach, should I just stick the bark tile in one side of the sheet and use the remainder as in Ems layout?

    Finally, now we've come to the conclusion tiling is the way to go... I've just realised I've never created a tiling texture! Now, I know how to do it without thirding, just let the UVs run off the sheet and it'll tile. But with thirding, lets say I've got a grassy part at the bottom for the floor blend and then a main part and a top bit. How do I tile it vertically? Do I divide the geometry up and overlap the UVs on the relevant third?

    I've looked at Poop's tut sheet but I don't get how you'd lay UVs on.

    Thanks again.
  • divi
    Offline / Send Message
    divi polycounter lvl 12
    you dont have to use only one material. apart from the fact that you can change the UV channel udk uses on a particular asset to store the lightmaps in you can also use a multi/sub material in max with 2 mat IDs (both materials need to have a bitmap in any slot for them to be exported with the mesh) and then assign two materials to the same mesh. would probably be the best way to approach it since you can ommit certain maps from the leaf material you want on the bark as well as re-use the material on other assets that might not need 2 materials.

    to tile the bark i tend to do it like this

    2010-06-20_1247.png

    the tiling part on the left simply gets copied to the right and messed with in areas that dont connect to the tiling bark part. the guides represent the areas where i added padding to avoid visible seams due to mipmapping. (disregard the horizontal guide)

    there are probably better ways to do it, but that's what works for me.
  • Eric Chadwick
    PredatorGSR and Justin both had good advice, not contradictory. Except Justin advocates DXT1 for the alpha instead of DXT5. I personally hate DXT1, since in my experience the on/off edge didn't make a smooth filtered edge when filtered and alpha tested, I got more stairstepping with DXT1. But the memory savings is a big win. Lots of ways to skin a cat.

    Justin thanks for the Warhammer pointer, will check it out. FarCry also used UV scrolling for their foliage, which didn't look so hot IMHO, the foliage often went past the polygonal edge so you would see a hard-edge disappearance. With Crysis they went with a vertex shader instead (sine waves etc.), looks very nice.
    With that in mind, using Em's layout approach, should I just stick the bark tile in one side of the sheet and use the remainder as in Ems layout?
    Probably not, depends on the hardware and where the perf/mem bottlenecks are. But in general you would want the textures requiring alpha to be in their own bitmap, to minimize how much extra memory you're spending on alpha storage. Bark doesn't need alpha, so make it a separate bitmap.
    (how to tile within a multi-texture atlas?)
    Right? Basically, cut edges into your geometry where ever you need the UVs to tile. So with divi's texture, the bottom of your tree trunk would be cylinder-UVd and scaled by half to use only the right side, but could go vertically as far as needed to keep tiling vertically. The rest of the trunk would also be cylinder-UVd, but it would be scaled by half to use only the left side of the texture. Make sense?
  • Tom Ellis
    Yep, perfectly clear thanks again Eric.

    On a slightly related note. On my exploration of trees, it seems that what people have produced here on PC is quite honestly better than what is seen in a lot of games! The level of quality seems higher. Now I guess that could be the 'limitless' style of a portfolio piece, but take RexM's trees, or Adams trees in his current environment, then compare them to say the trees in GTAIV... I think I've been setting my expectations too high! I was expecting to just knock up something like Adam / RexM have been doing on my first attempt, obviously I didn't, but what I have come up with looks much more aceptable when compared to some certain game examples. Trees and foliage really seem to be a bit of a science in the game art world. I guess they've always been one of those things that are very difficult to make look great.

    Some games obviously manage it, Crysis for example, the trees in Red Dead Redemption look pretty great when you get into the foresty areas, but I'd say the majority you see are often a little sketchy looking.

    Thanks again for all the help, I got there in the end!
  • Justin Meisse
    Offline / Send Message
    Justin Meisse polycounter lvl 18
    I threw this together quick, I split the UVs were I wanted to tile, so I can devote a quarter of the UVs to a tiling bark texture, to make painting the texture easier just make that layer a smart object. Maybe this is a little extreme, just wanted to show that you don't have to move past 0-1 to tile things.
    screenshot.38.jpg
Sign In or Register to comment.