PnP TerrainCreator - Forum

The PnP TerrainCreator Forum
It is currently Tue Nov 21, 2017 5:46 pm

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: OBJ Files Mirrored?
PostPosted: Sun May 21, 2006 6:13 pm 
Offline

Joined: Thu Apr 20, 2006 9:44 pm
Posts: 15
Hey,

This might be a bug or it might be user error...:)

We're using .obj files as the exported format to be used with PNPTC. The model and materials export fine and are loaded into PNPTC. We seem them as available objects to use and they show up in the terrain when we place them.

Everything so far is fine. The problem is the object when looking straight down on it as displayed in PNPTC is flipped along the horizontal axis. Just so we're on the same page, it appears from the PNPTC manual, that the editor uses the following coordinate system:

left to right = -x to x
back to front = -y to y
bottom to top = -z to z

Using this coordinate system, it looks as if the "y" values are negated causes the model to appear mirrored along the x axis.

In other words, if this was my object :

|>
|

it is renendered in PNPTC like this:

|
|>

Anyway, anyone know what we're doing wrong? Obviously there us a difference some where in the coodinate systems used by PNPTC and the .obj file, but how can we compensate for this?

I noticed in the object settings, there an "up rotation" setting but that just rotated the object around that axis. It didn't account for the model itself being mirrored.

We're looking into using .x files to see if that makes a difference too.

Any insight would be useful, thanks!

-Troy


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 7:05 am 
Offline
Programmierdochfix
User avatar

Joined: Tue Apr 27, 2004 12:53 pm
Posts: 892
Location: Braunschweig
Quote:
This might be a bug or it might be user error...


neither a bug nor a user error. :)


Quote:
left to right = -x to x
back to front = -y to y
bottom to top = -z to z


This coordinate system is correct for terrain export. As this is the most "natural" way of aligning the axes for a terrain, I used them throughout the export interface.

For 3D rendering in TC I'm using a different system. The y and z axes have to be exchanged, so y is pointing up. Whenever I display coordinates inside TC I display z as y and y as z (in correspondance to the "natural" coordinate system).

So why.
There are several ways for describing a coordinate system.
- First, one has to choose in which direction the up axis is pointing. There are two common ways of doing it. Either the y axis or the z axis is pointing up.
- Second, one has to chose how the 3 axes of a coodinate system are orientated. Left or right handed.

The commonly mathematically accepted way for these two parameters is right handed with z pointing up. That's the way how most modelling softwares and many graphic engines (OGRE for example) are using it. Unfortunately MS used for DX by default a left handed coordinate system with the y axis pointing up.

That's the problem you are facing. The rotation parameter, which you can set in the object manager, can help you solving the y or z is up problem. For the left or right handed coordinate system problem, one has to filp all vertices at a plane through the x/z axes. Currently I don't have a built in solution for this.

Many exporters have an option for left/right handed export. Maybe you can set this option to left handed, when you export into .obj. You will of course have to use a left handed object set within TC and a right handed within OGRE. Its some extra work, but possible.

It would also be possible for me to do this flipping within the main program by inverting one axis of the object placement's transformation matrix. But this will change the matrix from left to right handed. haven't done this before, don't know if it has any side effect. I'll try. If it works, you will have an additional option within the object manager, with which you can flip the objects.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 22, 2006 11:09 pm 
Offline

Joined: Thu Apr 20, 2006 9:44 pm
Posts: 15
Thanks for the reply.

I kinda figured it was the right handed versus left handed coordinate system issue. Unfortunately, the artist that is working with me on this doesn't see an option to change handedness when exporting to the .obj file format. He's going to check the .x file format for options.

Certainly there is a tool out there that converts between the two. I'd rather not have to write something..:)

Anyway, thanks again!

-Troy


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 23, 2006 8:44 am 
Offline
Programmierdochfix
User avatar

Joined: Tue Apr 27, 2004 12:53 pm
Posts: 892
Location: Braunschweig
There is surely a tool, it is very simple to write such a tool. You will only have to switch the sign of the y component of all vertices. As obj is text based, writing such a tool would not take longer than an hour.

If you find a tool somewhere, please let me know. But anyway I will try to add such an option to TC as well.

Generally you will face the same problems for .x files. But as .x files are build for a DirectX left handed world, it is very likely that exporters will have an option for axis flipping.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 26, 2006 5:28 pm 
Offline
Programmierdochfix
User avatar

Joined: Tue Apr 27, 2004 12:53 pm
Posts: 892
Location: Braunschweig
A flip option for objects, trees and grass files will be available with the next release. If you need it sooner, I can release a new beta version by the weekend.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron