have some trouble with DWG import in Maya and saving it for Unity3D - import

I have a problem with exporting a 3D Model from Maya, imported from a AutoCAD (DWG File) as a 3D Object. (for using it in Unity3D at the end)
I have downloaded this dwg file from AutoCad. DWG File
The I have open it in Maya 2014 and save it as a Maya ASCII file.
https://dl.dropboxusercontent.com/u/15710714/conference_room.ma
No when I trying to import the MA file into Unity3D it does not work. (The file seems to be empty :( )
I guess the problem is Maya, maybe I have to setup or transform the imported DWG Data in Polygons or something else.
Does anyone can help me?

The file is full of NURBS geometry but Unity only recognizes polygon geometry. Select the objects in Maya and use Modify > Convert > Nurbs to Polygons to convert them

Related

Quick and efficient way to transfer from an flt object with rgb/rgba textures to fbx with jpg/png textures

I have several really big object files in the flt format. These objects have all of their textures in rgb and rgba files. I used 3DS Max to convert from flt to fbx, but all the textures are still in rgb/rgba format. Unity doesn't seem to accept these image files. For one of them, I converted all of the images by using image magik and then in Unity adding each corresponding texture to the correct material. This was a pain and very time consuming. Not only that, it only applied to the one Unity project so if I wanted to pull it into any other project or software, I would have to do it again. That one model had several hundred textures and so do the other ones I have.
Is there a way to convert a FLT object with RGB/RGBA texture files to a FBX object with JPG/PNG texture files easily? I can easily convert all of the rgb files to jpg and the rgba files to png (if that matters). I have 3DS Max and Maya that I can use.
There's not an easy one-off way to do this -- neither FLT nor RGB are common file formats these days.
Probably the best code solution is to convert all of the images in bulk (changing their extensions) and then write an AssetPostprocesor in Unity that matches finds the new .tga or .jpg files corresponding to the materials referenced by the assets and swap them in. That will save the hand work on the Unity end. If this is going to be something you do often it's worth the work.
You could so something fairly similar in Maya: you'd import the fbx file into a blank maya scene, look for the file texture nodes, and replace the rgb/rgba extensions with tga or jpg or whatever. That would looks something like this:
def update_fbx(filname, source = 'rgb', target = 'tga'):
cmds.file(f=True, new=True) # clear the scene
cmds.FBXImport(f=filename) # import the fbx
#assuming you have materials with file nodes pointing at
# rgb extensions, replace with tga
for each_file_node in cmds.ls(type = 'file'):
oldname = cmds.getAttr(each_file_node + ".ftn")
newname = oldname.replace(source, target)
cmds.setAttr(each_file_node + ".ftn", newname)
then re-export the scene as a new FBX, which will have the correct file references.
There are a lot of variables, depending on how the source files are structured, but this is a general idea of how you could tackle it.

How to create a DAE file to use in SceneKit?

How do you create a .dae file from a 3D model? I've created a 3D model from a drone areal mapping and now have a very large file I can import in to Photoshop, but I can't figure out how to create a .dae file I can use in SceneKit.
The default game example for Xcode has a SceneKit that shows a rotating aircraft, and the asset is a .dae file, but I don't see any documentation on how to create one of those from a 3D model, and how to correctly apply a texture to it.
To create a 3D model and export it as a Collada .dae file you can use any of the following 3D authoring tools: Autodesk Maya, Blender, Autodesk 3dsMax, The Foundry Modo, Maxon Cinema 4D, SideFX Houdini, etc. The simplest way is to use a non-commercial student version of Autodesk Maya 2022. It's free. You can download it from HERE.
There are countless examples in YouTube how to model and uv-map in Maya software. Look at this example of UV-mapping in Maya. So, when your 3D model (and its UV-texture) is ready for use, you can export it as one of the four formats supported by SceneKit:
animated Collada DAE
animated Pixar USDZ (for iOS 12 and higher)
animated Autodesk FBX
single-frame Sony Alembic
single-frame Wavefront OBJ
In Maya Export Type for your 3D geometry must be DAE_FBX export:
A texture for you model (square UV-mapping 1K or 2K) you can export as JPEG or PNG file. It may look like this:
This UV-square-texture you must assign to a Diffuse slot of properties in Lighting Model (shader) in Show the Material Inspector.
And here's some Swift code if you wanna make it programmatically:
let scene = SCNScene(named: "art.scnassets/mushroom.scn")!
let mushroom = scene.rootNode.childNode(withName: "mushroom",
recursively: true)!
let mushroomMaterial = SCNMaterial()
mushroomMaterial.diffuse.contents = UIImage(named: "mushroom.png")
P.S. Working with Pixar's USDZ file format:
If you need a .usdz for your 3D scene, you can convert .usda using the following command in Terminal:
usdzconvert file.usda
Here you can read about usdzconvert command.

To convert 3d model from obj,3ds to .ac file format

I am having a 3d model of a car in .3ds format.I want to convert .3ds/.obj files into .ac format. Is there any tool to do this?
Here's one solution.
Blender (http://www.blender.org/) can open .3DS and .OBJ formats.
File Formats
Blender comes packed with import/export support for many different programs.
3D
3D Studio (3DS), COLLADA (DAE), Filmbox (FBX), Autodesk (DXF),
Wavefront (OBJ), DirectX (x), Lightwave (LWO), Motion Capture (BVH),
SVG, Stanford PLY, STL, VRML, VRML97, X3D.
And this AC3D Exporter plugin for Blender will allow you to export to .AC.
Export selected meshes to AC3D's .ac file format.

XNA 4: import FBX problem

I have a problem with importing 3D model from FBX file.
Source model contains 575 objects + 1 camera and looks like this: http://habreffect.ru/files/23d/542fa7f67/source_model.png
In XNA prepared with content pipeline model contains 82 meshes, and 576 bones.
So, when I draw my model, I see only part of source model. Result picture like following:
http://habreffect.ru/files/28a/6e61c0215/Result_view.png
My drawing code:
GraphicsDevice.Clear(Color.CornflowerBlue);
Matrix[] transforms = new Matrix[_model.Bones.Count];
_model.CopyAbsoluteBoneTransformsTo(transforms);
foreach (var mesh in _model.Meshes)
{
foreach (BasicEffect effect in mesh.Effects)
{
effect.LightingEnabled = true;
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] * _world;
effect.View = _view;
effect.Projection = _proj;
}
mesh.Draw();
}
base.Draw(gameTime);
How can I get all 575 meshes in my Model instance in XNA?
Thanks!
UPD: I tried to import my FBX model to 3ds max, select all meshes and use "Export selected". Result FBX file is 11x bigger. Then I add it as content to XNA project, loaded model contains all 575 meshes, and it rendered correctly.
Unfortunately, this manual converting method don't suit me - I need to render varied fbx models from mutable repository.
So, what FBX file are "good" for XNA content processor (I use XNA 4)?
So, on MSDN I found that FbxImporter designed to work with 2006.11 version of FBX format.
Recently Autodesk released FBX Converter 2012.1, which contains other tools, like FBX Eplorer, FBX Viewer.
FBX explorer can show structure of FBX file, and I compare exported from 3D MAX file, and source FBX file. They have different internal format. I tried to make following conversion: FBX -> Collada -> FBX, and the result FBX file contains similar to exported from MAX data structure.
So, I simply add the result FBX to Content of my XNA app, and it's rendered well :)
Another way to make it work is to use Autodesk FBX SDK to manually read model, and draw it in XNA.
Conclusion:
XNA FbxImporter correct work doesn't depend on version (2006, 2011, etc) and form (binary, ascii) of FBX file. Internal FBX data structure much more important.
To make FBX "readable" for XNA Importer you can use double conversion like FBX -> Collada -> FBX
You also can use FBX SDK to manually load data from FBX
Open the 3d model in latest 3dx max 2012 and export it in .fbx format. This .fbx is loaded properly with the xna model loader. While exporting you can even embed the resources, so you dont have to add textures to it through XNA.
You are using instancing in 3DS MAX. This isn't supported directly by XNA.
You have to draw the mesh for each instance bone yourself.
Ideally you would instead use DirectX instancing to draw each mesh once per bone in a single Draw() call.
But you have to roll your own code to do that, by converting the bones into instance vertices.
By default XNA only supports the most basic operations.

How to get Wavefront .obj file with 3 faces (traingle)

I have a .obj file with 4 faces (polygon)
How can i convert the 4 faces polygon to 3 faces triangles?
is there any script available to do so?
Is there any Engine which loads 4 faces?
use blender to convert wavefront .obj file with quads to triangles.
Import wavefront .obj file in Blender and change the mode to Edit Mode.
Now select all the meshes.
Go to Mesh -> Face menu options and select convert Quads to triangles
Export the current model again to wavefront .obj file
http://iphonedevelopment.blogspot.com/2009/06/using-3d-models-from-blender-in-opengl.html
Assume n-gons are coplanar and triangulate them.