Git Product home page Git Product logo

assimp-net's Introduction

C# .NET Wrapper for the Open Asset Import Library (Assimp)

Since Google Code no longer allows new downloads, the latest release can be downloaded via NuGet or on this side.

A .NET wrapper for the Open Asset Import Library (Assimp). The wrapper uses P/Invoke to communicate with Assimp's C-API and is divided into two parts:

Low-level The native methods are exposed via the AssimpLibrary singleton. "Unmanaged" structures prefixed with the name 'Ai' that contain IntPtrs to the unmanaged data. The unmanaged library is loaded/unloaded dynamically, 32 and 64 bit is supported. The managed DLL is 'AnyCPU' Located in the 'Assimp.Unmanaged' namespace. High-level A more C# like interface that is more familiar to .NET programmers and allows you to work with the data in managed memory. Completely handles data marshaling for both import and export, the user left only concerned with the data itself. Located in the default 'Assimp' namespace. Commonalities between these two levels are certain structures like Vector3D, Color4D, etc. The High level layer is very similar to Assimp's C++ API and the low level part is public to allow users do whatever they want (e.g. maybe load the unmanaged data directly into their own structures).

For a brief overview and code sample, check out the Getting Started wiki page.

The binaries were built in Visual Studio 2012 as AnyCpu and target .NET 4.5 and .NET 2.0. They are deployed with the Assimp 3.1.1 release (you can download the latest Assimp releases here).

It is fairly easy to build AssimpNet yourself as it does not rely on many external dependencies that you have to download/install prior. The only special instruction is that you need to ensure that the interop generator patches the AssimpNet.dll in a post-build process, otherwise the library won't function correctly. This is part of the standard build process when running out of a msbuild environment. Look at that build process if you are using something else.

Enjoy!

In addition, check out these other projects from the same author:

Tesla Graphics Engine - a 3D rendering platform written in C# and the primary motivation for developing AssimpNet. DevIL.NET - a sister C# wrapper for the Developer Image Library (DevIL). (Mostly a relic at this point) Follow project updates and more on Twitter

A support forum is located here. Feel free to post questions or comments on the direction of the library

assimp-net's People

Contributors

drjaydenm avatar gitii avatar karelholubicka avatar kimkulling avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

assimp-net's Issues

fbx auto create texture?

fbx embedded textures。

i user fbx sdk the “zuoji.fbm\zuoji_05_1_d.tga“ will be automation create

but user AssimpNet is not。why?

Degrees to Radians conversion is incorrect

in AssImpContext.BuildMatrix the following code is incorrect:

Matrix4x4 xRot = Matrix4x4.FromRotationX(m_xAxisRotation * (float) (180.0d / 
Math.PI));
Matrix4x4 yRot = Matrix4x4.FromRotationY(m_yAxisRotation * (float) (180.0d / 
Math.PI));
Matrix4x4 zRot = Matrix4x4.FromRotationZ(m_zAxisRotation * (float) (180.0d / 
Math.PI));

multiplying by 180/pi is the conversion from radians to degrees but in this 
case its supposed to be converting from degrees to radians.

See
http://en.wikipedia.org/wiki/Radian#Conversion_between_radians_and_degrees

So the * needs to be changed to / or the fraction needs to be inverted to pi/180

This only affects anyone actually setting the build time transformations 
otherwise everything is 0 and there is no difference.

Original issue reported on code.google.com by [email protected] on 19 Nov 2014 at 12:26

blender 2.7.9 .obj file has blank names. (using 3.3.1 Release)

Sample : cube.zip

Importing a .obj file from blender 2.7.9 will give blank names. Ways to replicate this:

Run with sample file and msh.Name will appear blank.

AssimpContext importer = new AssimpContext();
m_model = importer.ImportFile("cube.obj", PostProcessPreset.TargetRealTimeMaximumQuality);
foreach (Mesh msh in m_model.Meshes)
{
    Console.WriteLine($"Mesh Name = {msh.Name}");
}

aiGetMaterialTexture wrapMode is an array of 2 UV

Hi, looking at the code and documentation of aiGetMaterialTexture in assimp 
C++, It seems that wrapMode is actually an array of TextureWrapMode (one for U, 
one for V) instead of a single value, but I have not seen this handle this way 
in Assimp.NET. Possible bug/memory trashing?

Original issue reported on code.google.com by [email protected] on 11 Mar 2013 at 3:28

Cannot find Assimp32.dll in library project

Please provide any additional information below.

Within a c# library project (XNA library project to be exact) I am using 
assimpNet.dll and it always crashes saying that it can't find Assimp32.dll

Assimp32.dll is in the same file location as the assimpNet.dll and in the same 
location as the build output folder, as well as output where the main .exe is 
built that references the library.

