Silk.NET icon indicating copy to clipboard operation
Silk.NET copied to clipboard

Add an OpenGL-Assimp model loading demo

Open Perksey opened this issue 2 years ago • 4 comments

Summary

#619 pointed out that we currently have zero resources demonstrating our Assimp bindings, and because Assimp is usually used with C++ there aren't many resources for the C API which we bind to as is.

We should make a demo model loader using Silk.NET.OpenGL and Silk.NET.Assimp.

In my eyes, this looks like:

  • [ ] An ImGui interface allowing you to paste in a file path and load a 3D model (look at examples/CSharp/OpenGL Demos/ImGui and ImGui documentation on how to do this)
  • [ ] When the "Load" button is pressed, call into Silk.NET.Assimp and load the model into OpenGL
    • [ ] Loads vertices & indices, and can render meshes (triangulation can be done by Assimp)
    • [ ] Maybe loads textures if time permits?
  • [ ] Use a Camera similar to the ones demonstrated in examples/CSharp/OpenGL Tutorials to explore the model
    • [ ] However, we'll need a button which will unload the model, put the mouse cursor back into normal mode, and bring the ImGui UI back up again so we can load another model

Resources to Get You Started

  • Voltium's usage of Silk.NET.Assimp (very old version): https://github.com/john-h-k/Voltium/blob/master/sources/Voltium.ModelLoader/ModelLoader.cs#L151
  • LearnOpenGL + Assimp (using C++ API, doesn't match 1:1 with C API): https://learnopengl.com/Model-Loading/Assimp
  • Assimp Simple OpenGL example (uses C API ✅, but uses Old OpenGL 🤢): https://github.com/assimp/assimp/blob/master/samples/SimpleOpenGL/Sample_SimpleOpenGL.c

Perksey avatar Sep 25 '21 13:09 Perksey

This is a sizable issue, but doesn't require any deep knowledge of Silk.NET - just a basic understanding of 3D OpenGL (which can be gained from our tutorials) and a willingness to piece things together 😄

As such, this will be great for a community contributor as a learning exercise (or just to play around with Silk more!) and probably a good candidate for Hacktoberfest as well.

Perksey avatar Sep 25 '21 13:09 Perksey

I was gonna investigate using ASSIMP later. If I can figure it out I will probably see what I can do if no one else has taken it upon themselves by that point.

Redhacker1 avatar Sep 25 '21 13:09 Redhacker1

Agree, examples would be very appreciated!

ponahoum avatar Oct 04 '21 21:10 ponahoum

I know it's not OpenGL but when I get to the model loading chapter of the Vulkan tutorial series I am porting to Silk.NET I intend to use the Assimp bindings instead. Even though that is not what the original tutorial uses.

dfkeenan avatar Dec 12 '21 12:12 dfkeenan

Done in #1161, thanks @zoeysaurusrex!

Perksey avatar Jan 22 '23 18:01 Perksey