Game Development Community

[BUG 1.1a] Heightmap Y-axis Inverted

by Steve Acaster · in Torque 3D Professional · 12/08/2009 (1:06 pm) · 15 replies

Ancient problem actually, tested in 1.01 and 1.1a, an imported heightmap is flipped along the Y axis, sort of turning it "upsidedown" or "mirror reflected" if you like.

Easiest viewing example in Auld Reeky - that's TGE/A to sane people, but still relevant in T3D toady. Hence old screenshot.
img155.imageshack.us/img155/4751/yaxisvx7.jpg

#1
12/08/2009 (1:34 pm)
some programs/engines read heightmaps like that. L3dT has an invert Y in there export options. a workaround is to flip it in an image editor.
#2
12/09/2009 (12:11 am)
sure, Stadi, but the point here is industry standards. Not that industry standards need to be followed...but in all seriousness, why divert from them ?
#3
12/09/2009 (6:30 am)
@eb - I'd love to see the list of industry standards you speak of. All i've seen is that everyone does things differently for one reason or another.

In Torque 3D terrain is that way because TGEA was that way and TGE was that way and Tribes was that way. If anything we're following the "industry standard" of 10 years of Torque engines.

In detail its not that we're flipping the heightmap... it doesn't. Whats going on is Torque has traditionally built the geometry for the heightmap that way and in order to allow old terrain blocks to work in T3D it was kept that way.

To "fix it" i would have to either a) have two different geometry building methods or b) flip the bitmap when loading new files to correct for it.

Either way this is like the 1000th item on my list of things to work on in Torque 3D, so its gonna be a while. The best bet is for a community member to fix it and submit the patch to me. I'll be glad to merge it into core if it works and doesn't break existing terrains.
#4
12/09/2009 (6:52 am)
Failing that a little note in the docs mentioning this will happen might be useful and avoid some confusion, I'll note Mr Perry's docs thread.

@Tom
Only the 1000th item on your list ... this must be going better than expected!
;)
#5
12/09/2009 (7:40 am)
I don't even think you should put it on your list Tom. It's not a huge issue..or even a little issue. I was merely curious as to why things were the way they were.. no offense intended.

Not sure I mentioned a list Tom :P. hehe
but essentially, white equals high and black = low. Mainly because black = 0 and white = 255. 0 is low and 255 is high. ...rofl..sorry I had to shoot that in there. :D

But seriously..I could care 'what color is what' as long as things work. ..and they do. So keep up the great work Tom! I appreciate all of your beyond exhausting efforts!
#6
03/20/2013 (3:32 pm)
Fixed. I did it with a switch parameter so the old functionality is still in there. It should be controlled with an editor option, but that would require editing all four templates. Ain't nobody got time for that!
#7
03/20/2013 (4:13 pm)
Editing one template and propagating that across the other three - copy and paste the script.... ;p I gots bronchitis!
#8
03/21/2013 (7:50 am)
Oh yeah, it's not that much effort... I was just being snarky about the code duplication ;). I'll probably take a crack at it in the next few days if nobody else does. Good thing we can add commits to pull requests after they've been requested.
#9
03/21/2013 (8:03 am)
I hope that you've tested that it's working right ... ;)
#11
03/21/2013 (5:10 pm)
Well now... I'm just going to have to add these fixes. I so hate the flip.

Domo Arigato Gozaimasu!
#12
03/22/2013 (5:44 pm)
Just added a commit that puts a checkbox on the import dialog. It's in all the template editors.
#13
03/27/2013 (8:35 am)
Daniel's fix/improvement has been merged into the development branch.
#14
03/27/2013 (9:26 am)
Thanks Daniel!!
#15
04/05/2013 (3:03 pm)
Someone on Github has reported a crash while loading a terrain with PysX/Bullet enabled. Michael confirmed, I think. It's bizarre, since the code to import a heightmap with the Y-axis flipped it literally identical to the old code (wrapped in an if statement).