Game Development Community

Atlas2 (MS4) Blended Terrain - Black Splotches

by Ben Sparks - Warspawn · in Torque Game Engine Advanced · 09/29/2006 (12:56 pm) · 9 replies

Ok, I've been playing around and reading various things trying to get a good atlas blended terrain going, but for some reason it keeps coming up with these black splotches...


www.superiorcode.com/download/capture.png

I noticed that L3DT exports 2 Alpha tile maps, according to the TDN it's possible to do multiple Opacity maps, but I haven't seen how. I'm not sure if that is even necessary.

Here is the import code I'm using. I have the textures in the same order as the L3DT alpha list, although according to the TDN it should be in REVERSE... it doesn't seem to matter either way.

// Bring up a dos window to display current status. This lets you see immediately how the import/generation process is going.  
enableWinConsole(true);

// Enable logging so we get a console.log. This is useful if something goes wrong - we can check the log for errors.  
setLogMode(6);

echo("Starting Atlas Creation Process...");

// Generate geometry from a raw 16 bit heightfield.  
atlasOldGenerateChunkFileFromRaw16("island_import/island2_2049.raw", 2048, 1.0, 0.003341, "island_import/islandGeom.chu", 0.5, 4);

// Import from old CHU format to .atlas.
importOldAtlasCHU("island_import/islandGeom.chu", "island_import/islandGeometry.atlas");

// Import a tiled opacity map we generated with L3DT. Note we save it in PNG format to prevent artifacts in the blend results. 
atlasGenerateTextureTOCFromTiles(4, "island_import/alpha_Alpha1/Alpha1_x%dy%d", "island_import/islandOpacityTex.atlas", 1);

// Import a tiled lightmap we generated, as well. We store these in JPEG as a little error is not going to be noticeable.  
atlasGenerateTextureTOCFromTiles(8, "island_import/LM/island2_LM_x%dy%d", "island_import/islandLightmap.atlas", 1);

// Finally, combine into a unique-textured terrain. Notice how this command is grouped 
// onto multiple lines, to make it easier to read and understand. The first four parameters 
// (the .atlas files) are the output file we are generating, and the three input files we 
// need (geometry data, opacity data, and lightmap data).
atlasGenerateBlenderTerrain(
                    "island_import/islandBlended.atlas",
                    "island_import/islandGeometry.atlas",
                    "island_import/islandOpacityTex.atlas",
                    "island_import/islandLightmap.atlas",

                    // This is the size of the virtual texturemap the blender will be producing. This directly affects how much the source images are tiled, so it is 
                    // hardcoded into the terrain. This must be a power of 2 - if you get it wrong the engine will nicely let you know and suggest some alternatives
                    32768,

                    // These are the source textures that the blender will be using. List them in the REVERSE order that L3DT shows in the alpha map export 
                    // wizard. If you specify too few, then your terrain may cause the engine to crash.
                   "island_import/yellowsand1",
                   "island_import/rocks1_grey",
                   "island_import/rock1",
                   "island_import/grass1_dry",
                   "island_import/rock1b",
                   "island_import/grass1",
                   "island_import/grass1_lush",
                   "island_import/dirt1"
);
echo("");
echo("Atlas Creation Process Complete!");
                    /*"island_import/dirt1",
                    "island_import/grass1-lush",
                    "island_import/grass1",
                    "island_import/rock1b",
                    "island_import/grass1-dry",
                    "island_import/rock1",
                    "island_import/rocks1-grey",
                    "island_import/yellowsand1"*/

Any help or insight? Thanks

#1
09/30/2006 (5:27 am)
That's a problem with the alpha maps (if you're *sure* you haven't got a texture missing from your terrain directory). You can only use one map as far as I could work out from some of the posts here and from a lot of experimentation, unless you want to mess with the source code. If you have too many textures for one map you can specify which of the 4 layers the textures go into.

So you can have more than one texture in a layer in L3DT. You can specify this on the first dialog when you create the maps. Just click on the layer number and move it into the layer you want. That way you can cram 6 or 8 textures into the one map. It doesn't look as nice, but at least it lets you work.

I got the feeling from a post Ben made that using more than one map was a future goal, but it's not in the immediate future.
#2
09/30/2006 (7:36 am)
Your black splotches appear to be where the 5-8 textures should be. Yes, you can use multiple opacity maps, but it does require some source changes. Ben will surely find a decent (speed+stable) method soon enough, so personally I wouldn't bother trying to hack it in right now. Just learn to make 4 textures look good until then.
#3
09/30/2006 (8:15 am)
Ok, that helps a lot guys, thanks. I had a feeling it was due to my missing 2nd alpha map import. I will just make it work with 4 textures for now :D
#4
10/03/2006 (6:29 am)
Howd you end up Ben, did it work?
#5
10/03/2006 (8:21 am)
No, I tried moving the extra ones all to layer 4, and that did end up making it so there was only one alpha map, but it wouldn't import it. It kept coming up with errors. So I ended up just using the Unique texture method and that works. (The climate that I wanted to use: temperate(coastal) maybe is the problem.) But I'm pretty happy now that the unique ones aren't coming up blue anymore (which is why I was trying blended to begin with). I'll just wait until more blended improvements show up I suppose.
#6
10/03/2006 (10:09 am)
Weird, works fine for me. What errors were you getting?
#7
10/03/2006 (12:07 pm)
Well, perhaps I spoke too soon... whatever I tried the first time wouldnt work, however I just tried to blend another one and it's working.

Question while we're at it, the virtual texture size 32768, that is the default from TDN, any ideas on if/what that should be changed?
#8
10/03/2006 (11:03 pm)
Hmm, I hope I'm not getting into a world of hurt. Oh well it's all fun and games until someone gets hurt. :)
#9
10/04/2006 (2:11 am)
@Ben, I haven't experimented with the texture size as yet. However looking at the docs it would appear to be the equivalent of a real texture size on any tiled surface. So the bigger you make it the less times it will be tiled over your massive landscape I would imagine.

If I'm interpreting the comments correctly the size relates only to number of times it is tiled rather than the quality of the image. So rather than stretch your texture over the whole terrain as a unique terrain would, it tiles it.

Whether it improves quality if you make it bigger than your terrain, I haven't a clue. For example you can produce high quality textures in L3DT with (say) 4 times the size/density of your terrain. Whether making the virtual texture 4 times as large as your map would up the quality of a blended terrain I don't honestly know. I will try it when I get a couple of spare hours. In the meantime if you find out I'd love to know!

I could be completely wrong about the stuff above, and if so I would appreciate any more accurate info anybody can pass along.

Thanks,

Dave.