Home > Uncategorized > FBX export fix for 3ds Max to XNA

FBX export fix for 3ds Max to XNA

I’ve been using 3ds Max to export models for use in XNA and it took me quite a while to find this fix. The problem here is that 3ds Max exports everything with the wrong up axis and other problems related to the pivit point. The MaxScript Utility below seems to fix most of these export problems by adding an XForm modifier to each mesh and applying some offset and rotation transformations.


Utility RotFixUtil "Rotation Fix Utility"
(
--
-- Use at your own risk - save often.
--

fn RotateFix obj rot =
(

select obj

local objS = scaleMatrix obj.objectoffsetScale
local objR = obj.objectoffsetRot as matrix3
local objT = transMatrix obj.objectoffsetPos
local offset = objS * objR * objT

obj.objectoffsetPos = [0,0,0]
obj.objectoffsetRot = (quat 0 0 0 1)
obj.objectoffsetScale = [1,1,1]

modPanel.addModToSelection (XForm ()) ui:on
obj.modifiers[#XForm].gizmo.transform = offset
obj.modifiers[#XForm].gizmo.rotation += rot as quat

rotate obj (inverse rot as quat)
)

button rFixbtn "Fix Rotation"

on rFixbtn pressed do
(
if $ != undefined then
(
for obj in $ do
(
RotateFix obj (eulerToQuat(eulerAngles 90 0 0))
)
)
else
(
messageBox "Select an object then run this script again." title:"Selection Error" beep:true
)
)

)
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s