It took me over a week of rewatching this video to integrate the concepts into my own game engine, but finally got it all figured out. Thanks a ton!
@OGLDEV Жыл бұрын
Glad to hear, good luck with your engine!
@1004-u5t Жыл бұрын
nooooo please!! I have to do this in less than 12 hours my project is due:((((((((((((((
@eliseoryez11969 ай бұрын
@@1004-u5t how did it go big bro?
@michaeldpaul2 жыл бұрын
14:40 I wish more tutorials would tell you this! (and I wish I had found this video months ago when I was pulling my hair out). Thank you for all the great info you share with us
@OGLDEV2 жыл бұрын
Glad it was helpful!
@OGLDEV2 жыл бұрын
Some of the code in this video is going to be changed in the next few tutorials as we add material and lighting support. If you want to get the same version so that you can follow along with the video you can checkout the tag 'TUT_18_ASSIMP'.
@holdipoldi60482 жыл бұрын
this explanation is very helpful for me ! Thanks and greetings from Munich 🙂
@OGLDEV2 жыл бұрын
You're welcome :-)
@0xB16B00B Жыл бұрын
im so glad can know about your channel, your video and how you explain something is very well and easy to understand. Thank you very much 🙏🙏
@OGLDEV Жыл бұрын
You're welcome :-)
@MrFacciolone2 жыл бұрын
on some system enabling for DEPTH testing won't be enough, a depth buffer must be explicitely initialized when the OpenGL context is constructed. With freeglut it must be specified this way : glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH ); glutInitWindowSize(width, height); Adding GLUT_DEPTH to the code was necessary on my machine. Great tutorial series I am learning a lot thx for the good work!
@OGLDEV2 жыл бұрын
Thanks a lot for your feedback. I added it on the entire code base and also updated the tutorial on the website with this info.
@MrFacciolone2 жыл бұрын
@@OGLDEV my pleasure to be helpful! Thanks again for the excellent tutorial, I started this series 1 month ago with zero experience with anything 3D or GPU related, and I feel am learning very fast because of how well designed and thought out your tutorial is. Code is also very well written and complete and that's a significant bonus to the whole learning experience.
@OGLDEV2 жыл бұрын
Thanks! Good luck!
@OGLDEV2 жыл бұрын
The following comment got deleted by youtube for some reason: "I have a bit of a different setup where my model class stores multiple mesh objects. However when I load in textures through the model class they render as weird characters instead of colors but if I load them through the mesh object it works just fine. The way it works is I pass in texture objects to the mesh class to store and use. At first I thought it was a memory issue with the textures going out of scope when being passed to the mesh but it doesn't seem to be the case after using dynamic allocations. Any thoughts?". Seems to be some confusion with regard to the distinction between a class and an object. Loading textures through the class means using a static method which is not attached to any specific object. The most straightforward for this to work is for every object to load its own textures and bind them at runtime before the draw call. If you want to share the textures between the different objects (e.g. for memory optimization) then you can use a static map in the class and have each object access the textures that it needs using a common index. According to the bug description my guess is simply that the wrong textures were loaded. You can track the actual texture that is being used using apitrace. See my tutorial on debugging OpenGL for a few examples.
@benceweisz1063 Жыл бұрын
From what I understand, your mesh class uses per vertex normals. If say I wanted to do per triangle normals and I had less vertices than triangles how would I approach the problem? Are most models used in industry designed to just use per vertex normals or is it common to see per primitive normals. Thanks!
@OGLDEV Жыл бұрын
Assimp provides the flags aiProcess_GenSmoothNormals (vertex normals) and aiProcess_GenNormals (face normals) that allow you to specify which type of normal to calculate. Note that if the original model was exported with normals then these will be used as-is. I guess the rational is to respect the way that the object was modelled. AFAIK most models today use vertex normals because they provide a more realistic lighting effect. But face normals can still be used if you want to achieve some kind of a low polygon or less modern feel.
@toddwasson33552 жыл бұрын
Very helpful, thanks. Got some models running in my D3D12 noob engine.
@OGLDEV2 жыл бұрын
Great, thanks!
@tanveerasif5978 Жыл бұрын
Hi, thanks for the explanation. I would like to ask a question, What advantage 'Array of structure(AOS)' bring over 'Structure of Array(SOA)' ? I understand the difference but didn't understand the benefit of one, over the others.
@OGLDEV Жыл бұрын
afaik, there is a performance advantage to SOA. It is easier for the compiler to optimize for SOA (on the cpu for sure but probably on the gpu as well). The vectorizing instructions are usually geared towards SOA. Try asking chatgpt: "Is structure of arrays better than an array of structures for performance on the gpu" ;-)
@ПавелКиселёв-э6п Жыл бұрын
Thanks for your great video. I have some trouble when using this code in Code Blocks IDE (Include\ogldev_math_3d.h|37|fatal error: assimp/vector3.h: No such file or directory) It can't find assimp/vector3.h, but it in assimp directory.
@OGLDEV Жыл бұрын
You need to add 'ogldev/Include/assimp5' to the include path in the IDE. It contains 'assimp/vector3.h'.
@nicolassuarez29335 ай бұрын
The same company behind opengl and glft has almost no out of the fox support for gltt and glb??? I am really strugling here. Any help? Thanks!
@OGLDEV5 ай бұрын
Assimp does support both gltf and glb. Perhaps there's a problem with a specific model.
@dengan6992 жыл бұрын
Oh wow thanks for this tutorial series. excellent job
@OGLDEV2 жыл бұрын
You're very welcome!
@bimDe20242 жыл бұрын
we can also use vcpkg package manager for assimp
@OGLDEV2 жыл бұрын
Thanks. I never tried that. Good to know that it's working correctly.
@Julia-fp5zr2 жыл бұрын
Thanks for the video! I am still a little bit confused about the Basicmesh class and its functions. Where do I need to put the BasicMesh class? I can't find it in the "tutorial18" folder on Git. Is it part of the tutorial.cpp file? Or is it an own .cpp file? Or where does the whole Basic:Mesh Code you showed in your video go? Thanks for your help!
@OGLDEV2 жыл бұрын
The link to the source code which you can find in every video description points to the specific directory of the tutorial. In addition, there are supporting classes in the root directory under 'Include' and 'Common'. The BasicMesh class declaration is in github.com/emeiri/ogldev/blob/master/Include/ogldev_basic_mesh.h and the implementation is in github.com/emeiri/ogldev/blob/master/Common/ogldev_basic_mesh.cpp. This class encapsulates the population of index and vertex buffers from the data loaded by Assimp, initializes the vertex layout accordingly and provides a simple 'Render' interface to be used from the main application. This allows you to load any model type supported by Assimp (obj, fbx, etc) and then render it with a single call.
@yoonhakim24558 ай бұрын
Hello. Could you explain what 0 means in HasTextureCoords(0)? and how we are able to do mTextureCoords[0][i]? I looked at the documentation and it showed that mTextureCoords is a one dimension array.
@OGLDEV8 ай бұрын
The vertex may include zero or more (current maximum is 8) texture attributes. You need to call HasTextureCoords with the index of the coordinates and it will tell you whether it exists. I would have preferred an API that tells you how many tex coords exist but this is how it works. I'm only interested in the first set so I pass in zero. mTextureCoords is indeed one dimensional array but of pointers which means that every element in the array is the base of a different array. So the first index is zero for the first set of coords and the second index is 'I' for the coords of the current vertex.
@yoonhakim24558 ай бұрын
@@OGLDEV Now I get it thank you. Just one more thing, do you still have the source code from the video? I looked at your github page but I couldn't find one.
@OGLDEV8 ай бұрын
The source code is here: github.com/emeiri/ogldev/tree/master/tutorial18_youtube. If you want to get the same version that was used in the video (the master branch contains many changes) checkout the tag TUT_18_ASSIMP.
@yoonhakim24558 ай бұрын
@@OGLDEV Thank you. your videos are awesome.
@OGLDEV8 ай бұрын
Thanks!
@unluck75 ай бұрын
how do we import assimp 5.x or higher in unity?
@OGLDEV5 ай бұрын
Assimp is a library for loading many file formats. You can easily integrate it into your own application. Unity also supports several formats though I doubt that they are using Assimp. They probably implemented their own loader.
@nicolassuarez29335 ай бұрын
Outstanding! I cloned your repo, so in theory I dont have to do anything in order to run tutorial 18? The first tutorials are working perfectly. But 18 is not working for me in version 2022. Also where the is the spider.obj? Thanks! 1>C:\Users\camis\Downloads\ogldev\Common\ogldev_basic_mesh.cpp(22,10): error C1083: Cannot open include file: '3rdparty/meshoptimizer/src/meshoptimizer.h': No such file or directory
@OGLDEV5 ай бұрын
1. The repo should be working out of the box, including tutorial 18. 2. For the missing meshoptimizer files run the following in the root dir: git submodule update --init 3. The spider.obj file is in ogldev/Content.
@nicolassuarez29335 ай бұрын
@@OGLDEV It worked! I created a folder in ogldev\Include\3rdparty\meshoptimizer\src\meshoptimizer.h from git hub. How to load custom models from blender? With standard export parameters obj is not working for me. fbx, gltf, custom textures? Thanks!
@OGLDEV5 ай бұрын
With obj make sure to also 'triangulate faces'. fbx requires 'apply scaling=fbx custom scale'. Also triangulate faces. Not sure exactly about gltf but probably along the lines of the above. These things something need trial and error. obj is the simples to debug because it's a text format so you can manually tweak it.
@nerijusvilcinskas7851 Жыл бұрын
Great video! Although, I have used interleaved buffer (Array of Structures) in my model loader using assimp and it works perfectly, plus I made it a template class and I can use different vertex attribute layouts, so would I benefit if I used SOA (Structure of Arrays) assimp loading instead of AOS?
@OGLDEV Жыл бұрын
There are various resources online that discuss the performance implications of AOS and SOA but personally I'm not aware of a benefit of one over the other.
@nerijusvilcinskas7851 Жыл бұрын
@@OGLDEV I guess I'll stick to AOS for now because it works very well too, thanks!
@deathspreads Жыл бұрын
I'm trying to use this exact tutorial as the base code for a personal project of mine. Is there a separate repo for this project only? Otherwise I've been messing around with the code for an hour or so now and I just can't seem to make it run; there's only an empty shell window that pops up for half a second and disappears.
@OGLDEV Жыл бұрын
I prefer keeping everything in a single repo because it reduces the maintenance effort. Sound like you are on Windows so you can open the Visual Studio solution at 'ogldev\Windows\ogldev_vs_2022\ogldev_vs_2022.sln' and go to the 'Tutorial18' project. You will find all the cpp files that you need to build there. Note that some of them are actually located in 'ogldev\tutorial18_youtube' and the rest are in 'ogldev\Include' and 'ogldev\Common'.
@deathspreads Жыл бұрын
@@OGLDEV Yes I have managed to find the solution and I built and ran it, but I feel like I'm misunderstanding something, since all I see is a black console screen. I have watched the video but I don't seem to get how to make it run properly. I see that the arguments fed into the executable call are used in the glutInit function; does this mean I need to feed it arguments for it to load a certain model? It's either that or I mismanged my installation of the dependencies such as GL and ASSIMP.
@OGLDEV Жыл бұрын
The arguments to glutInit are used just for the initialization of GLUT which handles windows creation, keyboard control, etc. The actual loading of the model is in tutorial18_youtube\tutorial18.cpp:108. If you are not familiar with GLUT then I suggest going through the tutorials one by one. I've just verified that the latest code works ok so if you are not seeing the spider then this will require some debugging on your end.
@greengem8537 Жыл бұрын
How can i see original code that was in video with tag?
@OGLDEV Жыл бұрын
git checkout For example, to get the code for this video: git checkout TUT_18_ASSIMP Most of my videos have tags and you can usually find them in the video description. I'm still working on adding tags to the rest of them...
@dev.ashesh Жыл бұрын
Will this work if lets say a custom binary file that contains a model inside?
@OGLDEV Жыл бұрын
What do you mean by 'custom'? Assimp supports many binary file types such as fbx. If you can load a fbx file in Unity there's a good chance that Assimp will be able to load it as well.
@dev.ashesh Жыл бұрын
@@OGLDEV like custom file format.. its a binary file that contains a 3d mesh inside.. but the problem is i have to find the values manually in hex.. and its very time consuming..
@OGLDEV Жыл бұрын
Then afaik the answer is no. It doesn't provide a general method for specifying a custom file format like a template or something like that.
@danielkolev74582 жыл бұрын
I have a question, how can I add my own model to insert in the code. Please I am just new and don't know the subject very well. Thanks in advance!
@OGLDEV2 жыл бұрын
From this tutorial forward all models are loaded by creating an instance of the BasicMesh class and calling the function LoadMesh("/path/to/model/filename") on this instance/object. In this tutorial you can see the example in tutorial18.cpp lines 106-108.
@BlueProgamer212 Жыл бұрын
I have assimp-5.2.5\build\bin\Debug\assimp-vc143-mtd.dll but not assimp-vc143-mtd.lib. Should I downgrade? I don't want to load the DLL files during runtime to access the ASSIMP functions because I noticed it takes a while to load. I'm building it with Visual Studio 2022 is this fine? I'll attempt putting it the same folder as my executable. I apologize if this is a stupid question. Thanks in advance for being kind enough to answer! EDIT: Found the answer that works for me, for anyone having the same issue, here's the solution: Just disable shared libraries to use .lib instead of explicitly loading .dll for the symbols Here ya go: cmake assimp-5.2.5 -G "Visual Studio 17 2022" -DBUILD_SHARED_LIBS=OFF
@OGLDEV Жыл бұрын
assimp-vc143-mtd.lib is created in assimp-5.2.5\build\lib\Debug. You can use the DLL by simply linking your app against this lib file and you don't need to explicitly load the symbols from the DLL.
@gujeg5 ай бұрын
Thx, you helped me really nice 🙂
@OGLDEV5 ай бұрын
Glad to hear that!
@kimkulling Жыл бұрын
Great tutorial, thanks for the great work!
@OGLDEV Жыл бұрын
Thank you for Assimp!
@grengren64212 жыл бұрын
Thanks for another great video.
@OGLDEV2 жыл бұрын
You're welcome :-)
@mosesmodise4998 Жыл бұрын
what happened to the shaders?
@OGLDEV Жыл бұрын
This video focuses on loading the vertices and their attributes using Assimp. Shaders were covered in tutorial #4 and from that point in the series we've been busy improving the shaders to include the relevant transformations as well as texture mapping. All this was done using some hard coded vertices and indices. So what we do in this video is replace these vertex/index arrays with vertex data loaded from model files. So basically there is no change in the shaders compared to the previous video (you can find them here:github.com/emeiri/ogldev/tree/master/tutorial18_youtube). In the next video we improve the shaders with initial material and lighting support.
@bestapps47092 жыл бұрын
how to load in Opengl es android java?
@OGLDEV2 жыл бұрын
I haven't tried anything except C++ but there are java bindings of assimp: github.com/assimp/assimp/tree/master/port/jassimp. The Android build instructions are here: github.com/assimp/assimp/blob/master/port/AndroidJNI/README.md. Hopefully you can find a working example online.
@bestapps47092 жыл бұрын
@@OGLDEV thanks for answer buddy, I use my cellphone to create apps in java and Opengl es, and I need a code or a lib to put directly in the paste lib to begins to use it. I use AIDE and Sketchware apps to programming.
@OGLDEV2 жыл бұрын
I would love to expand the channel to the Android space at some point but right now I just don't have the bandwidth. BTW, OpenGL vs OpenGL ES is not really relevant at this point. You need to be able to access Assimp and load your models from Java. Once you get this working you can use whatever API to render. ES is a native citizen in Android so I guess it should work.
@bestapps47092 жыл бұрын
@@OGLDEV Ok buddy I will try, I need really load my objects in ES. Have a nice day.
@Byynx Жыл бұрын
Thanks for your work but of all the tuturials you had to pick this one to show the SOA. It makes more confuse to understand assimp.
@OGLDEV Жыл бұрын
Sorry, that's the implementation that I currently have. But understanding Assimp is more about the data structures of the library. I'm storing the vertex attributes in different vectors that are then loaded into dedicated vertex buffers but you can pack them together in a single buffer and set the vertex layout accordingly.
@UnrealCatDev7 ай бұрын
9,11k subscribers? niceee
@OGLDEV7 ай бұрын
wow...
@MrSalireza Жыл бұрын
Awesome job ❤
@OGLDEV Жыл бұрын
Thanks!
@joseplano47893 жыл бұрын
Please do one loading animations on assimp
@OGLDEV3 жыл бұрын
I plan to do a tutorial on skeletal animations but there are a few topics (e.g. lighting) that I feel I must cover prior to that. In the meantime, you can check my skeletal animations tutorial on the website: ogldev.org/www/tutorial38/tutorial38.html.
@OGLDEV2 жыл бұрын
The skeletal animation tutorial is now available: kzbin.info/aero/PLA0dXqQjCx0TKQiXRyQU62KQgcTE6E92f
@joseplano47892 жыл бұрын
@@OGLDEV thank you very much for this
@matthewexline65899 ай бұрын
Hey guys! "ai" as in "aiscene" stands for "ass imp" not "artificial intelligence"!!! Can I get some likes over here for figuring out that bit of pointless trivia for myself or WHAT?!?!
@OGLDEV9 ай бұрын
"artificial intelligence" is a clickbait...
@shivanshuraj71753 жыл бұрын
how your build assimp was so fast..what hardware you are using...i am doing it on 1155g7 and it takes 30-40 sec
@OGLDEV3 жыл бұрын
It's just an Intel i5, but I did a fast-forward during editing to save your time ;-)
@GBSCronoo5 ай бұрын
Thank you!
@OGLDEV5 ай бұрын
You're welcome!
@VerzatileDev2 жыл бұрын
I'm not sure why it was all skimmed through with the tutorial. Isn't it important to know how to add files to your projects ? instead of pretending that everyone knows where and how to put them. ( If this is some tutorial series where you start from episode 1 to which ever this one here is, then okey I understand) " Though if you are looking from the side you really don't have an idea what to do, well I will figure it out, but I find that a bit odd from this video " though thanks anyhow.
@OGLDEV2 жыл бұрын
The target audience for this series is people who want to learn graphics programming with OpenGL and have a basic experience with C++. I'm using very basic features of C++ so you definitely don't need to be an expert but some experience in developing code and creating a project in your preferred dev environment is required. If you feel you need some ramp up here then I highly recommend watching one of the several C++ courses at kzbin.info. The courses for beginners cover everything you need to know in terms of creating a project, adding source files, building, etc. In the first few tutorials on this series I discuss some issues that are relevant to your question. At the end of "Creating a Window" (kzbin.info/www/bejne/eorYfXuIqNuNrc0) I talk about how I build stuff on Linux. If you are on Windows you may want to watch kzbin.info/www/bejne/jX63qYxnacZ9gKc where I explain how to create a Visual Studio solution for OpenGL programming. Again, this is not a full tutorial on VS so I just explain the specifics of getting stuff built and linked for OpenGL.
@werenter Жыл бұрын
Why you are using one of the worst linux distros? ArchLinux, Debian and Gentoo much better.
@OGLDEV Жыл бұрын
I'm used to it and it's been working ok for me. May try the others if I ever find the time.
@kennedywee2 жыл бұрын
"Can't load texture from './wal67ar_small.jpg' - Unable to open file" Hi, thanks for you wonderful tutorial! I cant figure out why this happened since I'm new to programming. I wonder what I did wrong?
@OGLDEV2 жыл бұрын
This file is located in the 'Content' directory. Which model did you try to load?
@kennedywee2 жыл бұрын
@@OGLDEV "spider.obj" and I tried to load the other model inside Content directory but same error with the texture.
@OGLDEV2 жыл бұрын
Are you on Windows or Linux?
@kennedywee2 жыл бұрын
@@OGLDEV windows 11😄
@OGLDEV2 жыл бұрын
It was a bug in the path handling on Windows. I pushed a fix. Thanks for the feedback!