Where does it want me to put it? 

In the error you will also notice references to folders that are not part of my 
folder structure at all (Nicolas is not part of my User list).

This is the exact error:

Error   37  Building content threw AssimpException: Error loading unmanaged 
library from path: Assimp32.dll, see inner exception for details.
The specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at Assimp.Unmanaged.AssimpLibraryImplementation.LoadLibrary(String path) in C:\Users\Nicholas\Documents\Visual Studio 2010\Projects\AssimpNet\AssimpNet\Unmanaged\AssimpLibrary.cs:line 1164
   at Assimp.Unmanaged.AssimpLibrary.LoadLibrary(String libPath) in C:\Users\Nicholas\Documents\Visual Studio 2010\Projects\AssimpNet\AssimpNet\Unmanaged\AssimpLibrary.cs:line 111
   at Assimp.Unmanaged.AssimpLibrary.LoadLibrary(String lib32Path, String lib64Path) in C:\Users\Nicholas\Documents\Visual Studio 2010\Projects\AssimpNet\AssimpNet\Unmanaged\AssimpLibrary.cs:line 124
   at Assimp.Unmanaged.AssimpLibrary.LoadLibrary() in C:\Users\Nicholas\Documents\Visual Studio 2010\Projects\AssimpNet\AssimpNet\Unmanaged\AssimpLibrary.cs:line 97
   at Assimp.Unmanaged.AssimpLibrary.EnableVerboseLogging(Boolean enable) in C:\Users\Nicholas\Documents\Visual Studio 2010\Projects\AssimpNet\AssimpNet\Unmanaged\AssimpLibrary.cs:line 343
   at Assimp.AssimpImporter.PrepareImport() in C:\Users\Nicholas\Documents\Visual Studio 2010\Projects\AssimpNet\AssimpNet\AssimpImporter.cs:line 930
   at Assimp.AssimpImporter.ImportFile(String file, PostProcessSteps postProcessFlags) in C:\Users\Nicholas\Documents\Visual Studio 2010\Projects\AssimpNet\AssimpNet\AssimpImporter.cs:line 284
   at ModelAnimationPipeline.ModelAnimationImporterFbx.Import(String filename, ContentImporterContext context) in C:\Users\Joshua\Desktop\Work\SneakyPants3DStuff\AndAgain\TheGreatAlienEscape\src\ModelAnimationPipeline\ModelAnimationImporter.cs:line 38
   at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetDirectly(BuildItem item, String importerName)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
   at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
   at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings)
    Inner exception: FileNotFoundException: The specified module could not be found. (Exception from HRESULT: 0x8007007E)   C:\Users\Joshua\Desktop\Work\SneakyPants3DStuff\AndAgain\TheGreatAlienEscape\src\ProjectSneakyGame\ProjectSneakyGameContent\NPC2.fbx    ProjectSneakyGame

Original issue reported on code.google.com by [email protected] on 12 Dec 2013 at 5:55

Access Violation in EmbeddedTexture::FromNative

Occurring when reading texel data for non-compressed textures:

MemoryHelper.FromNativeArray<Texel>(nativeValue.Data, size);

Original issue reported on code.google.com by nicholas.woodfield on 24 May 2013 at 4:16

Crashes when reading Collada

What steps will reproduce the problem?
1. Calling importer.ImportFile(path.dae), importer is AssimpContext class
2. I think that it needs to be larger model (> 10 MB)
3. I've tried to reexport model in Maya/3ds Max, still crashes

What version of the product are you using? On what operating system?
I'm using newest version (3.1.1) on Windows 8.1

Please provide any additional information below.
Smaller ones are working just fine (up to 4 MB)
It just crashes without any exception.
There is dl link to one of the model which crashes 
https://mega.co.nz/#!J8hGiRzZ!94KRUIBxem-cGHgMpFZsQy1OymrzX2xt5AeNuBL2n2k

Original issue reported on code.google.com by [email protected] on 14 Feb 2015 at 5:12

In Mesh.cs method GetUnsignedIndices() always returns null

What steps will reproduce the problem?
1. Load any model with AssimpContext to Assimp.Scene
2. Get any valid scene mesh
3. Try to load mesh indices with GetUnsignedIndices() to an array
4. Get null instead

OS Windows 8.1, Assimp .Net version 3.3.1.0

According to source file, it seems that the method just misses "return" on 
successful execution.


Original issue reported on code.google.com by [email protected] on 12 Feb 2015 at 9:53

Sample uses GL.Begin/GL.End

These have been deprecated since 2003 and are gone since version 3.0. Can't use in ES at all. This needs fixing. Needs to be VBO.

Reference to dll's invalid in vs 2010

