Home Technical Talk

Huge terrain texturing

c22dunbar
polycounter lvl 14
Offline / Send Message
c22dunbar polycounter lvl 14
Hey Guys!

I've been wandering how games like Company of Heroes texture their terrains. In a way that the whole map is not beeing tiled through alphamap, but actually there are roads, bricks and details more or less unique for the whole map.

I've read about Id Software/Splash Damage Megatexture technique which i find absolutely AWESOME, but it's out of my reach. Most tutorials i came across describe only alphablending method.

One way i was examining is to create separate mesh(quadstripes) for the roads, that is lying on top of the actuall ground. That mesh would have had an applied texture with transparent sides so that it would blend seamlessly with the grass/mudd/sand or whatever lies underneeth.

I really doubt that this is the approach THQ/Relic used to create CoH environments.

If any of You know the way to go, please, advise me.

Cheerio.

Jacek.

Replies

  • Mark Dygert
    Looks to me like they have vertex color blending to mix tiles together, along with a decal system and possibly some floating geometry. But that's just my best guess.
  • Ryno
    Offline / Send Message
    Ryno polycounter lvl 18
    I think Vig has a pretty good guess. The key to breaking up tiling of one type of surface material is to have several variations. So instead of just dirt and grass, you have dirt, dirt2, dirt/grass mix, grass 1, and grass 2. Use a combination of masks and vert colors to control what is displayed where. Company of Heroes' texture transistions look fairly soft overall, probably indicating vertex color blends.
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    ok, the main texture transitions are not that big of a deal. also the explosion marks and burns, for i understand that the floating geometry that Vig mentioned comes to work. the actuall problem are the roads and special environment elements. like here, where on the right side there is this this single tree/bush, some stones and a grass on the ground. i assume that is a floating geometry too.

    but the real deal are the roads. as they look pretty well composed into the ground. floating props as well?
  • Mark Dygert
    I think that area is floating geometry that has an opacity blend around its outer edges? They could be using the same trick for the roads.

    Instead of vertex color blending, they could be using pretty tiny RGB maps. I think EQ mentioned using something like that on Darkest of Days. Each channel would reveal a specific material. There was a strange restriction too, like you couldn't blend all three together and 2 needed to be fully blended for the 3rd to be revealed?

    vertexblend.jpg
    I whipped this up a long time ago as an example for some stuff we where doing in 3dsmax but it kind of illustrates what I was thinking.
  • Joshua Stubbles
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    ^ we did that on Forza 3 as well. Each terrain piece would have 2-3 textures that were mixed with either a greyscale or RGB blendmap.

    The roads are most certainly floating with edge alpha - they were doing this back in the Command & Conquer: Generals editor, too. CoH is using alpha blending on it though, to make it look more natural (albeit more expensive to render), which makes it harder to tell. Even more modern games like ArmA2 use floating roads like that. On Forza 3 we couldn't do the floating road thing of course. Our edges were blended using a texture blend just like the rest of the terrain.
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    hehe, i know how this RGB blending works :) i've implemented this before. actually i went a bit further. i assigned another blending map under one of the RGB channels and subdivided that channel into another 3 detail textures.

    thanks for the answear though:)

    my main concern was about the roads.:)

    right now i'm thinking of using polyboosts tool to lay the geometry on top of a surface of a heightmap-generated terrain.
  • Joshua Stubbles
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    c22dunbar wrote: »
    right now i'm thinking of using polyboosts tool to lay the geometry on top of a surface of a heightmap-generated terrain.

    Does that generate mapping coords? I'd suggest using splines, since it generates UV's for you already. Though if you decide to go the polyboost route, Max 2009+ (I *think*. I know 2010 does) has something called spline mapping. If you make a spline down the center of your "road" and apply an unwrap to the mesh, you can pick the spline as a guideline for the UV map - works amazing well for things like that.
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    i've done a quick check and heres what i've found:

    when You draw splines on top of a terrain and then using sweep modifier(i don't know how else) create geometry the place where the road sticks to the terrain is in the middle(that's rather obvious), which causes the borders to be sometiems 'burried' in the ground. is there any way to project that missplaced vertives onto the surface? that wouldnt be the case with strip-laying tool. though the automatic mapping coordinates while using spline/sweep may end up to be an unbeatable profit.

    Vessago, You've mentioned something about spline guideline for the mapping coordinate of a mesh. i'll have digg into that as it might be an ultimate way to deal with the problem.
  • Mark Dygert
    You're looking for a checkbox that says "generate mapping coords" inside of Rendering in the spline menu. It also exists in sweep if your curious, pretty handy. Why they name things what they do is amazing sometimes... heh.

    Then set the spline to renderable, then setting it to rectangle. Probably apply an edit poly on top and delete the bottom part of the geo so you're left with just a plane.

    You can also use a conform compound object but it will smash that object completely flat to the surface. So it works best on flat objects. If you need height afterward you can use the shell modifier.
    Conform.jpg

    You could also use a spline painter script to paint a spline on the surface of the terrain, it should follow it along pretty closely. Neil Blevins has a great one in his pack of scripts.
    http://www.neilblevins.com/soulburnscripts/soulburnscripts.htm
  • Joshua Stubbles
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    here's a brief explanation on the spline mapping, too:


    This is what you'd obviously get from a top down UV map - not what you want for a road texture.
    spline1.jpg


    Cut a loop down the center of the road, then create a linear spline from it.
    spline2.jpg


    Apply an unwrap modifier, select face mode, then choose the "spline" option. Choose the spline you just created, then choose "planar" from the spline mapping drop down. You can see that this creates a nice linear UV set (though squished, it's ideal for a road). Just scale/adjust from here.
    spline3.jpg


    Nice road UVs in less than a minute.
    spline4.jpg
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    @Vassago

    that's nice little trick You've got there :)

    @Vig that's exactly what i've done. correct me if i'm wrong but this way makes the borders of a road go either over the terrain or below it, as only the base spline is tangent to the surface. Vassago's way deals with that as it creates a quatstrip that has vertices touching the surface. plus it has the mapping coordinate fix.

    lovely :)
  • Ark
    Offline / Send Message
    Ark polycounter lvl 11
    They probably have deicated tools for the roads and stuff in COH, just like in Crysis.

    You should take a look at Cryengine 2 Sandbox editor. You can lay down multiple layers of textures then use the road tool to overlay. That combined with Decals is all you really need.

    Megatexture still amazes me though. You get great looking terrains with near 100% unique textures.
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    @Ark:

    isn't the cryengine like... expensive? i mean, it's not free, like UDK
  • Ark
    Offline / Send Message
    Ark polycounter lvl 11
    Sorry, didn't know you was looking for a free engine, but then again, UDK isn't free is it? You still have to pay fees if you plan to sell your game.
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    well. the whole question was more about the way to do this. me and my friends are making a game in XNA, so the knowhow is essential here :)


    i'm not looking to buy any engines any time soon :) btw. UDK is free if You use it in non commercial projects. though if You'd plan to sell it, 25% of everything You earn above 5 grand goes to Epic.
  • Ark
    Offline / Send Message
    Ark polycounter lvl 11
    Ahh right!

    Have you looked at world machine/L3DT they can generate blend maps for your terrain.

    STALKER has some decent terrains and all thats modeled in maya, then they use vert colours for blending.
  • ArcticNova83
    I wonder. . . why couldn't Bioware do something like this with Mass Effect?
  • Mark Dygert
    c22dunbar wrote: »
    @Vassago

    that's nice little trick You've got there :)

    @Vig that's exactly what i've done. correct me if i'm wrong but this way makes the borders of a road go either over the terrain or below it, as only the base spline is tangent to the surface. Vassago's way deals with that as it creates a quatstrip that has vertices touching the surface. plus it has the mapping coordinate fix.

    lovely :)
    Yea painting a tri strip will work. I think they both have their place and are valuable methods. It's not that one is better than the other, its that they each suit different needs.

    There are some pitfalls to poly draw:
    - Even with it set to draw on an object it will clip here and there and need tweaking. It might conform a little better in some cases.
    - It tends to have a inconsistent width because its based on the angle of the camera to the strip. When the strip doesn't align to the viewport (because its trying to follow the terrain) you get an inconsistent width. These inconsistencies in the road width cause issues when unwrapping to a consistent tile or viewing the road from other angles than the angle it was drawn at.

    Extreme example to highlight the problem.
    PaintPolyProblem.jpg
    Even when painting in the top viewport you run into hills, valleys lips and over hangs that create problems. Which is the advantage of using poly draw over a spline it conforms, or should. A spline works on a near flat surface just as well...

    The advantage of the spline is that it has a consistent width and UV's to match, to start with. You can stretch the mesh a little to force it to conform to the terrain without having to do a lot of tweaking to the UVs.

    You can try and hand tweak the UV's and the mesh of a poly drawn strip to be more of a consistent width and hope it tiles well.

    I'm not saying don't use poly draw, just watch out for some of the pitfalls and be prepared to tweak the final results with both methods.

    They're both good methods and it depends on the game, the terrain and what kind of setup and time you have as to which you deploy so keep them both in your toolbox =)
  • Mark Dygert
    c22dunbar wrote: »
    @Ark:

    isn't the cryengine like... expensive? i mean, it's not free, like UDK
    Yea its amazing...
    [ame]http://www.youtube.com/watch?v=A1ELRWTXQ1g[/ame]
  • Joshua Stubbles
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    ^ that's how the roads worked in the Command & Conquer editor. Very nifty :)
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    its like showing a footage of Neil Armstrong laying his foot on the moon to a guy who wants to construct his first aeroplane... ;]
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    Vassago, how have You dealt with the streching problem after apllying the spline mapping and aligning the verts vertically? one way is to stretch the whole thing in V dimension, so that each 'segment' has it's own 0-1 texture space(or at least one tilable road image). that approach is a bit lame but i cannot think of any other.

    EDIT:

    the other way would be to stack every segment on top each other, so that they share the same UV space, but again, doing it manually seems like an awful repetative job.
  • Mark Dygert
    You can use the "UVW Map" modifier (instead of UnwrapUVW) and set it to face. It will map each face to the 0-1 space, basically stacking them all for you.

    You could scale the whole thing so one quad fits the 0-1 space and the rest just hangs off and tiles.

    Also texTools has a stack function. You could break all the edges, click stack and it should stack them all on top of each other.
    texTools_ani_stack.gif
  • Joshua Stubbles
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    ^ the only problem with either of these methods is when you have a somewhat sharp turn. You're going to get pinching on the bottom end, and stretching on the top end. The best way to deal with that is hand tweaking, unless you have an automated editor that does it for you.

    Another way you can do it would be to use multiple UVs and textures. So you have a tiled top-down UV texture of just the road, whether it's dirt, concrete or whatever. The next UVs set would be a 1to1 mapped texture that gets multiplied over the top to create the tire marks, wear, edging, etc.
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    regarding the mesh creation:

    I've tried few different methods, and here are some quick points:

    quadstrip from polydraw tools makes the inner edges run under a weird angle:

    screenshot002rk.png

    this doesn't occur when using the spline creation method.

    the stacking of every quad on top of one another UV-wise restricts the way Youd have to create a texture. as every tile would have to fit exactly one quad. but in most cases You'd probably want to fit one tile in 3 or more subsequent quads.

    screenshot001s.png

    i don't know how to break up the UVstrip into 3-quad areas (well again, not manually). so i guess the only way that is left is to fit the first 3 quads and let the rest just hang in space.

    PS. dont mind the awful texture, as it's just for testings sake ;]
  • Ark
    Offline / Send Message
    Ark polycounter lvl 11
    You could just draw a quad strip, then add bones and IK, then you could move the joints around to get some nice smoothing?
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    wouldnt work. the problem is the mesh density. If You squeeze a quad like that, there'll always be such texture deformation.
  • Eric Chadwick
    If you use a Loft, you can set the number of subdivisions across the width to be whatever you want. You could also simply create a 3-segment spline to use as your Loft shape, so you can precisely set the widths of the segments.

    Or you can use quadstrip, then select the edge ring, and use Connect with the options dialog, it has a squeeze/expand control for controlling the width of the segment.
  • c22dunbar
    Offline / Send Message
    c22dunbar polycounter lvl 14
    or You could simply use mesh/turbosmooth and then remove the inner loops, but since it's for the game purposes, You'd want to keep it low, or apply the same LOD algorithm You use for the terrain mesh.
  • Joshua Stubbles
    Offline / Send Message
    Joshua Stubbles polycounter lvl 19
    @Eric - that's how we did our road surfaces. Lofted shapes with the step function. It was crucial to have road angle and camber to be accurate to the GPS data for the tracks. So each time we had an elevation or camber change, a new cross section spline was created and mapped to that step of the loft spline. Very tedious, but very accurate.
Sign In or Register to comment.