L3DT users' community
Large 3D terrain generator

Exporting into T3D

Got a problem or need advice?

Exporting into T3D

Postby chieling » Sun Jan 23, 2011 8:54 pm

I created a terrain to use with Torque 3D. i had a few random errors, but the final export went fine with the 2.9.0.5 version of L3DT.

when i tried to load the terrain into the T3D engine, T3D crashed at the VERY END of the loading screen and I got the "stopped working" EXE error.

i chked the console log file for T3D and i saw this on the last 3 lines.

Activating DirectInput...
GFXD3D9TextureManager - pitch mismatch on DDS load
GFXTextureManager - failed to load DDS for 'art/terrains/L3DT_human_basetex'


i tried it in L3DT 2.9 also and it too gave me the same error.

any ideas?
chieling
Contributing member
 
Posts: 31
Joined: Sun Jan 16, 2011 7:33 pm

Re: Exporting into T3D

Postby Aaron » Mon Jan 24, 2011 10:52 am

Hi Chieling,

The map definition file you sent me showed your project had a 8192x8192 pixel heightmap with a 4x resolution texture map (i.e. 32,768 x 32,768 pixels). Is this the project you're having trouble with?

If so, the answer is quite straightforward. The 'pitch' field in a DDS image format is a 32-bit unsigned integer that must be set to the value of the number of bytes in the uncompressed top-level mipmap. For you map, that is equal to the texture map size (32,768 x 32,768 pixels) times the size of a RGBA element (4 bytes), which works out at the princely sum of 4,294,967,296 bytes. However, the maximum value allowed in a 32-bit unsigned integer (including the ones in the DDS image header) is 4,294,967,295 (or in binary, 11111111111111111111111111111111). That is to say, the DDS image format, as designed by Microsoft, cannot support images that are 32768 x 32768 pixels in size or larger. This explains why the 'GFXD3D9TextureManager' module complains about the pitch mismatch; attempting to store the 'correct' value of 4,294,967,296 for this texture size results in a wraparound to 0.

I will now modify the DDS exporter to refuse to export if the image is larger than the maximum possible size supported by the DDS format.

In any event, as I said in my e-mail, T3D doesn't support 'large' unique textures. T3D loads the DDS images directly into GPU memory as a single texture unit, and the maximum texture size on most graphics cards would be 4096x4096 or maybe 8192x8192 pixels. Hence, even if the DDS image format supported a texture 32,768 x 32,768 pixels in size, your graphics card wouldn't, and thus T3D doesn't.

To use large terrain in T3D, your options are either:
  1. Use blended textures instead of L3DT's unique texture. To do this, rename or delete the '[your TER file]_basetex.dds' file. T3D should then load the terrain and use run-time texture splatting to texture the terrain instead of using L3DT's pre-calculated texture. This probably won't look as good, but that's a T3D implementation detail that is beyond my control.
  2. Split your terrain into separate TER tiles and render them using separate instances of the T3D terrain renderer. This is a non-trivial amount of work, but I believe some T3D users have had success with it. You may wish to have a look around the T3D forum for examples of this.

Since this isn't a bug in L3DT, I'm moving this thread to the 'Help and support' forum.

Best regards,
Aaron.

Edit: Hmmm...I may be a tad wrong about the pitch filed in a DDS header. Upon more careful reading of the specs and my code, it seems that the pitch field in compressed images is interpreted as the number of bytes used to store the 0th mip level in the compressed DXTn format. This is number is smaller than the 32-bit limit for your texture (by a factor of 8), so it should be stored in the DDS header OK. However, if DirectX back-computes the number of raw bytes required to store the texture in memory and uses a 32-bit integer to do so (as may be a reasonable assumption), it will get the overflow error described above. Furthermore, regardless of any discussion of integer value ranges, T3D still will not be able to load a unique texture of that size into GPU memory, so my above recommendations still stand. Anyway, I'll run some DDS tests to make sure all is as I have stated.
User avatar
Aaron
Site Admin
 
Posts: 3691
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting into T3D

Postby chieling » Mon Jan 24, 2011 1:52 pm

i finally moved down to a 4x4 terrain and was trying it on that setting. i have HAD luck on that setting (4x4) before but i was doin alot more with this map and wasnt sure if that was the issue or not. I HAD noticed that the DDS file was much larger than the others.

basically what i was doin was setting File-->New project to (Blank Designable). setting the Heightfield size to 4x4 and horz scale to 1. the design map was at 64. then i let the map create itself. then i went into the design map parameters and set the noise strength and shape and cliffs/terrances to a low number (10ish), and then applied it. i then went in, set erosion to 20% and applied that to the map. after that i went to the design map and started creating a coastline. i started at Alt (-1) and then got increasing stronger the further out i went (i believe i went -1,-5,-10,-20,-30,-40,-50). i believe i then went to the coastline and painted Erosion at (50) in some spots. I had then added water, possibly increased the land height and did a few other things.

i can send you whatever files youd like if u would like a look at this.
chieling
Contributing member
 
