Game Development Community

Fatal: AtlasFile::CreateNew - unknown TOC type

by Jesse McKinney · in Torque Game Engine Advanced · 07/01/2006 (10:56 pm) · 49 replies

Im on the final step of the Atlas 2 terrain creation, and keep getting the following fatal when I go to make my final atlas file

Fatal in in engine\atlas\core\atlasfile.cpp
AtlasFile::CreateNew - unknown TOC type

The commands I used to get to this step

1) atlasGenerateTextureTOCFromLargeJPEG("base/Data/Terrains/FrostBitePaintMap.jpg", 4, "base/Data/Terrains/FrostBiteNew.atlas")
2) importOldAtlasCHU("base/Data/Terrains/FrostBiteHeightMap.chu", "base/Data/Terrains/FrostBiteHeightMap.atlas") 
3) atlasGenerateUniqueTerrain("base/Data/Terrains/FrostBite.atlas", "base/Data/Terrains/FrostBiteHeightMap.atlas", "base/Data/Terrains/FrostBiteNew.atlas")
on the third command it crashes with the above fatal, here is the console dump
==>importOldAtlasCHU("base/Data/Terrains/FrostBiteHeightMap.chu", "base/Data/Terrains/FrostBiteHeightMap.atlas");
importOldAtlasCHU - opened 'base/Data/Terrains/FrostBiteHeightMap.chu' for conversion.
importOldAtlasCHU - created new Atlas file 'base/Data/Terrains/FrostBiteHeightMap.atlas'
importOldAtlasCHU - Atlas file initialized, converting...
importOldAtlasCHU - Headers read, remapping chunks...
importOldAtlasCHU - Importing geometry chunks...
importOldAtlasCHU -    level 4 chunks...
importOldAtlasCHU -    level 3 chunks...
importOldAtlasCHU -    level 2 chunks...
importOldAtlasCHU -    level 1 chunks...
importOldAtlasCHU -    level 0 chunks...
AtlasFile::waitForPendingWrites - Waiting for pending output to finish.
AtlasFile (12d8e0) - Waiting for write IO to finish...
AtlasFile::waitForPendingWrites - Done!
importOldAtlasCHU - Done
AtlasFile::waitForPendingWrites - Waiting for pending output to finish.
AtlasFile::waitForPendingWrites - Done!
==>atlasGenerateUniqueTerrain("base/Data/Terrains/FrostBite.atlas", "base/Data/Terrains/FrostBiteHeightMap.atlas", "base/Data/Terrains/FrostBiteNew.atlas");
atlasGenerateUniqueTerrain - getting ready to generate a terrain with a unique schema...
   o Opening 'base/Data/Terrains/FrostBiteHeightMap.atlas' for geometry...
AtlasFile::load - loading Atlas resource 2dc615c with base/Data/Terrains/FrostBiteHeightMap.atlas
   o Opening 'base/Data/Terrains/FrostBiteNew.atlas' for texture data...
AtlasFile::load - loading Atlas resource 2e5f78c with base/Data/Terrains/FrostBiteNew.atlas
   o Locating geometry TOC...
   o Locating texture TOC...
   o Copying & registering geometry TOC...
   o Copying & registering texture TOC...
   o Registering config TOC...
   o Creating atlas file 'base/Data/Terrains/FrostBite.atlas'...
TOC Type for Atlas is: Geom 
TOC Type for Atlas is: Tex 
TOC Type for Atlas is: (null)