What steps will reproduce the problem?
1. Importing Assimp32.dll or Assimp64.dll in vs2010 .net4 Client/Full 
2.Just importing assimpnet.dll crashes program in vb.net and wpf using 
winformshost 
3.

What is the expected output? What do you see instead?
Error refers to the fact that reference is unsuccessull because the file is not 
com visible or unaccessible.

"{"Could not load file or assembly 'AssimpNet, Version=2.1.2.1, 
Culture=neutral, PublicKeyToken=0d51b391f59f42a6' or one of its dependencies. 
An attempt was made to load a program with an incorrect format."}"

What version of the product are you using? On what operating system?
Win 7 62 bit VS 2010 Professional

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 4 Sep 2012 at 12:18

loading native library fails on linux

What steps will reproduce the problem?
1. implement example from getting started wiki
2. use mono on linux, with xamarin studio and nuget package of assimp-net
3. run example application -> crash

What is the expected output? What do you see instead?

the application crashes because the assimp library is not named assimp64 on 
linux. 



What version of the product are you using? On what operating system?

nuget package of assimp-net. also copied dozens of assimp libraries from latest 
c++ assimp version



Please provide any additional information below.

changing the name has no effect, it seems like the loadlibrary call is 
searching in a wrong directory


i attached my error log

Original issue reported on code.google.com by [email protected] on 20 Aug 2014 at 8:49

Attachments:

fbx error,fbx has texture。

AssimpNet.dll!Assimp.MemoryHelper.FromNativeArray(System.IntPtr nativeArray, int length) 240 C#
AssimpNet.dll!Assimp.EmbeddedTexture.Assimp.IMarshalable<Assimp.EmbeddedTexture, Assimp.Unmanaged.AiTexture>.FromNative(ref Assimp.Unmanaged.AiTexture nativeValue) 266 C#
AssimpNet.dll!Assimp.MemoryHelper.FromNativeArray<Assimp.EmbeddedTexture, Assimp.Unmanaged.AiTexture>(System.IntPtr nativeArray, int length, bool arrayOfPointers) 198 C#
AssimpNet.dll!Assimp.Scene.Assimp.IMarshalable<Assimp.Scene, Assimp.Unmanaged.AiScene>.FromNative(ref Assimp.Unmanaged.AiScene nativeValue) 443 C#
AssimpNet.dll!Assimp.MemoryHelper.FromNativePointer<Assimp.Scene, Assimp.Unmanaged.AiScene>(System.IntPtr ptr) 356 C#
AssimpNet.dll!Assimp.Scene.FromUnmanagedScene(System.IntPtr scenePtr) 332 C#
AssimpNet.dll!Assimp.AssimpContext.ImportFile(string file, Assimp.PostProcessSteps postProcessFlags) 299 C#
AssimpNet.Sample.exe!Assimp.Sample.SimpleOpenGLSample.SimpleOpenGLSample() 52 C#
AssimpNet.Sample.exe!Assimp.Sample.Program.Main() 35 C#

AssimpExporter

Reminder to get the exporter up and running

Original issue reported on code.google.com by nicholas.woodfield on 27 Jun 2013 at 3:35

Build fails with message Tesla.Interop.Generator.exe is not a valid Win32 application

What steps will reproduce the problem?
1. Get the source using SVN
2. Load the solution and try compiling it.

What is the expected output? What do you see instead?
Build succeeds. Compiled dll.
I see the error message box pops up and the build fails.


What version of the product are you using? On what operating system?
Latest source from the trunk.
Windows XP SP3