Posts: 31
Joined: Sun Jan 16, 2011 7:33 pm

Re: Exporting into T3D

Postby chieling » Tue Jan 25, 2011 12:54 am

ok, excuse me for being dense but im really tryin to learn this.

I renamed the *.DDS file and T3D loaded the terrain. you were correct, the terrain was blurry. now, one thing i DID notice was that the *.dds file that L3DT creates is, in general, much bigger than the T3D *.DDS file. I generally create 4x4 terrains. MOST of the basetex files are about 683kb and the .ter files are in general about 12,500kb. with the L3DT files, the .ter files are 49,153kb and the .dds file is 132,000kb

what could i be doin thats causing this to happen with a 4x4 terrain?
chieling
Contributing member
 
Posts: 31
Joined: Sun Jan 16, 2011 7:33 pm

Re: Exporting into T3D

Postby Aaron » Tue Jan 25, 2011 12:23 pm

Hi Chieling,

Chieling wrote:what could i be doin thats causing this to happen with a 4x4 terrain?


Good question. I think I'd be doing your learning a disservice if I simply gave you the answer. Rather, I'd like to help you discover the answer for yourself by posing the following questions:

Firstly, what factors affect the size on disk of a DDS image file? (or any image format, for that matter)

Secondly, what factors would contribute to the relative blurriness of the texture map generated by T3D compared to that by L3DT? (i.e. what makes a texture sharp or blurry?)

The solution to the mystery of the T3D DDS textures should become apparent to you if you consider the answers for the two questions above, combined with your observations of the file sizes and what you know about the texture settings you set in L3DT (hint #1).

Hint #2 is to forget about all that design map stuff from your previous post (cliffs/terraces, erosion, etc.); it's not relevant to this problem.

If you would like and further help or hints in answering these questions please feel free to ask. However, I reserve the right to answer a question with another question.

Best regards,
Aaron.

PS: I've been able to reproduce the problem you saw with the T3D exporter appearing to freeze temporarily when exporting large maps. I should be able to find time for a fix in the next few weeks.
User avatar
Aaron
Site Admin
 
Posts: 3691
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting into T3D

Postby chieling » Mon Jan 31, 2011 3:55 pm

well, ive been playing with this alot recently.

Basically, the factors are size and detail. the bigger the terrain, the larger the file - the more detailed, the larger the file.

I noticed that I can have a 4x4 terrain @5m per pixel but it needs to be all low settings (ie: nothing high rez) but if i add anything high rez, that the terrains wont load. i have noticed that they WILL load if i rename the DDS file.

so my question is.... what would a good setting be for a MMO terrain? this is really what i have been tryin to discover with all this.
chieling
Contributing member
 
Posts: 31
Joined: Sun Jan 16, 2011 7:33 pm

Re: Exporting into T3D

Postby BigDaz » Fri Apr 29, 2011 10:44 am

To use large terrain in T3D, your options are either:
Use blended textures instead of L3DT's unique texture. To do this, rename or delete the '[your TER file]_basetex.dds' file. T3D should then load the terrain and use run-time texture splatting to texture the terrain instead of using L3DT's pre-calculated texture. This probably won't look as good, but that's a T3D implementation detail that is beyond my control.


This is what I'm trying to do at the moment. I delete or rename the basetex.dds file, but when Torque loads the mission, another dds file appears.
I'm not sure how to stop that happening.
BigDaz
New member
 
Posts: 2
Joined: Fri Apr 29, 2011 10:29 am

Re: Exporting into T3D

Postby chieling » Mon May 02, 2011 8:33 pm

it will create another DDS file, T3D needs it. HOWEVER, ive found out that deleting L3DTs DDS file and allowing Torque to create its own will allow this to work.

what ive found out that works best for a MMO setting (so far) is a 2x2x2pixel per meter if you are looking for a nice large terrian setting. the .ter files are only about 12 meg, the same size as a 4x4x1 and there is no real detail lost.
chieling
Contributing member
 
Posts: 31
Joined: Sun Jan 16, 2011 7:33 pm

Re: Exporting into T3D

Postby Aaron » Tue May 03, 2011 10:04 am

Hi BigDaz,

As Chieling said, T3D needs to have a base texture to render the terrain. If you delete or rename the texture generated by L3DT, Torque 3D will automatically re-generate the texture from the terrain file's blend maps and the material textures. The resolution of the T3D-generated base texture is the same as the heightfield resolution, which is typically a lot worse than the high-resolution textures generated by L3DT, but they are also correspondingly a lot smaller in file size.

Are you finding some problem caused by the re-generation of the texture or otherwise by the presence of the basetex.dds file?

Best regards,
Aaron.
User avatar
Aaron
Site Admin
 
Posts: 3691
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Re: Exporting into T3D

Postby BigDaz » Sun May 08, 2011 11:02 am

OK I understand now. Thanks.
BigDaz
New member
 
Posts: 2
Joined: Fri Apr 29, 2011 10:29 am


Return to Help and support

Who is online

Users browsing this forum: No registered users and 2 guests

cron