FBX export fix for 3ds Max to XNA

October 7, 2011 Leave a comment

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))
messageBox "Select an object then run this script again." title:"Selection Error" beep:true


ESXi 4 and Kernel Options

July 26, 2011 Leave a comment

I have a Dell PowerEdge 1900 that boots to VMWare ESXi 4.1 from a USB pen drive. The only real problem I ran across was that it got stuck on loading the megaraid_sas driver on startup. This was fixed by setting kernel options to disable ACPI and power management.

The first solution:

Press SHIFT+O after the system starts booting. You should get a prompt to “Enter advanced options”. Type “noACPI nopowerManagement” and press enter, then enter again to continue booting.

This worked for me and as long as the power stayed on, everything was good. However, I need my servers to come up automatically without operator intervention.

The permanent solution(s):

Method 1: Use the vSphere Client to make changes to the kernel options

In vSphere Client, connect to your server and click on the “Configuration” tab.

Under “Software”, click on “Advanced Settings”.

A new window will open, click on “VMkernel”.

Uncheck the boxes next to both “VMkernel.Boot.ACPI” and “VMkernel.Boot.powerManagement”.

Method 2: Modify /bootbank/boot.cfg

Get to the file system

Option 1: Use a Linux Live CD to access the file system

Option 2: Once ESXi is up and running, connect to the server using SSH.

Add “ACPI=FALSE powerManagement=FALSE” to the “kernalopt=” line in “/bootbank/boot.cfg”

My boot.cfg file ended up looking like this:

kernelopt=ACPI=FALSE powerManagement=FALSE
modules=k.z --- s.z --- c.z --- oem.tgz --- license.tgz --- m.z

This is something to look out for after installing VMWare ESXi updates, you might have to do it again.


Categories: Uncategorized Tags: , , ,

Using System.IO.Packaging to Read & Write Zip Archives

June 29, 2011 Leave a comment

While building a content packaging system for one of my recent applications, I found the need to write to and read from Zip archive files and came across the DotNetZip project on CodePlex. This project looks great, but I don’t want my applications referencing any 3rd party dll files and I’m hesitant to use anything released under any kind of license, GPL or not.

I found a working example of writing to Zip archives using System.IO.Packaging on Jon Galloway’s Blog.

This code works great for writing to Zip files, but what about extracting files?

Microsoft provides the “Reading a Package Sample” code sample which extracts resources based on file relationships.

The code sample uses two foreach loops to look at PackageRelationships and then extract necessary files.

If we don’t care about these relationships and just want to extract the files, all we have to do is loop through the PackageParts:

using (Package package =
 Package.Open(targetFilename, FileMode.Open, FileAccess.Read))
  foreach (PackagePart pp in package.GetParts())
    ExtractPart(pp, targetFilename);

That’s it!

Categories: Uncategorized