3DS Max and Ogre Coordinates system

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
manowar
Orc
Posts: 419
Joined: Thu Apr 07, 2005 2:11 pm
Location: UK
Contact:

3DS Max and Ogre Coordinates system

Post by manowar »

Hello

I posted once about some missing features in Ogre 3DS Max exporters, especially keyframes animations (no bones). Instead of waiting for this feature to be implemented by someone, I started to look at that myself and see if I can do what I need. I am really new to 3DS Max and maxscript (I am a C++ programmer).

I am trying at the moment to export simple keyframes animations from 3DS Max and I am struggling a bit with coordinates systems. I have a single object (no hierarchy) and I am simply trying to export the keyframes transformations (rotation,translation and scaling) using maxscript.

I understand that the coordinates systems are different .
It is where I need your help.What is the transformation to apply from the quaternion returned from max to be able to use it in Ogre ? At the moment I am just swapping Y and Z, but I guess it is more complex than that for rotations. Some animation seems to work, some not (rotation is wrong). If someone could give me the right transformations to apply or some code example in maxscript, it would be great.

Thanks a lot for your help.


PS.
Hey Lioric if you read by chance this thread is that feature planned in your exporter ? I can tell you that in the company we are all waiting for your exporter ! Videos previews are so impressive ! We cannot wait ! :wink:
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Post by jacmoe »

Take a look at OgreSkeletonLib_usefulfns.ms in ogrenew\Tools\3dsmaxExport\scripts\ogre\lib :wink:

Code: Select all

--------------------------------------------------------------------
-- compute the transform, if you want to flip Y and Z axis,
-- because the axis which 'defines height' in OGRE is the Y axis,
-- whereas 3dsmax uses the Z one.
--------------------------------------------------------------------
function flipYZTransform Tform = (
	local axis1,axis2,axis3,t,m
	
	-- computes the matrix
	axis1 = point3 1 0 0 ;
	axis2 = point3 0 0 1 ;
	axis3 = point3 0 -1 0 ;
	t = point3 0 0 0 ;
	m=matrix3 axis1 axis2 axis3 t ;
	
	-- multiplies by the inverse
	Tform = Tform*inverse(m) ;

	return Tform ;
)
Lioric
Google Summer of Code Mentor
Google Summer of Code Mentor
Posts: 295
Joined: Fri Aug 06, 2004 10:25 pm

Post by Lioric »

This feature is already implemented, along with cameras, lights, and their animations too

We are currently testing it

I will announce the new features probbly today

Lioric
User avatar
manowar
Orc
Posts: 419
Joined: Thu Apr 07, 2005 2:11 pm
Location: UK
Contact:

Post by manowar »

That was quick ! Thanks a lot guys. This forum is great ! Hey Lioric...do you sleep sometimes ? Your work seems amazing...I guess I will not sleep tonight myself...dreaming of the exporter... :wink:

We are currently working on a commercial project using ogre. I can tell you that your exporter would be really useful. At the moment it is really a mess to switch from Octopus and the '3DS exporter'... and exporting maxscript data into ascii files... I hope the magic exporter will be ready soon !

Thanks again
Lioric
Google Summer of Code Mentor
Google Summer of Code Mentor
Posts: 295
Joined: Fri Aug 06, 2004 10:25 pm

Post by Lioric »

Yes i sleep on a regular basis (every night) :)

The exporter is coming at a fast pace thanks to a talented group of beta testers
The object, camera and lights animation part is thanks to Lasse (Channex), he is doing an excellent job

Lioric
Post Reply