Please provide any additional information below.
When tried compiling without the Tesla.Interop.Generator.exe step I get the 
dll, but when using it the execution eventually goes into one of the 
InternalInterop functions (ReadInline) which just throws exception. Is this the 
intent? I really hoped to use the new version... :(

Original issue reported on code.google.com by [email protected] on 21 Jun 2013 at 6:38

AssimpLogging

Reminder to move log streams from the importer to a singleton. Its the only 
reason we're locking the importers when a model is loaded. Turning verbose 
logging/attaching log streams should be global options. This should make the 
library friendlier to multithreaded model loading.

Original issue reported on code.google.com by nicholas.woodfield on 27 Jun 2013 at 3:37

Unable to open Lightwave LWS file from stream

What steps will reproduce the problem?
1. Open a FileStream to scenes/fenris.lws
2. Create a new AssimpImporter and call ImportFileFromStream(stream, ".lws")
3. Crash due to AssimpException

What is the expected output? What do you see instead?
Expected output would be a valid scene just like you get by using the 
ImportFile method instead. However, ImportFileFromStream is unable to resolve 
the external file dependencies to the referenced LWO files. These files contain 
the actual geometry in the scene and without them no geometry is ever loaded.

What version of the product are you using? On what operating system?
Assimp.Net 3.1

Please provide any additional information below.
I didn't find any way to supply custom file handling to Assimp to resolve those 
external file dependencies. There is a IOSystem class in Assimp, which is 
supposed to be used for that, but this doesn't seem to be exposed in Assimp.Net.

Original issue reported on code.google.com by [email protected] on 28 Feb 2013 at 1:55

Attachments:

exceptions when reading ifc files.

I can load most of my Ifc files, but without any visible reasons some of them just can't be imported with assimp.Net.

Exception is 'StackOverflowException'. It is thrown in AssimpLibrary.ImportFile (AssimpLibrary.cs, line #247), so I'm pretty sure it has something to do with native Assimp library, which I'm not able to debug right now.
It may have something to do with the file itself perhaps, which would be less worrying for me.

Attached to this post is an example of one of them.
Could you please take a loot at it ?

SAMPLE_EXCEPTION.zip

It is impossible to add diffuse texture at export

I try to implement export to .OBJ format. My material has diffuse textures, and 
I do the following:

TextureSlot t = new TextureSlot();
t.FilePath = dst_texture_file_name;
t.TextureType = TextureType.Diffuse;
t.TextureIndex = 0;

assimp_material.TextureDiffuse = t;

After that, assimp_material.TextureDiffuse.FilePath remains null, 
assimp_material.HasTextureDiffuse continues to show false.

Expected output is 'map_Kd lenna.tga' string it resulting .OBJ file, but it is 
missing.

I use version 3.3.1 on Windows 7.

This is C++ code of assimp:

aiString s;
if(AI_SUCCESS == mat->Get(AI_MATKEY_TEXTURE_DIFFUSE(0),s)) {
    mOutputMat << "map_kd " << s.data << endl;
}

Look like all is OK there. Something is wrong in C#. Thanks.

Original issue reported on code.google.com by [email protected] on 25 Jan 2015 at 3:00

Library is broken on Mac OSX

When using the library on Mac OSX, most things will fail because the library 
tries to PInvoke to libdl.so, which does not exist on OSX.  On OSX, dload() and 
friends are provided by libSystem.B.dylib.

I've attached a patch that adds the necessary logic.

I've also attached some changes that make the build system and unit tests pass 
on OSX.  The primary changes are using Path.Combine to concatenate path 
fragments rather than assuming any particular character, and the introduction 
of a silly little bash-batch polyglot application to ensure that 
AssimpNet.Interop.Generator.exe is invoked via mono.

Original issue reported on code.google.com by [email protected] on 30 Aug 2014 at 8:54

Attachments:

Not able to export a scene

I am using Assimp Libs v4.1.0, but I also tried v3.3.1 and 3.3.2.

I can't export a scene. I also tried to import an scene and export it withut tuching it.
But It doesn't work.

Here a code that I have tested and failed:

            Dim mdl As Scene = Nothing
            Dim ac As New AssimpContext
            Dim channelIndicies As New Dictionary(Of Material, Integer)

            ac.SetConfig(New Configs.NormalSmoothingAngleConfig(66.0F))
            mdl = ac.ImportFile(fileName, PostProcessPreset.TargetRealTimeMaximumQuality Or PostProcessSteps.Triangulate)

            Dim formatID As String = ""
            Dim myExt As String = Path.GetExtension(fileName).ToLower.Substring(1)
            For Each efd As ExportFormatDescription In ac.GetSupportedExportFormats
                If myExt = efd.FileExtension Then
                    formatID = efd.FormatId
                    Exit For
                End If
            Next

            ac.ExportFile(mdl, fileName, formatID, PostProcessPreset.TargetRealTimeMaximumQuality)

What I do wrong? Or is that a bug?

Please help me!

Problems with Matrix4x4 Decompose()

I was using Assimp 2.x for .net that was provided in the assimp project ( not 
your AssimpNet wrapper ) , and i decided to move to assimp 3 and use your 
wrapper :)

After i finished porting (very easy thankfully) , i noticed that skinned meshes 
were completely wrong ( Note that they used to work fine before ). The strange 
thing was that not all boned meshes were wrong.

After investigation i found that the problem was in the Matrix4x4.Decompose() 
function for matrices. If i used DecomposeNoScaling() and assume scaling 1 the 
meshes suddenly  improved a lot , but still had errors.

The solutions i found was to copy the matrix in a SharpDX matrix and  use that 
decomposing and everything works fine now.

I should also mention that i use DirectX with the 
PostProcessSteps.MakeLeftHanded enabled ...this will mirror matrices.. i don't 
know if this causes any problems with the decompose function but it's a 
possibility.

the revision i used is r45

Thanks :)


Original issue reported on code.google.com by [email protected] on 30 Oct 2012 at 10:26

