Textures backwards???
by Kevin Rogers · in Torque Game Engine · 09/22/2005 (2:12 pm) · 7 replies
I've mostly ignored this up until this point, but now it's starting to bug me...
Is there any reason textures are rendered backwards, particularly with regard to skyboxes and terrain (doesn't seem like anything else does it, but....)?
I was creating some new skyboxes last night and was perplexed that the seams didn't match up, after I'd spent quite a bit of time tidying them up and making sure they matched. Then I recalled that the terrain textures were rendered backwards, so I went ahead and flipped the skybox textures and sure enough, now the seams matched (finally).
This doesn't make sense to me: I expect WYSIWYG when creating textures, and having to flip them every time is just an extra hoop that I'd rather not jump through.
Any thoughts on this? Bug or "feature"?
Thanks,
Kevin
Is there any reason textures are rendered backwards, particularly with regard to skyboxes and terrain (doesn't seem like anything else does it, but....)?
I was creating some new skyboxes last night and was perplexed that the seams didn't match up, after I'd spent quite a bit of time tidying them up and making sure they matched. Then I recalled that the terrain textures were rendered backwards, so I went ahead and flipped the skybox textures and sure enough, now the seams matched (finally).
This doesn't make sense to me: I expect WYSIWYG when creating textures, and having to flip them every time is just an extra hoop that I'd rather not jump through.
Any thoughts on this? Bug or "feature"?
Thanks,
Kevin
#2
09/23/2005 (1:40 pm)
Make sure that the origin is in the right place. What 2D program are you using?
#3
09/23/2005 (1:43 pm)
With the skyboxes, wouldn't flipping the textures be the same as reordering them? It sounds to me like you put the left image on the right and the right image on the left or something similar.
#4
Also, it only seems to flip on the Y axis; if it were expecting the origin to be in the bottom left (per standard OpenGL), it would flip it on the X.
I'm starting to wonder if the texture coordinates are in the wrong order in the rendering code...
[edit] By the way, can anyone else replicate this? Just throw some text on a skybox or terrain texture and then apply the texture in the engine. You can easily see if it's flipped... (The first time I noticed this was when I created a "DEFAULT" texture just to use for the new mission template.)
09/23/2005 (2:40 pm)
Thanks for the replies, guys. Some good thoughts...Quote:Make sure that the origin is in the right place. What 2D program are you using?I use Paint Shop Pro, which places the origin at the top left. I'm not sure this is the issue though, since vehicle and item skins do not get flipped. This only occurs with terrain and skybox texture, AFAIK.
Also, it only seems to flip on the Y axis; if it were expecting the origin to be in the bottom left (per standard OpenGL), it would flip it on the X.
Quote:With the skyboxes, wouldn't flipping the textures be the same as reordering them? It sounds to me like you put the left image on the right and the right image on the left or something similar.Adam, while I could get the seams to match up by reordering the textures, the textures would still be flipped, thus the whole skybox would be still be mirrored.
I'm starting to wonder if the texture coordinates are in the wrong order in the rendering code...
[edit] By the way, can anyone else replicate this? Just throw some text on a skybox or terrain texture and then apply the texture in the engine. You can easily see if it's flipped... (The first time I noticed this was when I created a "DEFAULT" texture just to use for the new mission template.)
#5
I didn't check to see if the texture coordinates actually are in the wrong order (though I can't think of anything else that would cause the problem), but flipping them does fix it. The skybox is rendered in terrain/sky.cc in the renderSkyBox function - line 876. If you need help with the code, just ask.
You also need to switch the second and fourth images in the skybox's dml list.
09/23/2005 (4:28 pm)
They're definitely all flipped. Surprised I've never heard/noticed that come up before.I didn't check to see if the texture coordinates actually are in the wrong order (though I can't think of anything else that would cause the problem), but flipping them does fix it. The skybox is rendered in terrain/sky.cc in the renderSkyBox function - line 876. If you need help with the code, just ask.
You also need to switch the second and fourth images in the skybox's dml list.
#6
09/23/2005 (9:38 pm)
Probably because everyone so far has used skybox/terrain textures that look the same when flipped on that axis?
#7
@ Ben: Hello! I hope this fix finds its way into 1.4/HEAD... =)
09/26/2005 (1:51 pm)
@ Adam: Thanks for the feedback! I'll go check out sky.cc tonight.@ Ben: Hello! I hope this fix finds its way into 1.4/HEAD... =)
Torque 3D Owner Kevin Rogers
I haven't seen any mention of this problem elsewhere on the forums -- is this something that I'm doing wrong? Or are y'all just ignoring this as too picky to worry about?