Game Development Community

Atlas texture generation crash

by ENAK · in Torque Game Engine Advanced · 04/27/2007 (12:06 pm) · 45 replies

Hello,

A new guy here - and already with some problems. :) Weird. :)

Anyway, this is the problem. I'm trying to create a new atlas terrain + texture. I generated some terrain using L3DT, exported to raw, then created everything everything else up to texture...

This is what I have:
Some terrain in raw with 2048x2048 resolution (+1 of course)
The texture jpg for it with 8192x8192 resolution.

I'm following what's in the wiki. The atlasOldGenerateChunkFileFromRaw16, importOldAtlasCHU work fine.

But when I try to generate the texture - TGEA crashes to windows.

atlasGenerateTextureTOCFromLargeJPG("terrain_water_demo/texture.jpg", 8, "terrain_water_demo/texture.atlas");

I've tried fiddling with the tree depth but no value works.

The crash occurs on the purge method in the atlasImportLargeImage.cpp after it does a couple of tiles... (Not always the same number of them...)

for(S32 j=0; j<tileCount; j++)
      {
         // Allocate a chunk...
         AtlasTexChunk *atc = new AtlasTexChunk;
      Con::printf("   Point 1 %d/%d",j,tileCount);
	  atc->mFormat = AtlasTexChunk::FormatPNG;

         // Copy from the JPEG working space to the bitmap.
         GBitmap *gb = new GBitmap(tileSize, tileSize);
	  for(S32 k=0; k<tileSize; k++)
            dMemcpy(gb->getAddress(0, k), rows[k] + j*tileSize*3, 3*tileSize);
         atc->bitmap = gb;

         // Get the stub.
         AtlasResourceTexStub *tStub = arttoc->getStub(treeDepth-1, Point2I(i,j));
         // Store, then purge, the chunk.
         arttoc->instateNewChunk(tStub, atc, true);
		 tStub->purge(); // <--- crash!
      }

If I comment this purge - it goes all the way, but then crashes on
arttoc->generate(RectI(0, 0, tileCount, tileCount));

So... Any ideas? This is TGEA 1.0.1, compiled with VS 2005 SP1.

...help... :(

I've also tried using a smaller texture or to generate from tiles - always crashes the same way. :(

Here's a more or less useless tail of the log.

atlasGenerateTextureTOCFromLargeJPEG - Successfully opened JPEG 'terrain_water_demo/texture.jpg' for reading.
atlasGenerateTextureTOCFromLargeJPEG - Image is 8192px (hopefully square!).
atlasGenerateTextureTOCFromLargeJPEG - Tree depth of 5 mandates 16 tiles on a side.
atlasGenerateTextureTOCFromLargeJPEG - Therefore, tiles are 512px wide.
AtlasDeferredFile::ensureStreamWritable - switching file into writable mode... This may cause a crash if you have other copies of Torque accessing it!
atlasGenerateTextureTOCFromLargeJPEG - Atlas file 'terrain_water_demo/texture.atlas' created!
atlasGenerateTextureTOCFromLargeJPEG - Initialized Atlas threads, now importing texture data...
atlasGenerateTextureTOCFromLargeJPEG - Allocating ~12288 kb of JPEG decompression working area...
atlasGenerateTextureTOCFromLargeJPEG - Generating 512px by 512px leaf tiles...

About the author

Recent Threads

Page«First 1 2 3 Next»
#41
07/09/2007 (4:01 pm)
I just tried exporting a map bigger than 2048. After clicking YES on the big warning my L3DT error log says this:
L3DT Atlas Export - user cancelled export after >2048 HF warning.

CZeoFunc::CallFunction error:
 - The function 'ExtSaveAtlasFile' in the plugin 'l3dt_atlas' returned an error.

zeofunc_file_export_atlasHelper error:
 - call to export function failed

CZeoFunc::CallFunction error:
 - The function 'atlasEx' in the plugin 'L3DT-CORE' returned an error.

I'm suspicious about the "user cancelled" part.... (Yes, I'm sure I clicked yes on the warning). Is this something on L3DT's end or the exporters?
#42
07/09/2007 (4:04 pm)
Are you using the June 8th edition of the Exporter? As far as the error, I haven't run into that. I do question the ">2048 HF warning" because I remember reading somewhere that Atlas is only stable at 2048. Growing terrain more than that would cause holes in the terrain. But *I* have never run into that and can make 16k x 16k terrain just fine. I can't remember where I read that from. I think it was the Exporter, but I can't be sure.
#43
07/09/2007 (7:43 pm)
The 2048 limitation your talking about is with Legacy terrain.
#44
07/09/2007 (8:41 pm)
Same thing with the June 8th exporter. Incidentally (suspiciously) I get exactly the same log messages if I click "No" on the warning... hmmmm...
#45
08/09/2007 (8:01 pm)
Has anyone run into the "unallocated block" memory problem when generating a blender terrain? I implemented the fix described by Ben above which allowed the lightmap and opacity atlas files to be generated using atlasGenerateTextureFromTiles(). The process of creating the blender atlas file crashes when the opacity data is being copied. Same type of problem as in the tiled texture above.

I commented out the purge() command and it worked. Used lots of memory but worked. The following is from atlasResourceTOC.h:

virtual bool copyChunksToTOC(AtlasResourceTOC < StubType >  *toc, S32 reformat =  - 1)
         {
               for (S32 i = 0; i < getStubCount(); i++)
               {
                     // Get our original stub, and issue the load.
                     StubType *origArgs = getStub(i);
                     immediateLoad(origArgs, EditorLoad);

                     // Make a chunk copy and instate it.
                     StubType *args = toc->getStub(i);
                     AssertFatal(origArgs->hasResource(), "AtlasResourceTOC<T>::copyChunksToTOC - no chunk present in chunk copy.");

                     toc->instateNewChunk(args, origArgs->mChunk->generateCopy(reformat), true);

                     args->purge();
                     //origArgs->purge();   <== PROBLEM LINE
               }

               U32 len = mFile->getDeferredFile().lockStream(true)->getStreamSize();
               mFile->getDeferredFile().unlockStream();

               Con::printf("   - Copied %d chunks via copyChunksToTOC, stream len approx. %d bytes", getStubCount(), len);


               return true;
         }
   };
Page«First 1 2 3 Next»