Better Mono Support

Need to tidy up a few things with the AssimpLibrary DLL loading/proc addressing 
to play nice with Mono out of the box.

Original issue reported on code.google.com by nicholas.woodfield on 12 Jun 2013 at 2:07

Crash with updated OpenTK

What steps will reproduce the problem?
1. build sample against current opentk
2. run program
3. stack overflow results

What is the expected output? What do you see instead?
expect rotating duck, get stack overflow after a flash of the duck

What version of the product are you using? On what operating system?
trunk version on Win8.1 compiled with VS2013 express for desktop

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 30 Apr 2014 at 2:39

AccessViolationException with latest assimp version

I'm trying to use AssimpNet with the most recent Assimp library, which I just compiled from source code.

Reading an object work fine, but when I try to save an object I get a AccessViolationException:

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

It used to work with an Assimp DLL I compiled before in december 2016, so I guess there are some changes in Assimp since then that are not compatible with AssimpNet. Did anybody experience this before?

Noticed that normal maps (bump maps) are incorrectly loaded as the 'Height' type textures.

What steps will reproduce the problem?
1. Get a model with a bump/normal map.
2. Load it and observe that the normal map is of 'Height' type, rather than 
'Normals'. Note that 'Height' type should contain a displacement map if any.

What is the expected output? What do you see instead?
Expect normal maps to be loaded as Normals textures.
Normal maps are loaded as Height textures.


What version of the product are you using? On what operating system?
Well, the one before the latest. Cannot get the latest to work at the moment 
due to the Tesla problem.


Please provide any additional information below.
Attaching sample DAE model on which you can easily repro the issue.

Original issue reported on code.google.com by [email protected] on 24 Jun 2013 at 6:29

Attachments:

AssimpNet: AccessViolationException

Hi,
I was using AssimpNet today and when I was trying to Import .STL file and then export it to an OBJ, i got an AccessViolationException, below is the Exception Message:
An unhandled exception of type 'System.AccessViolationException' occurred in AssimpNet.dll Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
But when I use Open3Mod Viewer, I am able to view the STL file with 4 meshes.It also has 4015886 Vertices and 1821446 Triangles.

Below is a screenshot from Open3Mod Viewer:
image

and here is what I get after conversion:
image

Please help me with this.

New version needed

Hi,
The latest beta version is old
Could you build another release using the latest assimp dll please ?
Thank you
Romain

Broken Exporter

I realy don't know why, but exporting with Assimp.dll 64bit v4.1.0 doesn't work and v3.1.1 works.
And I am testing since weeks now.

Here two test codes which work perfectly with v3.1.1 and with v4.1.0 I get a System.AccessViolationException:

grafik

grafik

Please fix that or tell me what I do wrong, I realy would use the Export-Feature.

Runtime errors when compiled with .NET 3.5

What steps will reproduce the problem?
1. Change target framework to .NET 3.5
2. Change reference to IntPtr.Add to Marshal.ReadIntPtr
3. Compile AssimpNet
3. Create a .NET 3.5 testbed application
4. Load any 3D model.

What is the expected output? What do you see instead?
The expected output is the model is loaded successfully.  Instead, I get a 
System.NullReferenceException which occurs in Material.cs line 411.  The 
properties variable is null when it tries to access the Length property.

What version of the product are you using? On what operating system?
2.1.2 Refresh

Please provide any additional information below.
Like I stated in the steps to reproduce, I had to change any reference to 
IntPtr.Add to Marshal.ReadIntPtr.  Obviously when I compile under .NET 4.0 for 
AssimpNet and the testbed application, everything works fine.  It's only when I 
try and compile under .NET 3.5.

Original issue reported on code.google.com by [email protected] on 30 Oct 2012 at 10:00

Bring forward Tesla.Interop.Generator

Port the code for this project from Tesla Engine (v2) so it can be compiled 
alongside AssimpNet. Have gotten a bug report when compiling AssimpNet for a 
platform that doesn't supported .NET 4.5

Original issue reported on code.google.com by nicholas.woodfield on 11 Jun 2013 at 9:00

exporting smooth normals

It seems that lib is ignoring config settings and whatever I try to export 
model I got flat version (no real vertex normals).

I've tried file to file conversion and blob to file (code below).

NormalSmoothingAngleConfig config = new NormalSmoothingAngleConfig(40.0f);

importer.SetConfig(config);

ExportDataBlob blob = importer.ConvertFromFileToBlob(fileName, 
"obj",PostProcessSteps.GenerateSmoothNormals /*with or without doesn't change 
anything*/);


Original issue reported on code.google.com by [email protected] on 11 Aug 2013 at 8:06

AssimpLibrary.cs - Compile Error

