zoot Posted July 6, 2012 Report Share Posted July 6, 2012 Blending of two different terrain textures currently look quite bad:Any ideas for how we might solve this?(Relevant ticket.) Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 6, 2012 Report Share Posted July 6, 2012 Basic solution would be to have bigger textures, and use bigger blending masks. Quote Link to comment Share on other sites More sharing options...
zoot Posted July 6, 2012 Author Report Share Posted July 6, 2012 Have any of you heard of something called 'vertex blending' or 'vertex color blending'? I can't find any really concise information about it, but it sounds like a way to do it without any masks. Quote Link to comment Share on other sites More sharing options...
Sonarpulse Posted July 6, 2012 Report Share Posted July 6, 2012 Vertex blending is much worse. Think vertex shading vs per-pixel shading. Also since the heightmap and texture max seem to have the same resolution, it would basically have the same affect.Perhaps for the hieghtmap some sort of "intelligent dithering" stretching algorithm instead of the bilinear/trilinear we have now would look nice. That would do stuff like mini sand dunes and patches of snow automatically. Quote Link to comment Share on other sites More sharing options...
zoot Posted July 6, 2012 Author Report Share Posted July 6, 2012 Vertex blending is much worse. Think vertex shading vs per-pixel shading. Also since the heightmap and texture max seem to have the same resolution, it would basically have the same affect.I doubt that. See this page for example before and after shots. The 'before' shot looks essentially identical to our current terrain blending. Quote Link to comment Share on other sites More sharing options...
Sonarpulse Posted July 6, 2012 Report Share Posted July 6, 2012 I dunno, unless it's a new technology with an old name, I'm pretty sure of myself. The vertex blending I know is a old technology used extensively in older FPSs for example. It's only as good as the number of vertices you have in your mesh. I think the example you showed just has a lot of vertices. See this old article: http://www.katsbits.com/tutorials/idtech/vertex-texture-blending-applied-to-models.php Quote Link to comment Share on other sites More sharing options...
feneur Posted July 6, 2012 Report Share Posted July 6, 2012 I doubt that. See this page for example before and after shots. The 'before' shot looks essentially identical to our current terrain blending.I don't know anything about the technical aspects, but just looking at it I don't really see that much difference between the before/after in terms of blending (depending on exactly what is going on there in the middle, it's hard to know whether it's several dirt/grass/grass-mixed-with-dirt textures or just the two grass textures with a dirt texture in between). There is a big difference in the actual textures though, and I wouldn't say it's fair to compare the blending when you're using such different textures What I would think might work best is what I think someone else suggested somewhere: to use different blending textures for different textures, say three different sizes. Or at least create larger blend textures that would make the transition smoother. As far as I can see there are two issues that would need to be thought out by people who know more about the programming for something like that to work:If we use different sized blend texture, how would it be determined which one to use? It could easily be described in the texture XML which size each individual texture would use, but if you have a transition between say a road texture which would use a sharp transition and a dirt texture that has a smoother. Perhaps it could be dependent on which one is on top (see http://trac.wildfiregames.com/wiki/Atlas_Manual_Terrain_Tab#Texturepriority )?And is it possible to have transitions which covers more than one tile? (I.e. a blend texture that's larger than one tile.) Quote Link to comment Share on other sites More sharing options...
zoot Posted July 6, 2012 Author Report Share Posted July 6, 2012 I don't know anything about the technical aspects, but just looking at it I don't really see that much difference between the before/after in terms of blendingThen you need to look closer! You can basically trace 'staircases' along some of the transition lines in the first image, while in the second image they are completely smooth and curvy.The problem with blend textures/masks/maps/whatchamacallit seems to be that there are so many cases to handle.If we use different sized blend texture, how would it be determined which one to use? It could easily be described in the texture XML which size each individual texture would use, but if you have a transition between say a road texture which would use a sharp transition and a dirt texture that has a smoother. Perhaps it could be dependent on which one is on top (see http://trac.wildfire...Texturepriority )?I'm not sure, but I think maps do not currently store any such priority/ordering/layering information, though that ultimately may prove a useful path. The feature in Atlas seems more like a 'trick' that gives the map author a way to pick which blending texture is used. Quote Link to comment Share on other sites More sharing options...
zoot Posted July 6, 2012 Author Report Share Posted July 6, 2012 What if we 1) identified the tiles making up the border between the two differently textured regions, 2) fitted a curve to this border and then 3) applied a blending mask along the curve (sharp mask for "roads", dithered mask for sand, etc.)?I believe there is already some logic for drawing curves in the engine (used for territory borders). Quote Link to comment Share on other sites More sharing options...
feneur Posted July 6, 2012 Report Share Posted July 6, 2012 Then you need to look closer! You can basically trace 'staircases' along some of the transition lines in the first image, while in the second image they are completely smooth and curvy.The problem with blend textures/masks/maps/whatchamacallit seems to be that there are so many cases to handle.I'm not sure, but I think maps do not currently store any such priority/ordering/layering information, though that ultimately may prove a useful path. The feature in Atlas seems more like a 'trick' that gives the map author a way to pick which blending texture is used.Ah, true that problem (which I personally wouldn't call blending as much as smoothing ) goes away. The trouble with reading things too quickly =) The actual blending (as in transition from the one to the other) between two textures still seems to be the same in the above/below though which obviously was what I was looking at Quote Link to comment Share on other sites More sharing options...
Sonarpulse Posted July 6, 2012 Report Share Posted July 6, 2012 What about my dithering idea? not to self promote, but I always thought smoothly blended textures looked really bad. Even if the alternative is the wavy artifacts we see here (akin to the line of sight "circle" in aoe II I might add).In real life, sand turns to grass as patches of grass start to appear more and more, and the soil gains more nutrients. with snow, patches of snow become bigger and bigger until they cover the entire ground. I see no real life inspiration for smooth blends, only granular ones. Quote Link to comment Share on other sites More sharing options...
zoot Posted July 6, 2012 Author Report Share Posted July 6, 2012 What about my dithering idea? not to self promote, but I always thought smoothly blended textures looked really bad. Even if the alternative is the wavy artifacts we see here (akin to the line of sight "circle" in aoe II I might add).I didn't quite understand it, to be honest. Perhaps you can elaborate? Personally, I very much dislike the staircase artifacts. Quote Link to comment Share on other sites More sharing options...
Sonarpulse Posted July 6, 2012 Report Share Posted July 6, 2012 Here is normal blending versus two types of dithering. (The third, not showed, approach is a clean break in the middle.)Now dithering is traditional y used as a way to go from a a smother image to a pelleted one, but perhaps the two steps of stretching the texture map and dithering it could be combined into one "shader" (I'm not sure how/if OpenGL let's one add texture stretching methods). Quote Link to comment Share on other sites More sharing options...
zoot Posted July 7, 2012 Author Report Share Posted July 7, 2012 So, are you suggesting replacing the current blending textures with dithered ones? Or would it involve some new blending technique too? Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 7, 2012 Report Share Posted July 7, 2012 (edited) Dithering is sort of what the game uses right now, though not completely. The thing is that using 64x64 texture for that, like it does now, is a bit too small for proper blending of some textures (such as sand->grass, wet->dry).The game actually uses a full square to blend a texture, using on of 16 (I think) textures. Edited July 7, 2012 by wraitii Quote Link to comment Share on other sites More sharing options...
zoot Posted July 7, 2012 Author Report Share Posted July 7, 2012 Wouldn't larger textures just make for artifacts of higher resolution? Quote Link to comment Share on other sites More sharing options...
Josh Posted July 7, 2012 Report Share Posted July 7, 2012 If having bigger textures would improve the terrain blending, couldn't we have an option to switch between the current textures and the proposed bigger ones? This would only be if higher resolution ground texture would degrade performance at all. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted July 7, 2012 Report Share Posted July 7, 2012 I think some are talking about increasing the resolution of the blend textures, correct? Not the actual terrain textures. Most of the terrain textures are 512x512 (older biomes) or 1024x1024 (updated biomes). I don't think the game's terrains need to be any higher res than 1024x1024.These are a sample of the blend textures in the game: Quote Link to comment Share on other sites More sharing options...
zoot Posted July 7, 2012 Author Report Share Posted July 7, 2012 If having bigger textures would improve the terrain blending, couldn't we have an option to switch between the current textures and the proposed bigger ones? This would only be if higher resolution ground texture would degrade performance at all.It would, but I am unconvinced that it would resolve the staircase artifacts in any way. Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 7, 2012 Report Share Posted July 7, 2012 In the current system, here's what you get (the blending texture are the size of a tile):To improve the blending between very different textures, we'd need blending texture that occupy at least 2x2 tiles. They could be placed over a tile and go beyond the size of a tile. I'm not completely sure how to do that, however. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 7, 2012 Report Share Posted July 7, 2012 I think some are talking about increasing the resolution of the blend textures, correct? Not the actual terrain textures. Most of the terrain textures are 512x512 (older biomes) or 1024x1024 (updated biomes). I don't think the game's terrains need to be any higher res than 1024x1024.These are a sample of the blend textures in the game:Sorry, that's what I meant. Quote Link to comment Share on other sites More sharing options...
zoot Posted July 7, 2012 Author Report Share Posted July 7, 2012 (edited) To improve the blending between very different textures, we'd need blending texture that occupy at least 2x2 tiles.I don't think that is the right solution, unless we are talking about different things. What I am talking about are the jagged, zig-zagging artifacts that readily span more than 2x2 tiles: Edited July 7, 2012 by zoot Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 7, 2012 Report Share Posted July 7, 2012 I'm talking about that too... By using bigger blending squares/textures, we could blend more smoothly as we'd have more space for the gradient. Quote Link to comment Share on other sites More sharing options...
zoot Posted July 7, 2012 Author Report Share Posted July 7, 2012 Okay, but then you would need many more (16^(2x2) or something) blending textures to cover all cases and you would still have artifacts, just not as frequently. Quote Link to comment Share on other sites More sharing options...
iap Posted July 7, 2012 Report Share Posted July 7, 2012 I think applying a "Gaussian blur" filter on all the texture could make them blend better. This could be applied by the engine in runtime, if it's not too heavy on the CPU (or GPU). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.