Looks like it cant write the terrain out to the final atlas file. Any help would be appreciated.
#21
07/06/2006 (9:12 am)
It fails on Sentinel (sent 3) of AtlasChunk::ReadFromStream. Here's the callstack:
>	TSE_DEBUG.exe!Platform::debugBreak()  Line 15 + 0x8	C++
 	TSE_DEBUG.exe!PlatformAssert::process(PlatformAssert::Type assertType=Fatal_ISV, const char * filename=0x00cdb6cc, unsigned int lineNumber=100, const char * message=0x00cdb808)  Line 89	C++
 	TSE_DEBUG.exe!PlatformAssert::processAssert(PlatformAssert::Type assertType=Fatal_ISV, const char * filename=0x00cdb6cc, unsigned int lineNumber=100, const char * message=0x00cdb808)  Line 109 + 0x23	C++
 	TSE_DEBUG.exe!AtlasChunk::readFromStream(AtlasChunk * ac=0x01a4a2c0, Stream * s=0x01dcb914)  Line 100 + 0x3a	C++
 	TSE_DEBUG.exe!AtlasResourceTOC<AtlasResourceGeomStub>::immediateLoad(AtlasResourceGeomStub * stub=0x01dcd988, unsigned int reason=5)  Line 482 + 0xd	C++
 	TSE_DEBUG.exe!AtlasResourceTOC<AtlasResourceGeomStub>::copyChunksToTOC(AtlasResourceTOC<AtlasResourceGeomStub> * toc=0x01d14614, int reformat=-1)  Line 266 + 0x13	C++
 	TSE_DEBUG.exe!catlasGenerateUniqueTerrain(SimObject * __formal=0x00000000, int argc=4, const char * * argv=0x00dc9a40)  Line 216 + 0x16	C++
 	TSE_DEBUG.exe!CodeBlock::exec(unsigned int ip=14, const char * functionName=0x00000000, Namespace * thisNamespace=0x00000000, unsigned int argc=0, const char * * argv=0x00000000, bool noCalls=false, const char * packageName=0x00000000, int setFrame=0)  Line 1082 + 0x20	C++
 	TSE_DEBUG.exe!CodeBlock::compileExec(const char * fileName=0x00000000, const char * inString=0x015d8c14, bool noCalls=false, int setFrame=0)  Line 559	C++
 	TSE_DEBUG.exe!Con::evaluate(const char * string=0x015d8c14, bool echo=false, const char * fileName=0x00000000)  Line 925	C++
 	TSE_DEBUG.exe!ceval(SimObject * __formal=0x00000000, int argc=2, const char * * argv=0x00dc9a40)  Line 1177 + 0x10	C++
 	TSE_DEBUG.exe!CodeBlock::exec(unsigned int ip=1325, const char * functionName=0x01974f60, Namespace * thisNamespace=0x01982390, unsigned int argc=0, const char * * argv=0x00dc9a40, bool noCalls=false, const char * packageName=0x00000000, int setFrame=-1)  Line 1025 + 0x20	C++
 	TSE_DEBUG.exe!CodeBlock::exec(unsigned int ip=5, const char * functionName=0x00000000, Namespace * thisNamespace=0x00000000, unsigned int argc=0, const char * * argv=0x00000000, bool noCalls=false, const char * packageName=0x00000000, int setFrame=0)  Line 1008	C++
 	TSE_DEBUG.exe!CodeBlock::compileExec(const char * fileName=0x00000000, const char * inString=0x01ae8610, bool noCalls=false, int setFrame=0)  Line 559	C++
 	TSE_DEBUG.exe!Con::evaluate(const char * string=0x01ae8610, bool echo=false, const char * fileName=0x00000000)  Line 925	C++
 	TSE_DEBUG.exe!GuiTextEditCtrl::onKeyDown(const GuiEvent & event={...})  Line 638 + 0x13	C++
 	TSE_DEBUG.exe!GuiConsoleEditCtrl::onKeyDown(const GuiEvent & event={...})  Line 87	C++
 	TSE_DEBUG.exe!GuiCanvas::processInputEvent(const InputEvent * event=0x0012f890)  Line 344 + 0x25	C++
 	TSE_DEBUG.exe!DemoGame::processInputEvent(InputEvent * event=0x0012f890)  Line 663 + 0x18	C++
 	TSE_DEBUG.exe!GameInterface::processEvent(Event * event=0x0012f890)  Line 66 + 0x11	C++
 	TSE_DEBUG.exe!GameInterface::postEvent(Event & event={...})  Line 154 + 0x11	C++
 	TSE_DEBUG.exe!processKeyMessage(unsigned int message=256, unsigned int wParam=13, long lParam=1835009)  Line 383 + 0x1a	C++
 	TSE_DEBUG.exe!OurDispatchMessages()  Line 677 + 0x11	C++
 	TSE_DEBUG.exe!ProcessMessages()  Line 697	C++
 	TSE_DEBUG.exe!Platform::process()  Line 722 + 0x5	C++
 	TSE_DEBUG.exe!DemoGame::main(int argc=1, const char * * argv=0x015b4d38)  Line 527	C++
 	TSE_DEBUG.exe!run(int argc=1, const char * * argv=0x015b4d38)  Line 885 + 0x1a	C++
 	TSE_DEBUG.exe!main(int argc=1, const char * * argv=0x015b4d38)  Line 963 + 0xd	C++
 	TSE_DEBUG.exe!mainCRTStartup()  Line 398 + 0x11	C
 	kernel32.dll!7c816d4f() 	
 	ntdll.dll!7c915b4f() 	
 	kernel32.dll!7c8399f3()
#22
07/08/2006 (10:49 pm)
I'm still getting invalid chunk tail sentinels whenever I try to create a terrain. With some files it happens on the createUnique... call and others it happens when I try to convert the texture.