Hello,

I downloaded the Source via SVN, opend the Projekt in VS2012 Express and tried 
to compile the Sources.

Projekt AssimpNet:
AssimpLibrary.cs arround Line 1471
private void PreloadFunctions() {...}
in that function is following line:
GetFunction(funcType.GetCustomAttribute<AssimpFunctionNameAttribute>().Unmanaged
FunctionName, funcType);

The Error is like (translated from German):
'System.Type' has no defination for 'GetCustomAttribute', and can not find a 
Method 'GetCustomAttribute' which accepts as first parameter 'System.Type'.

If I check:
http://msdn.microsoft.com/en-us/library/system.type.getcustomattributes(v=vs.110
).aspx
- that is correct.

Original issue reported on code.google.com by [email protected] on 7 Sep 2013 at 5:28

How do you use this with an IFC file?

String fileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "AC14-FZK-Haus.ifc");

        AssimpContext importer = new AssimpContext();

        m_model = importer.ImportFile(fileName, PostProcessSteps.None);

Gives me this error:

Assimp.AssimpException: 'Error importing file: The string ",0.,0.))" cannot be converted into a value.'

Cannot find any examples on how to use assimp-net with ifc files... :/

NullReferenceException when trying to import FBX.

Hi, I'm getting the following exception with the latest versions for both (assimpnet and assimp)

NullReferenceException: Object reference not set to an instance of an object System.String.FormatHelper (System.Text.StringBuilder result, IFormatProvider provider, System.String format, System.Object[] args) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/String.cs:1940) System.String.Format (IFormatProvider provider, System.String format, System.Object[] args) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/String.cs:1873) System.String.Format (System.String format, System.Object arg0, System.Object arg1, System.Object arg2) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System/String.cs:1863) Assimp.Material.CreateFullyQualifiedName (System.String baseName, TextureType texType, Int32 texIndex) Assimp.MaterialProperty.get_FullyQualifiedName () Assimp.Material.AddProperty (Assimp.MaterialProperty matProp) Assimp.Material.Assimp.IMarshalable<Assimp.Material,Assimp.Unmanaged.AiMaterial>.FromNative (Assimp.Unmanaged.AiMaterial& nativeValue) Assimp.MemoryHelper.FromNativeArray[Material,AiMaterial] (IntPtr nativeArray, Int32 length, Boolean arrayOfPointers) Assimp.Scene.Assimp.IMarshalable<Assimp.Scene,Assimp.Unmanaged.AiScene>.FromNative (Assimp.Unmanaged.AiScene& nativeValue) Assimp.MemoryHelper.FromNativePointer[Scene,AiScene] (IntPtr ptr) Assimp.Scene.FromUnmanagedScene (IntPtr scenePtr) Assimp.AssimpContext.ImportFile (System.String file, PostProcessSteps postProcessFlags)

Any help is appreciated.

Help with scene creation

I'm currently trying to create a new Scene using a custom 3D model format not supported by Assimp. The issue is, is I am not very knowledgeable when it comes to unsafe/unmanaged code in c#.

My issue is that when I try to create a new Scene(), the scene is read-only. This is intentional, and I've read that there is a different way to do this. However I'm unsure of my interpretation of how to work this into my project.

From my understanding, I must first create an AiScene, and assign to the AiScene, pointers which reference the structures housing all the data, then pass a pointer to the AiScene reference into the method Scene.FromUnmanagedScene(AiScene*). Is this correct?

I am very confused about this, and any help at all would be greatly appreciated.

Assimp import throws StackoverflowException can't be caught by try/catch in .NET env

Using .NET dll (from NuGet), from time to time we are getting exception that can't be caught by try/catch. StackoverflowException is one example - https://msdn.microsoft.com/en-us/library/system.stackoverflowexception(v=vs.110).aspx You can download the mode from http://static.tf3dm.com/models/c3dc953mnm68-Colloseum-by-William.zip to repro the issue.

We also found other uncaughtable exception. Here is the details:

FatalExecutionEngineError occurred HResult=-2146233082 Message=Exception of type 'System.ExecutionEngineException' was thrown. InnerException:

http://static.tf3dm.com/models/1/b6193a6p5m2o-Glass_Sparkling_Water.rar

Can all these exceptions be handled by assimp code? In our continuous process, it would stop when this kind of exception triggered.
Thanks.
-Ethan

NuGet AssimpNet.targets does not find native libraries

The file AssimpNet.targets file shipped with the NuGet package assumes that the Assimp-net NuGet package (containing the native Assimp[32|64].dll files) is located one directory up from the project file. See the ..\ in:

    <ItemGroup>
        <NativeAssimpLibs Include="$(MSBuildProjectDirectory)\..\Packages\AssimpNet.*\lib\Assimp*.dll"/>
    </ItemGroup>

