L3DT users' community
Large 3D terrain generator

Flipped .obj mesh?

Got a problem or need advice?

Flipped .obj mesh?

Postby Philippe Le Miere » Sat Apr 18, 2009 6:27 am

Is it just me, or are L3DT exported .obj meshes terrains flipped?

Image

Just trying to setup the UV's for the terrain's texture map and noticing that the texture is not being applied in the correct orientation. Eventually could see, by comparing the Sapphire render of the terrain with the Maya viewport render that the terrain appears flipped.

Just imported the terrain using default Maya settings, and haven't had .obj import issues in the past.

Would be curious to hear other peoples experience with .obj export.

Thanks,

Philippe
Philippe Le Miere
Contributing member
 
Posts: 36
Joined: Fri Mar 27, 2009 10:12 pm
Location: Melbourne, Australia

Postby Aaron » Sat Apr 18, 2009 12:47 pm

Hi Philippe,

Such is the joy of coordinate mapping!

In L3DT, the coordinate system is set such that:
  • the x-axis increases from west to east,
  • the y-axis increases from south to north, and;
  • the z-axis increases from below to above.
This is the coordinate system used in the physical sciences, and being a physicist, it's the one I adopted for L3DT.

Maya and many other 3D programs use a coordinate system where:
  • the x-axis increases from west to east,
  • the y-axis increases from below to above, and;
  • the z-axis increases from north to south.
This peculiar coordinate system is used in computer science.

By default, I have set the OBJ plugin to export in the CS coordinate system (XZ plane, Y up). However, I had made the mistake of making the z-axis, which is the analogue of L3DT's y-axis, increase from south to north, just as the y-axis does in L3DT. It should instead be flipped to increase from north to south.

Long story short, I have revised the OBJ and B3D plugins (which support the XZ plane, Y up convention) to invert the z- axis. The updated plugins will be included in the next developmental build, which will be L3DT v2.7 build 8. I'll post back here when it's available for download.

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

Postby Philippe Le Miere » Sun Apr 19, 2009 12:20 am

Ah. Thanks for explaining that Aaron.

My current work around is to rotate the texture map in Photoshop by 180 degrees and then flip it horizontally. Glad to hear it's fixable and will look out for build 8.

Yeah, I know, the lack of any established system where Z represents up/down or depth makes it difficult. I can understand how computer science thinks of Z in terms of depth, as the user is essentially looking into a 'flat' screen. The X and Y coordinates then representing height and width or two-dimensionality.

However, can also appreciate that when viewing a terrain it's essentailly from the point of view of a satellite. Therefore depth comes from looking down.

Guess it's all relatively really and depends on the viewer's point of view. One might say physical science has a God like point of view and computer science has a terrestrial point of view.

Anyhow. Will look out for the update.

Thanks,

Philippe
Philippe Le Miere
Contributing member
 
Posts: 36
Joined: Fri Mar 27, 2009 10:12 pm
Location: Melbourne, Australia

Postby Rofar » Mon Apr 20, 2009 10:25 pm

Your change is fine for any program that uses a Right-Handed coordinate system (such as Maya). However, now Left-Handed coordinate systems will be backwards.

I guess what I'm saying is that in my mind, you initially had it correct. Might be best if there is an option that can be set for which coordinate system to use. I could even imagine the possibility of someone wanting the mesh in physics coordinates.

Just a thought. I'm not specifically impacted because I'm not using the exporters right now and if I did, I could flip the mesh.
Rofar
Luminary
 
Posts: 51
Joined: Tue Nov 22, 2005 10:48 pm
Location: South Carolina

Postby Aaron » Tue Apr 21, 2009 10:31 am

Hi Rofar,

Do you know of popular programs that use left-handed coordinate systems? So far I know of Blender and Maya being right-handed.

I could even imagine the possibility of someone wanting the mesh in physics coordinates.


This is supported already in the format options. You can choose between 'XZ plane (Y up)' and 'XY plane (Z up)' coordinate systems, where the former is the comp. sci. system, and the latter is the physics system. Both are right handed.

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

Postby Aaron » Tue Apr 21, 2009 12:04 pm

Hello again,

I wrote:The updated plugins will be included in the next developmental build, which will be L3DT v2.7 build 8. I'll post back here when it's available for download.


As promised, L3DT Pro v2.7 build 8 is now available for download. Please let me know if you find any problems.

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

Postby Rofar » Tue Apr 21, 2009 10:09 pm

aaron wrote:Do you know of popular programs that use left-handed coordinate systems? So far I know of Blender and Maya being right-handed.


Actually, I can't say I know of any modeling programs but I have only used a few myself. And even then, in limited use as I am no artist. But DirectX is LH. My rendering engine is DX based and therefore uses the LH coordinate system.
Rofar
Luminary
 
Posts: 51
Joined: Tue Nov 22, 2005 10:48 pm
Location: South Carolina

Postby Philippe Le Miere » Wed Apr 22, 2009 3:22 am

Thanks Aaron.

Downloaded and did a quick test using build 8.

Works perfect.

Image

Gosh, can get confusing with coordinate systems. Must admit to prefering a system that works with Maya and other mainstream 3D editors.

Cheers,

Philippe
Philippe Le Miere
Contributing member
 
Posts: 36
Joined: Fri Mar 27, 2009 10:12 pm
Location: Melbourne, Australia

Postby Aaron » Wed Apr 22, 2009 10:38 am

Hi Chaps,

Philippe Le Miere wrote:Works perfect.


Super. Thanks again for pointing out the issue in the first place.

Rofar wrote:But DirectX is LH. My rendering engine is DX based and therefore uses the LH coordinate system.


Ah, of course. Now that you mention it, OpenGL is left-handed too, so I had to tinker with the projection matrix to make it right-handed for Sapphire (which also has Z upwards, as it should be). Hmmm...perhaps I should add an option to invert selected axes (X/Y/Z) so that users can get the coordinate system right for their application. [sigh, more options...]

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


Return to Help and support

Who is online

Users browsing this forum: No registered users and 15 guests

cron