I even tried whipping up a brand new random test map in L3DT and I still got the chunk tail sentinel error. Is anyone else running into this?
#23
07/09/2006 (2:38 pm)
Yes, I still have that problem, always when creating the Unique Terrain.
#24
07/09/2006 (3:53 pm)
I've encountered this problem as well. It seems to happen when loading a .atlas file created by importing a TQT. It's on my list of Things To Fix, so should have a fix coming out soon. :)
#25
07/09/2006 (8:21 pm)
And what if we're getting the problem when creating an Atlas file from a JPEG? (See above log)
#26
07/09/2006 (9:47 pm)
Thanks Ben, and everyone else. Is this a VS 2k5 only bug, it seems that the VS2k3 people dont have the same problem?
#27
07/10/2006 (7:33 am)
I am using vs2k3 and getting it. It only seems to happen with certain exporters. Right now I don't know what the fix is - I'll be looking into this very soon.
#28
07/10/2006 (7:50 am)
I've gotten an Invalid Chunk Tail Sentinel in any of the files I've tried to convert. I even created a fresh random one using L3DT and I hit the error. I'm not using the Blender terrain method, I was just trying to create one from a large JPG file.

Thanks for all your work on this BTW Ben. Even if we don't all say it, we all appreciate it!
#29
07/10/2006 (11:33 am)
I have problems with atlasGenerateTextureTOCFromLargeJPEG as well. I don't even know how to describe it. All my textures appear black and blue though.

i63.photobucket.com/albums/h138/eternaldark112/atlaserror.png
When this is the texture(resized for obvious reasons):

i63.photobucket.com/albums/h138/eternaldark112/canyon-1.jpg
#30
07/10/2006 (12:43 pm)
@Ben - ditto.

I get Invalid Chunk Tail Sentinel when trying to create atlas file from large jpg. I've tried fresh everything and can't seem to get a terrain to build. I did get it to build a few times messing with the treedepth but it always seems to crash on the texture part:

atlasGenerateTextureTOCFromLargeJPEG("MyFPS/data/terrains/terrain1_TX.jpg", 2, "MyFPS/data/terrains/texture.atlas");

i either get "Invalid Chunk Tail Sentinel" or it just crashes to the desktop with no error message. Here is the callstack:
ntdll.dll!7c901230() 	
>	TSE_DEBUG.exe!Platform::debugBreak()  Line 15 + 0x8	C++
 	TSE_DEBUG.exe!PlatformAssert::process(PlatformAssert::Type assertType=Fatal_ISV, const char * filename=0x00cda3e4, unsigned int lineNumber=100, const char * message=0x00cda510)  Line 89	C++
 	TSE_DEBUG.exe!PlatformAssert::processAssert(PlatformAssert::Type assertType=Fatal_ISV, const char * filename=0x00cda3e4, unsigned int lineNumber=100, const char * message=0x00cda510)  Line 109 + 0x23	C++
 	TSE_DEBUG.exe!AtlasChunk::readFromStream(AtlasChunk * ac=0x01d7fc14, Stream * s=0x01a10af4)  Line 100 + 0x3a	C++
 	TSE_DEBUG.exe!AtlasResourceTOC<AtlasResourceTexStub>::immediateLoad(AtlasResourceTexStub * stub=0x01d69aa4, unsigned int reason=0)  Line 482 + 0xd	C++
 	TSE_DEBUG.exe!AtlasResourceTOC<AtlasResourceTexStub>::generate(RectI invalidationRegion={...})  Line 626 + 0x13	C++
 	TSE_DEBUG.exe!catlasGenerateTextureTOCFromLargeJPEG(SimObject * __formal=0x00000000, int argc=4, const char * * argv=0x00dc8a40)  Line 298	C++
 	TSE_DEBUG.exe!CodeBlock::exec(unsigned int ip=14, const char * functionName=0x00000000, Namespace * thisNamespace=0x00000000, unsigned int argc=0, const char * * argv=0x00000000, bool noCalls=false, const char * packageName=0x00000000, int setFrame=0)  Line 1075 + 0x20	C++
 	TSE_DEBUG.exe!CodeBlock::compileExec(const char * fileName=0x00000000, const char * inString=0x015a8c14, bool noCalls=false, int setFrame=0)  Line 559	C++
 	TSE_DEBUG.exe!Con::evaluate(const char * string=0x015a8c14, bool echo=false, const char * fileName=0x00000000)  Line 925	C++
 	TSE_DEBUG.exe!ceval(SimObject * __formal=0x00000000, int argc=2, const char * * argv=0x00dc8a40)  Line 1177 + 0x10	C++
 	TSE_DEBUG.exe!CodeBlock::exec(unsigned int ip=1325, const char * functionName=0x01944f60, Namespace * thisNamespace=0x01952364, unsigned int argc=0, const char * * argv=0x00dc8a40, bool noCalls=false, const char * packageName=0x00000000, int setFrame=-1)  Line 1025 + 0x20	C++
 	TSE_DEBUG.exe!CodeBlock::exec(unsigned int ip=5, const char * functionName=0x00000000, Namespace * thisNamespace=0x00000000, unsigned int argc=0, const char * * argv=0x00000000, bool noCalls=false, const char * packageName=0x00000000, int setFrame=0)  Line 1008	C++
 	TSE_DEBUG.exe!CodeBlock::compileExec(const char * fileName=0x00000000, const char * inString=0x01a7706c, bool noCalls=false, int setFrame=0)  Line 559	C++
 	TSE_DEBUG.exe!Con::evaluate(const char * string=0x01a7706c, bool echo=false, const char * fileName=0x00000000)  Line 925	C++
 	TSE_DEBUG.exe!GuiTextEditCtrl::onKeyDown(const GuiEvent & event={...})  Line 638 + 0x13	C++
 	TSE_DEBUG.exe!GuiConsoleEditCtrl::onKeyDown(const GuiEvent & event={...})  Line 87	C++
 	TSE_DEBUG.exe!GuiCanvas::processInputEvent(const InputEvent * event=0x0012f890)  Line 344 + 0x25	C++
 	TSE_DEBUG.exe!DemoGame::processInputEvent(InputEvent * event=0x0012f890)  Line 663 + 0x18	C++
 	TSE_DEBUG.exe!GameInterface::processEvent(Event * event=0x0012f890)  Line 66 + 0x11	C++
 	TSE_DEBUG.exe!GameInterface::postEvent(Event & event={...})  Line 154 + 0x11	C++
 	TSE_DEBUG.exe!processKeyMessage(unsigned int message=256, unsigned int wParam=13, long lParam=1835009)  Line 383 + 0x1a	C++
 	TSE_DEBUG.exe!OurDispatchMessages()  Line 677 + 0x11	C++
 	TSE_DEBUG.exe!ProcessMessages()  Line 697	C++
 	TSE_DEBUG.exe!Platform::process()  Line 722 + 0x5	C++
 	TSE_DEBUG.exe!DemoGame::main(int argc=1, const char * * argv=0x01585a18)  Line 527	C++
 	TSE_DEBUG.exe!run(int argc=1, const char * * argv=0x01585a18)  Line 885 + 0x1a	C++
 	TSE_DEBUG.exe!main(int argc=1, const char * * argv=0x01585a18)  Line 963 + 0xd	C++
 	TSE_DEBUG.exe!mainCRTStartup()  Line 398 + 0x11	C
 	kernel32.dll!7c816d4f() 	
 	ntdll.dll!7c915b4f() 	
 	kernel32.dll!7c8399f3()