This is a bad assumption since the NuGet packages are copied relative to the SOLUTION and not relative to the PROJECT. The assumption holds for simple example projects/solutions created with the VisualStudio project wizard. More complex solutions might reference projects not located one directory below the .sln file.

Issue with Importing IFC files

Hi,
I have 2 issues with importing IFC files using AssimpNET (keep in mind that I am noob in the topic):

(A) I'm trying to import IFC files with AssimpNet 3.3.2. There is an error (attached Image) when I try to import the IFC file.

(B) I have read on forums that AssimpNet 3.0 imports IFC. The issue here is that I cannot link AssimpNet.dll and Assimp64.dll to my c# project on VS 2015. I forked the AssimpNet 3.0 from the Git repository and built the AssimpNet.sln and then placed the resulting dlls to my c3 projects bin/x64 folder where the exe resides.
Anyway, the VS cannot find the Assimp libraries when I try to declare Assimp with "using Assimp".

But, when I tried placing the assimp 3.0 dlls in my Unity project assets folder and called assimp from a c# script in unity, it works and also imports the IFC file.

What am I doing wrong when linking the AssimpNet 3.0 with VS 2015 c# project?

This is my code:

using System;
using System.IO;
using System.Reflection;
using Assimp;
using Assimp.Configs;
namespace Example
{
    class Program
    {
        static void Main(string[] args)
        {
           
            String fileName = "F:/rst_basic_sample_project.ifc";
            
            AssimpContext importer = new AssimpContext();
              
            Scene model = importer.ImportFile(fileName);

            Console.WriteLine("no. of meshes in the model is: " + model.MeshCount);
           
            importer.Dispose();

        }
    }
}

issue_ifc

Problem importing OBJ files (probably assimp problem, not assimpNet)

I have some OBJ which imported correctly in 3.3.1 and doesn't work on 4. doesntWork.obj does not expose the texture correctly, while works.OBJ does.

The only difference is where the g (group) and usemtl are placed. Tinkering with the OBJ file, I think that the "group" must be defined after the "mtllib". If not, the problem happens.

I don't know if this is a malformed OBJ file either. The OBJ format is ... well... very badly defined. Both OBJ files correctly load on 3DSMax 2013 though.

objs (renamed)
doesntWork.txt
works.txt

material (renamed... but any material and texture file will do, the problem seems to be in the OBJ)
floorTest.txt

Observed incorrect DurationInTicks when loading .GLB models.

Using
Assimp.net nuget ver 5.00beta.
Os win10
Language C#
Graphics framework Monogame, utilizing a desktop GL type project.

Observed apparent incorrect DurationInTicks when loading .GLB models.
For Fbx and other files the animation times seem to be correct.

Celesium Man
modeltestEx06_slow
don't mind the textures the shaders aren't in there yet still have to figure all that out.

The .GLBs seem to import some where about 10x to slow like a extra 0 is stuck on animation duration. I didn’t test this for regular gltfs and im just getting my viewer up and running.

Since its just the two values and the fbx timings are still ok.
It seemed that this shouldn't be related to my own code so i posted this as a issue.

Here is a little output of the two values.

Anim #[0] Name:

DurationInTicks: 2000
TicksPerSecond: 24.5
DurationInTicks / TicksPerSecond: 2000 / 24.5 sec. total duration in seconds: 81.6326530612245

I have one animation that is about 90 seconds long and it ends coming out to be 900 seconds long.
Not to big of a deal i speed it up by about 10 or so it looks about right but it appears to be a bug
.

Move to git?

Hi there!
I planning to use Assimp.Net for SharpDX and I was wondering if Assimp.net 
could be migrated to a more distributed/community friendly source system like 
git? (Just in case I would find some missing features/bugs/enhancement/whatever)
Greetings

Original issue reported on code.google.com by [email protected] on 5 Dec 2012 at 2:43

assimp 3.1.1

This is not really an issue, more of an FYI, about v3.1.1

I committed a few things on the assimp repo (mostly about FBX and metadata) and 
wherever appropriate i did the necessary additions in my assimpNet fork in 
github.

You can see them here and use whatever you find usefull.
https://github.com/VirusFree/AssimpNet/commits/master

A problem i found and was not able to fix correctly,but had to result in an 
ugly workaround, was with aistrings.. i think this is a .net marshaling bug 
were it would only fetch a byte from the buffer and leave the rest zero.
(even though when checking with the memory viewer in visual studio i could see 
the source/native buffer was ok)

Anyway, this is just an FYI and if you need any help with moving to v3.1.1 let 
me know :)

Original issue reported on code.google.com by [email protected] on 25 Jun 2014 at 8:04

