How to use .blend file in iphone project? - iphone

I dont want to use any 3D engine like SIO2 etc engines in my project. But I still want to use .blender 3d files in my normal projects.
Can anyone please guide me how I can proceed with that.
Thanks

The .blend format is not much more than a python pickle object with some binary header fields. It unfortunately is neither very optimized nor easy to load data from.
Also blender format is prone to version differences which are very subtle and will be handled by upgraded blender versions but you will lose a lot of time learning all the differences between the .blend file versions.
I recommend you either roll your own exporter for your own preferred format (should it not exist in the blender community or addons) or use a generic format, some good all-round formats are :
Collada (Builtin)
Direct X format (Builtin)
Check for more blender import and export plugins

Export your blend file to another format.
http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts#Import-Export_Scripts
Which you choose depends upon how you will render your objects. Check out the "raw" exporter, since you are rolling your own renderer.

Related

How to include Unity3d libs in a non-Unity3d project?

I'm developing a C# library that will be used either as a plugin in some Unity3d projects and also used in non-Unity3d projects.
I need to use some Unity3d classes (such as UnityEngine.Matrix4x4) and standardize some functions to use valid types agnostically to whether the project is an Unity project or not.
So, as the title says: what is the right way to include Unity3d libraries in a non-Unity3d library project? Should I just include reference to the local Unity3d binaries (like UnityEngine.dll) in my project? If so, which is the right folder to look for these binaries (they appear in some different folders in the unity installation folder)?
If you are not actually running the Unity Engine for rendering or handling input it may be the case of forcing a round peg into a square hole, both technically and legally.
The most elegant solution would likely be to write your library in C# using more agnostic libraries. For example the Matrix4x4 class you mentioned has an equivalent in System.Numerics. Alongside the library all thats needed is a light wrapper converting a System.Numerics.Matrix4x4 to a UnityEngine.Matrix4x4. Sometimes the Unity devs themselves do stuff like this, for example the Unity.Mathematics.float3 struct which works better in ECS land than a standard Vector3.
FYI if you're looking for how some particular system works, check out the C# Reference GitHub Repository, for example the Matrix4x4 struct. Just be aware that 'copying and pasting' Unity source code is not allowed.

How to integrate Unitymol with Unity3D project?

Firstly, thanks for bothering your time reading this problem.
I recently want to develop a Unity3D project which serves for molecular visualization on HTC Vive with the help of SteamVR. I've found that Unitymol is a suitable solution to visualize PDB files, but I have problem import them into Unity3D, because I fail to figure out how can I export models/gameobjects from Unitymol.
What should I do? In fact, what I need is to import PDB files into Unity3D. Blender is not a acceptable solution because it can't load large PDB files and need much work to do after importation.
I am one of the developer of UnityMol.
For now, this project is not fully open sourced and you need the sources to extract generated GameObjects.
You can ask for Marc Baaden to initiate à collaboration.
We have scripts to create Unity assets and use them in other projects.
If you are trying to visualize molecules in VR, we already are doing this in UnityMol VR.

Dealing with autocad objects in Unity

I am new in Unity development and I have good experience in Autocad development. Is it possible to use 3d solids & 3d mesh terrains created in autocad and display it in the Unity interface and also get its properties (such as 3D solid color, dimensions, handles etc..)
Unity supports .FBX, .dae (Collada), .3DS, .dxf and .obj files. If your Autocad can export to any of these then the answer is yes. It is possible but read below.
Objects produced in Autocad, SolidWorks or other similar software should not be imported to Unity directly by any means. Its too heavy for Unity. If you want to use your models from any of these software, export them to software such as Maya or Blender then clean the models up. Reduce the poly counts before importing into Unity.
Note that it will take time to clean the models up. You should spend that time making new models in Maya or Blender. If your goal is to make a game, then you need to learn either Maya or Blender. Autocad is not used for that. Since you are already using Autocad, I suggest you use Maya since the UIs are now made to look similar.
EDIT:
I see an answer below suggesting that it's totally fine to use Autocad models in Unity or model the objects in Autocad. It's not just about creating models. You have to do some work on the models to make it look good and even work properly with Unity's render engine. Here are many reasons not to use Autocad to model your game objects:
1.UV mapping/unwrapping.
You have to unwrap the model's UV before importing the model into a game engine. Without this, it's hard to do texturing and you'll run into issues. Not to mention one of the biggest issue called "texture seams".
2.Texturing the model.
Again, this is done inside programs like Maya and Blender not Autocad.
3.Baking textures/Map
You need to bake maps most of the times when working with high detailed models. When generating materials from V-ray or any renderer in Maya with complex materials, you need to to bake the final result into may types of maps such as color, normal, alpha.... This also applies to light baking.
4.Map Transfer
Initially, you model high poly then transfer the map to a low poly. You can't do this with Autocad. This is very import as it reduces the number of polys in your game.
Everything mentioned above are very important when it comes to game development but Autocad is not made to handle those.
Use the right tool for the job. Use Autocad for engineering and Maya or Blender for games, movies and art. It's as simple as that.
To export from AutoCad, use the OBJ format, or FBX. The Unity "what files can I import" page is misleading because exported file formats differ with each new year and new versions of the exporting programs are often not compatible with Unity. It takes Unity devs a few years to get around to updating the import process, unfortunately.
In regards to optimizing your models, "cleaning them up" in Maya is a joke because Maya will also export "heavy" models depending on the format you use. There is a precedence for cleaning a model up, but AutoCad products are the best in the industry, and if you clean them up in a CAD program and then export in OBJ or FBX, it should be fine. Maya is also an AutoCad product, I'm just saying that you don't have to juggle a file around in different programs. If you use the OBJ or FBX export format and if your file is mostly a CG model, then it will work fine going straight from a CAD program into Unity, usually. CAD programs have utilities to clean up models, as do programs like Sketchup, DAZ3D and others. You don't need to triangulate faces, and usually OBJ will work great.
Your best option for importing to Unity is to use OBJ if possible, from any source program. Most models will sustain this if you don't have animations or "bones". If you export to OBJ and choose the option to NOT triangulate all the faces, and DO include the textures, you should be fine. If your model includes animations then you should use FBX format which will have a considerably higher file size cost.
In addition, it works better to drag-and-drop the .obj file, .mtl file and textures folder into the Unity Asset folder where you want it (better than trying the "import asset" native Unity feature).
Be advised that many of the formats that Unity claims to import on its "what files can I import" page are invalid based on the version of the exporting program. For example, DXF files must be an earlier version, not the most recent. Programs like Sketchup and .skp will only import into Unity if you use an earlier version, as far back as 2013, at this time, as of Unity 5.6.0f3.
Usually, if you are aware of these issues and you are willing to try a few methods of CG model exporting/importing, you will find success. Obviously, game devs keep using Unity because they value the engine enough to tolerate these kind of imperfections.