Thanks.
#31
07/10/2006 (4:29 pm)
Hey guys,

I think I may have found the cause for this (and the cause as to why it wasn't causing an error!). So I'm testing now; if it is a fix I'll try to get it out today sometime.
#32
07/10/2006 (4:52 pm)
The fix is pretty simple - atlasChunk.h, line 60, increase the 2 to a larger number, like 8.

I've also added better error checking in our PNG code to detect when this issue happens.

Basically it was allocating a too-small buffer and some braindead code was forgetting to check if write was failing. :)

This change fixes all of my sentinel errors. Let me know if it works for you. We'll post in the main 3.5 launch thread when it's checked in.
#33
07/10/2006 (9:51 pm)
Ok the functions run now... but... I'm getting the black and blue problem (you're not alone Matt!).

visions.game-server.cc/Upload/BlueAndBlack.png
#34
07/10/2006 (9:54 pm)
Neat. Will work on this tomorrow then. (It's 10pm here, going to bed!)
#35
07/11/2006 (7:21 am)
@ben - now I get a different error "Error, cannot load png's taller than 1024 pixels!". My jpg image was created by L3DT and is 4096 x 4096. The heightmap is 1025 x 1025
#36
07/11/2006 (7:54 am)
Set you tree depth to make sure that each tile is no larger than 1024. So for your 4096 texture use a minimum tree depth of 4.
#37
07/11/2006 (1:59 pm)
Thanks, that worked.
#38
07/11/2006 (3:41 pm)
Ok we can see terrain now we had to increase that number to 74. However, we leak about 2 gb of memory while rendering an 8096x8096 terrain. We also have the odd streaking lines in the texturemap of the terrain.
#39
07/11/2006 (3:50 pm)
You increased it to 74?!

That means you are paging in individual chunks of data that are Seventy Four Megabytes in size.

That's HUGE. That's almost a third of the whole texture! It also means you're loading a LOT of data every time you page anything. Are you loading your whole texture in as a single image?
#40
07/11/2006 (6:17 pm)
Er sorry about that I ment 64, anything below that and we got the TOC error. The number I was refering to was atlasChunk.h, line 60