Custom IO System doesnt work when Importing from stream

Hi!
I was trying to load some .OBJ files from an IOStream. These obj files have attached materials in a separate file. If I'm loading the .obj files using ImportFileFromStream, I get the following error logs:

|Information| - ASSIMP - Info,  T10160: Import root directory is './'
|Error| - ASSIMP - Error, T10160: OBJ: Unable to locate material file wall.mtl

If I load the file from the disk with ImportFIle()
|Information| - ASSIMP - Info, T16528: Import root directory is 'D:/Dev/GLAssets\'

I tried using a creating an IO System and setting it to the importer, but it doesnt even get called.

AssimpContext.ImportFileFromStream formatHint?

As I have asynchronous framework loading data transparent from server/local I always would like to handle data as byte-array. Unfortunatly I found no detailed information about AssimpContext.ImportFileFromStream about the formatHint parameter. Furthermore, aiImportFileFromMemory() from the native code allows so send an empty string to find out format by itself but the managed level does not permit it.
Can you tell me what I have to pass to the this argument?

IMPORT_COLLADA_USE_COLLADA_NAMES

Hello! First of all, thanks for your work.

I face an issue loading Collada DAE files: the Assimp.Node names are in reality the ID of the collada node.

I see that original library manage this introducing IMPORT_COLLADA_USE_COLLADA_NAMES config parameter (look at [https://github.com/assimp/assimp/commit/c356ea70c4407cc65b41f695ca4542ee8d5a91bb] ) but i am unable to use it.. seems to me is ignored.

I set it in that way (directly with the string):
assCtx.SetConfig(new Assimp.Configs.IntegerPropertyConfig("IMPORT_COLLADA_USE_COLLADA_NAMES", 1));

because i was not able to find the predefined class into Assimp.Configs.

I am doing something wrong? There is any possible workaround?

Thanks in advance!
Francesco

Is there a EmbededTexture property from which I can get the texture image reference ?

have an issue when I tried to read texture image information using AssimpNet.

The fbx file that I tried to read has 10 embedded textures and has no external textures: texture screenshot

according to the information from assimp, the embedded textures are referenced from materials using strings like "*0", "*1" as the texture paths.

However, among the 12 materials in my fbx file, some them have texture paths like "..\buildings.fbm\6M4P000O.JPG" which corresponds to the image file name

As for the first scenario which has strings like "*0", "*1", I can find corresponding texture by using the number as the reference to Textures, but for the second scenario, I could not find the corresponding file name from Textures because in AssimpNet, the EmbeddedTexture has no such property

But according to assimp, which is the base of assimpnet, from its texture.h file, I found that it has a property called mFilename and from this property we could get the texture's image file name; assimp texture.h

I am wondering if AssimpNet should include filename into EmbededTexture properties so that we could find the correct reference if the filepath contains the filename rather than number.

Error when importing assembly stream

Heya,
If this problem has been solved once, I am very sorry.
I have an assembly, where I store a "glb"-file (had the same issue, with "obj", too) with some primitives.

The problem is, when I import the stream over "ImportFileFromStream", I get the following error message:
Assimp.AssimpException: 'Error importing file: BLEND: BLENDER magic bytes are missing, couldn't find GZIP header either
If I open it over paths, it's importing as it should.

I use Assembly.GetExecutingAssembly().GetManifestResourceStream("SMRenderer.Base.Models.Objects.SMDefaultObjects.glb")
to import the stream. At other importer, like SharpGLTF, I had no problems with the stream.

I am on Assimp-5.0.0-beta1 (latest currently)

I am happy for everyone, who attempts to help me.
Michel

AnyCpu built

Hello again,

I have been working a little on assimp.net for the needs of my project and i 
made it for AnyCpu , because it's not convenient to have a project with 50 
AnyCpu dlls and one that it not..

It basically has the native assimp dll under a x86 and a x64 folder and chooses 
the appropriate file when loading is necessary.

The paths can also be modified by the user (at runtime but before using 
assimp.net ) , so the user can have his own x86,x64 folders and have the 
approriate native assimp dlls inside.

I attached a patch for this. ( its based on r63 , so no conflicts )

Thank you :)

Original issue reported on code.google.com by [email protected] on 12 Nov 2012 at 9:41

Attachments:

Error when loading a .obj model when the .mtl file is in the same folder

What steps will reproduce the problem?
1. Copy the obj and the mtl in the same directory
2. Load the model using Assimp.Net

What is the expected output? What do you see instead?
Load without error

What version of the product are you using? On what operating system?
2.1.2

Please provide any additional information below.
It seems that the error comes from Assimp library. It has been fixed in the 
latest version.

Original issue reported on code.google.com by [email protected] on 22 Sep 2012 at 10:16

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.