Blender fbx import from ascii format

I have a FBX model which I would like to open in Blender but when I try to import the model it says: ASCII FBX files are not supported. Is there a way to import the model to Blender somehow? I don't have access to any Autodesk software.
For some reason Blender import doesn't support FBX models that are serialized to text.
As a workaround the model can be changed to binary FBX model and imported to Blender. At least I am able to use Autodesk FBX 2013.3 Converter even I don't have any other Autodesk software installed.
Other option that might work is to use Bos FBX Importer.
PS. If you want to export FBX models from Blender and be able to import them again, you can choose version: FBX 7.4 binary not FBX 6.1 ASCII in the export settings panel.
If you have Visual Studio installed try to open the original file then save it and import in Blender. This should work.
Unfortunately I can't comment yet but here's an update to maZZZu's answer:
The Bos FBX Importer will also not open ASCII .fbx files, however Autodesk's FBX Converter still does.
Here's the updated URL: https://www.autodesk.com/developer-network/platform-technologies/fbx-converter-archives
I tried Audtodesk converter - useless because of UV destroying.
I use Paint 3D (if you have win10 of course). Works fluent. Just open it then save in fbx again.
p.s. have a nice day!
This simple commandline tool worked for me to convert an ASCII FBX to a Blender-compatible binary FBX: https://github.com/BobbyAnguelov/FbxFormatConverter/releases/
It can convert between binary and ascii - see usage info, for example:
# ASCII to Binary
FbxFormatConverter.exe -c in_ascii.fbx -o out_binary.fbx -binary
# Binary to ASCII
FbxFormatConverter.exe -c in_binary.fbx -o out_ascii.fbx -ascii
It's for Windows, but I used it fine with wine under linux.
If you use the pre-compiled version, technically you should agree to the FBX SDK license agreement.
What really works is this:
https://www.autodesk.com/developer-network/platform-technologies/fbx-sdk-2020-0?us_oa=akn-us&us_si=9066be5d-863a-4cd3-b98f-87bda034316b&us_st=fbx%20sdk
there you can download sdk for all common used os.
You can compile the ConvertScene sample with: cmake, gcc, libxml2-dev
The resulting binary can be used to convert ascii fbx to bin fbx that can be imported in blender.
This site has a good explanation. It says that ASCII format is human readable, contains all the model's info, but it's not Blender-readable. We need Binary format, and whoever makes the model needs to choose ASCII to give customers all the data, or they choose binary to make it importable to Blender. When they choose ASCII, we need to covert it ourselves. Supposedly there's a free tool for converting this using the Autodesk. I'm still looking around the Autodesk site for a free tool, but it may require some trial software. https://www.blender3darchitect.com/modeling-for-architecture/import-ascii-fbx-files-blender/.
Update: I found this page with links to Autodesk tools, including the FBX 2013.3 Converter for Windows 64-bit mentioned earlier in this thread: https://www.autodesk.com/developer-network/platform-technologies/fbx-converter-archives
Update 2: It* worked! I converted my ASCII FBX to Binary, and I imported successfully into Blender 2.80. (*It = FBX 2013.3 Converter for Windows 64-bit)

Unity3D gives version error when .blend file is placed in unity's assets folder

When I copy .blend file in Unity's Assets folder it says
Blender could not convert the .blend file to FBX file.
You need to use Blender 2.45-2.49 or 2.58 and later versions for direct Blender import to work.
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEditor.DockArea:OnGUI()
But I am currrently using version 2.7. I am using a .blend file from internet source to use in my game. Does re-saving help in getting rid of errors or is there another possible and efficent way to resolve this issue ?
Although Unity has full function over .Blend files I belive downloading the .Blend file from the internet is the problem
( You may test that theory by exporting a simple model of your own and see if it works with Unity )
If your test model works then it's obviously something wrong downloading it from the internet.
I've had problems with this before and to date have had no solution I suggest trying to copy the model and model it for your self ( perhaps even copy and paste it from one project file to another)
One obvious sign that it will not export correctly is if editing your model in blender sends the model into a orange tint and the object would not be able to be edited....
In conclusion the best thing you can do if it's the internet to blame is attempt to recreat the model and/or animations :) hope it helps and good luck :)