L3DT users' community
Large 3D terrain generator

Import of HF causes contour lines in mesh and textures

Please report software faults here.

Import of HF causes contour lines in mesh and textures

Postby trollfiddler » Tue Sep 19, 2006 3:29 pm

Hi Aaron,

Proud new owner of the pro version comes up with first question!

When importing terrains to TSE (Torque Shader Engine) the heightmap has to be saved as a RAW file, then a flipped version has to be used in L3DT to generate all of the light maps, alpha maps etc. If this is not done the texture and mesh do not line up correctly in TSE. Don't ask me why.

Anyway, the problem is that when I export the heightmap as a RAW file and flip it in Paintshop Pro, L3DT screws up when I re-import the heightmap. It displays parts of the map in two sections at the top of the HF screen, and the bottom of the HF shows as completely flat.

I tried exporting and flipping the HF as a BMP and as a PNG. When I re-import either of those they come in sort of correctly, but have contour line type steps in the terrain all over the place, instead of smooth gradations.

Any idea what is the best way to flip a HF from L3DT without getting corruption or strange artefacts? Or is this an import bug?

Thanks a lot,

Dave.
trollfiddler
Luminary
 
Posts: 66
Joined: Tue May 02, 2006 1:53 pm
Location: Mayo, Ireland

Postby Aaron » Wed Sep 20, 2006 4:27 pm

Hi Dave,

I suggest you try this:

Generate your heightfield, lightmap, texture, etc in L3DT without any import/export stuff. Save the project when you're done. Then, select the heightfield (view->show map->heightfield), and open the export wizard (file->export->active map). In the export wizard, select your RAW format, then click on the 'options...' button, and disable the 'InvertY' option by double clicking on it. Click OK, set your file name, and click OK again to save the file. This disabled the y-axis flipping, which is on by default. Speaking of that...

Dave wrote:...Don't ask me why.


This one is in the FAQ under 'Why is the y-axis inverted in my map file?'. L3DT follows the right-handed coordinate system convention from the physical sciences (my degree is in physics, after all), but the majority of apps follow the left-handed system, which is more popular in computer science (for which I have no qualification whatsoever). To 'fix' this difference, L3DT by default automatically inverts the y-axis of the RAW files, under the assumption that other programs use left-handed systems. If this is causing problems with TSE, then it seems that Atlas is right-handed also. Thus, the 'InvertY' option in the RAW exporter should be disabled for TSE use.

Dave wrote:Anyway, the problem is that when I export the heightmap as a RAW file and flip it in Paintshop Pro, L3DT screws up when I re-import the heightmap. It displays parts of the map in two sections at the top of the HF screen, and the bottom of the HF shows as completely flat.


That sounds like there is a mismatch in the RAW format used by PSP and L3DT - most likely PSP is saving as an 8-bit RAW, whereas L3DT defaults to a 16-bit RAW. You can change the expected RAW mode when importing by clicking on the 'options...' button in the import wizard, double clicking on the 'Mode (ComboSelector)' option, and selecting the 'BYTE (spanned)' option.

Of course, I wouldn't recommend you use PSP at all for manipulating heightfields, as it doesn't support 16-bit data (Photoshop does, somewhat). This is why you get those steps in the heightfield afterwards; PSP is converting 65536 height levels (16-bit) from the L3DT export into only 256 levels (8-bit). Similarly, it's a bad idea to use BMP formats, or PNG in any other mode than 16-bit greyscale.

I hope this helps.

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

Postby trollfiddler » Thu Sep 21, 2006 10:53 am

Absolutely excellent reply, explains everything in a crystal clear way. Thanks a million, will try the non-flip option and see how I get on.

You're doing pretty well with L3DT for someone without a degree in computer science :-)

Cheers,

Dave.
trollfiddler
Luminary
 
Posts: 66
Joined: Tue May 02, 2006 1:53 pm
Location: Mayo, Ireland

Postby trollfiddler » Fri Sep 22, 2006 10:55 am

Hi Aaron,

I tried that yesterday but it didn't seem to work. I was very tired at the time so I might have screwed things up. However, there was a new code drop for TSE today including some Atlas fixes, and that seems to have fixed the problem. So it looks like a project created in L3DT will finally import into TSE without any messing around. Just a straight export of the RAW heightfield, resized by one extra pixel for export.

Thanks for your help,

Dave.
trollfiddler
Luminary
 
Posts: 66
Joined: Tue May 02, 2006 1:53 pm
Location: Mayo, Ireland

Postby Aaron » Sat Sep 23, 2006 1:06 am

Hi Dave,

I'm glad this is resolved. Just to be sure, I'll have another look at the flipping-code to make sure it does what it was supposed to do (I haven't tested this in months).

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

Postby trollfiddler » Sat Sep 23, 2006 11:31 am

Arrgh! No, it's working now, please don't do anything, pleeeease! :-)
trollfiddler
Luminary
 
Posts: 66
Joined: Tue May 02, 2006 1:53 pm
Location: Mayo, Ireland

Postby Aaron » Sun Sep 24, 2006 4:43 am

...what if I promise not to break anything?

Edit: Crisis averted - the y-axis flipper was working as intended.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia

Postby trollfiddler » Sun Sep 24, 2006 1:21 pm

Phew! Of course you have all those backups don't you? After 20 years of software dev I always keep my backups up to date (cough).
trollfiddler
Luminary
 
Posts: 66
Joined: Tue May 02, 2006 1:53 pm
Location: Mayo, Ireland

Postby Aaron » Sun Sep 24, 2006 1:38 pm

Ahh...sure....yeah, they're here somewhere. Ummm.

Cheers,
Aaron.

PS: I'm burning a backup CD now.
User avatar
Aaron
Site Admin
 
Posts: 3696
Joined: Sun Nov 20, 2005 2:41 pm
Location: Melbourne, Australia


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 11 guests

cron