Skip to content

Commit 53675fc

Browse files
authored
Merge pull request #436 from Unity-Technologies/UNI-49735-document-new-features
Uni 49735 document new features
2 parents f87119f + 3d9aca1 commit 53675fc

File tree

1 file changed

+129
-8
lines changed

1 file changed

+129
-8
lines changed

Packages/com.unity.formats.fbx/Documentation~/com.unity.formats.fbx.md

Lines changed: 129 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ The FBX Exporter exports the following objects:
8585
* Game Cameras are exported using the sensor back settings for 35mm TV Projection (width = 0.816 inches, height = 0.612 inches). These camera attributes are also exported:
8686
* Projection type (perspective/orthographic)
8787
* Aspect ratio
88-
* Aperture Width and Height (shown as "Sensor Size" in Unity, in milimiters. The height is set to 0.612 inches, and the width is relative to the aspect ratio)
88+
* Aperture Width and Height (shown as "Sensor Size" in Unity, in millimeters. The height is set to 0.612 inches, and the width is relative to the aspect ratio)
8989
* Focal length
9090
* Vertical field of view. The default aperture mode is vertical.
9191
* Near and far clipping plane
92-
* Physical Cameras (cameras for which the "Physical Camera" checkbox is enabled.
92+
* Physical Cameras (cameras for which the "Physical Camera" checkbox is enabled.)
9393
* Lens Shift
9494
* Focal Length
9595
* Lights of type *Directional*, *Spot* , *Point*, and *Area*; also the following light attributes:
@@ -98,6 +98,39 @@ The FBX Exporter exports the following objects:
9898
* Intensity
9999
* Range
100100
* Shadows (either On or Off)
101+
* Constraints of type *Rotation*, *Aim*, *Position*, *Scale*, and *Parent*; also the following constraint attributes:
102+
* Sources
103+
* Source Weight
104+
* Weight
105+
* Active
106+
* Rotation:
107+
* Affected axes (X,Y,Z)
108+
* Rotation Offset
109+
* Rest Rotation
110+
* Aim:
111+
* Affected axes (X,Y,Z)
112+
* Rotation Offset
113+
* Rest Rotation
114+
* World Up Type
115+
* World Up Object
116+
* World Up Vector
117+
* Up Vector
118+
* Aim Vector
119+
* Position:
120+
* Affected axes (X,Y,Z)
121+
* Translation Offset
122+
* Rest Translation
123+
* Scale:
124+
* Affected axes (X,Y,Z)
125+
* Scale Offset
126+
* Rest Scale
127+
* Parent:
128+
* Source Translation Offset (animated)
129+
* Source Rotation Offset (animated)
130+
* Affect Rotation Axes
131+
* Affect Translation Axes
132+
* Rest Translation
133+
* Rest Rotation
101134
* Legacy and Generic Animation from Animation and Animator components, or from a Timeline clip; also the following animated attributes:
102135
* Transforms
103136
* Lights:
@@ -106,13 +139,34 @@ The FBX Exporter exports the following objects:
106139
* Color
107140
* Cameras:
108141
* Field of View
142+
* Constraints:
143+
* Weight
144+
* Source Weight
145+
* Translation Offset (Position Constraint)
146+
* Rotation Offset (Rotation Constraint and Aim Constraint)
147+
* Scale Offset (Scale Constraint)
148+
* Source Translation Offset (Parent Constraint)
149+
* Source Rotation Offset (Parent Constraint)
150+
* World Up Vector (Aim Constraint)
151+
* Up Vector (Aim Constraint)
152+
* Aim Vector (Aim Constraint)
109153
* Blendshapes
110-
* Constraints
111-
* Rotation
112-
* Aim
113-
* Position
114-
* Scale
115-
* Parent
154+
155+
## Cameras
156+
157+
Game Cameras (Physical Camera unchecked) are exported using the sensor back settings for 35mm TV Projection which has an Aperture Width of 0.816 inches and Aperture Height of 0.612 inches.
158+
159+
On export the Aperture Width is calculated using this sensor back relative to the Camera Aspect Ratio for example:
160+
161+
* Full 1024 4:3 (1024x768)
162+
* Aspect Ratio 4:3
163+
* Aperture Width = 0.612 * (1024/768)
164+
165+
The Focal Length (for game cameras) will be derived from the vertical FOV and the sensor back settings (Aperture Width and Aperture Height). The aperture mode will be set to Vertical using the default FBX setting for ApertureMode.
166+
167+
Film Resolution Gate is set to Horizontal so that the importing software will fit the resolution gate horizontally within the film gate.
168+
169+
The Near & Far clipping plane has a range of 30 cm to 600000 cm.
116170

117171

118172
## Export Options window
@@ -529,3 +583,70 @@ public static void ExportGameObjects(Object[] objects)
529583
// ModelExporter.ExportObjects to export a single game object
530584
}
531585
```
586+
587+
## Runtime
588+
589+
The FBX SDK bindings can be executed during gameplay allowing import/export at runtime. Currently a custom importer/exporter needs to be written in order to do so, as the FBX exporter is editor only.
590+
591+
Basic Exporter:
592+
593+
```
594+
using Autodesk.Fbx;
595+
using UnityEngine;
596+
using UnityEditor;
597+
598+
protected void ExportScene (string fileName)
599+
{
600+
using(FbxManager fbxManager = FbxManager.Create ()){
601+
// configure IO settings.
602+
fbxManager.SetIOSettings (FbxIOSettings.Create (fbxManager, Globals.IOSROOT));
603+
604+
// Export the scene
605+
using (FbxExporter exporter = FbxExporter.Create (fbxManager, "myExporter")) {
606+
607+
// Initialize the exporter.
608+
bool status = exporter.Initialize (fileName, -1, fbxManager.GetIOSettings ());
609+
610+
// Create a new scene to export
611+
FbxScene scene = FbxScene.Create (fbxManager, "myScene");
612+
613+
// Export the scene to the file.
614+
exporter.Export (scene);
615+
}
616+
}
617+
}
618+
```
619+
620+
Basic Importer:
621+
622+
```
623+
using Autodesk.Fbx;
624+
using UnityEngine;
625+
using UnityEditor;
626+
627+
protected void ImportScene (string fileName)
628+
{
629+
using(FbxManager fbxManager = FbxManager.Create ()){
630+
// configure IO settings.
631+
fbxManager.SetIOSettings (FbxIOSettings.Create (fbxManager, Globals.IOSROOT));
632+
633+
// Import the scene to make sure file is valid
634+
using (FbxImporter importer = FbxImporter.Create (fbxManager, "myImporter")) {
635+
636+
// Initialize the importer.
637+
bool status = importer.Initialize (fileName, -1, fbxManager.GetIOSettings ());
638+
639+
// Create a new scene so it can be populated by the imported file.
640+
FbxScene scene = FbxScene.Create (fbxManager, "myScene");
641+
642+
// Import the contents of the file into the scene.
643+
importer.Import (scene);
644+
}
645+
}
646+
}
647+
```
648+
649+
### Limitations
650+
651+
* IL2CPP is not supported
652+
* Only 64 bit Windows and MacOS standalone player builds are supported

0 commit comments

Comments
 (0)