Giter Club home page Giter Club logo

assimpunitywrapper's Introduction

AssImp Unity Wrapper

I was trying to find custom asset import on runtime. Currently in unity there is no direct way to do this. I searched on the web I could only find one plugin which is AssImp (https://github.com/assimp/assimp) which is written in C++. After that tried to find .Net wrapper for this and found out that there is AssImp official updated plugin on bitbucket(https://bitbucket.org/Starnick/assimpnet). In this plugin there are also an script which loads the dlls in unity which is also used in the project.

After that tried to find if someone has implemented this in unity. There are multiple people who tried implemented but could not find any thing which is complete. So decided to write my own wrapper to handle the AssImp .Net dlls in unity.

  1. First step is to compile the latest AssImp .Net source code and get the required Dlls. Add This project already contains working dlls and they can be replaced with new ones too.

  2. Next is use CrossTales File Browser by which we can get the path of the asset.

  3. Then we have to intialize AssImp with the following settings

     importer.SetConfig(new Assimp.Configs.MeshVertexLimitConfig(60000));
     importer.SetConfig(new Assimp.Configs.MeshTriangleLimitConfig(60000));
     importer.SetConfig(new Assimp.Configs.RemoveDegeneratePrimitivesConfig(true));
     importer.SetConfig(new Assimp.Configs.SortByPrimitiveTypeConfig(Assimp.PrimitiveType.Line | Assimp.PrimitiveType.Point));
    
     postProcessSteps = Assimp.PostProcessPreset.TargetRealTimeMaximumQuality | Assimp.PostProcessSteps.MakeLeftHanded | Assimp.PostProcessSteps.FlipWindingOrder;
    
  4. We can always use the property Assimp.AssimpUnity.IsAssimpAvailable to check if AssImp is available on platform.

  5. Now we are good to go to import the asset using Scene scene = importer.ImportFile(modelPath, postProcessSteps).

  6. In scene we will get al the data for the asset.

  7. We have to display the data in unity. This code is present in CustomAssetImporter.

This project also uses Free file browser plugin created by CrossTales (https://assetstore.unity.com/packages/tools/gui/file-browser-windows-macos-98716)

Platform:

Tested both on Windows and Mac.

assimpunitywrapper's People

Contributors

zohaibjaved avatar

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.