Exporting GLTF Models from Blender to Panda3D | Kamil Pakula | Skillshare
Drawer
Search

Playback Speed


  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Exporting GLTF Models from Blender to Panda3D

teacher avatar Kamil Pakula, Python developer, linguist

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Introduction

      3:25

    • 2.

      Move Origin Point

      3:36

    • 3.

      Apply Scale

      1:22

    • 4.

      Format Settings

      3:33

    • 5.

      Other Export Settings

      1:12

    • 6.

      Export the Model

      1:44

    • 7.

      The Project Folder and File

      2:12

    • 8.

      The panda3d-gltf and panda3d-simplepbr Utilities

      2:40

    • 9.

      Load the Model in Panda3D

      1:21

    • 10.

      Conclusion

      0:41

  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

10

Students

--

Projects

About This Class

About This Class

In this class we’ll learn how to export models that you create in Blender to the GLTF format. Although Panda3D’s native file format for models is EGG, you can also use other formats. The GLTF format seems particularly convenient if you want to export your models from Blender to Panda3D or other game engines. It’s supported by Blender out of the box and you don’t need any add-ons, as is the case with the EGG format.

What Are You Going To Learn? 

This is a class for intermediate students. You’re going to learn how to export your model from Blender for use in other software. In particular, you’re going to learn the following:

  • how to get your model ready to be exported by moving the origin point and applying scale,
  • how to choose the right format settings and other export settings,
  • how to actually export the model from Blender,
  • how to install and use the panda3d-gltf and panda3d-simplepbr utilities,
  • how to load the model in Panda3D.

The lessons are short and clear, very easy to follow. You will learn how to use Blender to prepare your models to be used in Panda3D. I hope you will like the way the content is presented.

Who Is the Class for?

As I just mentioned, the class is for intermediate students, so you should have some basic knowledge of Blender, but this will do. The content is presented in such a way that you should have no difficulty following it even if you’re familiar with just the basics. In particular, you should know how to use the basic tools to navigate in the Blender 3D viewport and also, which you will need for your class project, how to texture your model.

What You Will Need to Take This Class

To take this class you need the model that you want to export. You can use your own model or the model of a UFO that I provide for you in the Project folder attached to the class project. The model should be textured.

If you want to learn how to model the UFO yourself, I have a class on that. It’s called A UFO Model in Blender and it will teach you the basics of modeling in Blender. If you want to learn how to bake a texture from your materials in Blender, I have a class on that too. This one is called Baking Textures from Materials in Blender.

Meet Your Teacher

Teacher Profile Image

Kamil Pakula

Python developer, linguist

Teacher

I studied linguistics and computer science. I have an MA degree in linguistics and I'm also an IT engineer. Since 1999 I've been working as a teacher. I teach languages and programming. For the last couple years I've been working as a Python developer as well. I teach 6-year-olds, high school and university students and adults. I deliver live and online courses. I love this job.

See full profile

Level: Intermediate

Class Ratings

Expectations Met?
    Exceeded!
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

Transcripts

1. Introduction: Hey guys, panda 3ds native file format for models is egg, but you can also use other formats. The GTF format seems particularly convenient if you want to export your models from blender to panda 3D. It's supported by blender out-of-the-box. And you don't need any atoms, as is the case with the act format. So how do you do that? How do you export a model in the GTF format? I'm gonna guide you through this process in this class. The model will be exporting depend on 3D is a simple UFO model. But you can use any model you like. The UFO model is textured. We can now export the model along with the texture. By the way, I also have a class on how to make this model and another class on how to bake textures for materials that you can then export to some other software out of Blender. But now let's start by opening the UFO model in Blender. I'm using the 3 version of Blender. Here you can see it in material, pretty shading, layout workspace. It's pixelated because it's a texture bitmap. Now before we export the model, Let's check whether it's ready to export. Although our model will move from place to place in the game window, it's not going to be animated itself, so its shape will not change. This is why we can treat it as a static model. Now, there is a difference between static and animated models in panda 3D. The former are referred to as models, the letter as animated models or actors. Anyway, we must take care of two things before the object is ready to export. First of all, we must decide where the origin point of the model is going to be. Secondly, we must apply the scale. But before we start, Here's some inner for free, you. 2. Move Origin Point : Let's start with the origin point. This is the point that will be positioned in the scene at the location specified in panda 3D. So if our model was a building, for example, and its origin point was in the ascender. The building would be halfway in the ground. It will position the model at ground level. So if we set the z coordinate to 0, this is why for billing, it will be more appropriate to move the origin point at the bottom so that the model is bottom is at ground level. But what about RAM? Model is gonna be high in the air most of the time. But if it was to land on the ground, it will be also easier to have the origin point at the bottom. Let's move the origin point to the button then, how do we know where the origin point is in the first place? Let's go to front view. So head one on your numpad. Zoom in a bit. Now you can see a yellow or orange dot in the center over here inside the 3D cursor, this point over here. This is the origin point. It's in the center, not at the bottom. There are a couple of ways you can move the origin point to a new location. You can do it in object mode or in edit mode. The former was not available in other versions of Blender. Anyway, let's do it in edit mode. Go to edit mode by hitting tab. Let's make sure everything is selected. So let's de-select and hit a to select all. Now hit G, Z. Move up, holding down Control to snap. Move the geometry up onto the origin point is at the bottom. Control and drag. Good. Now the origin point a is at the bottom. Over here. Let's switch back to object mode. Now we can see the origin point at the bottom. Now alternatively, you could have moved the origin point in object mode. Now this functionality is only available in version 2.8 or later or blender. How do we do that? Let's use our model to demonstrate it. The first thing we have to do is hit M to open the sidebar and then go to Tool. Then under transform, we have to check the origins box. If you now hit G and drag your mouse cursor, you will see the origin point change its location. Instead of the mesh moving just the origin point. But this is just for demonstration, so we don't need this change to be permanent. So let's hit escape. Uncheck this box, and hit N to close the sidebar, because we already did before in edit mode. 3. Apply Scale: A very important thing that we always have to keep in mind before exporting a model is to apply scale. Otherwise, we may have some problems with our models outside blender. As we're modelling the UFO out of the unit sphere, we're scaling it a couple of times. In order to check the scale, hit M. To open the sidebar, go to item. Here. Under scale, you can see that the scale is five on x, y, and 0.5 or z. It should be one on each axis. Go to the Object menu. And under Apply select scale. As you can see now, this case one or all three axis. As it should be. Now with the origin point reset to a new location and the scale applied. Our model seems ready to be exported to the GTF format. But even if something turns out to be wrong with the model when export it, you can always correct it in Blender and export again. 4. Format Settings: Let's export the model to the GTF format. Go to the File menu. And under Export, select the GTF format, which is here. Dialog window opens with a few options for you to choose from. Let's have a look at the settings one-by-one. Let's start with the format. There are three options available. Gtf binary, GATS separate, and GOT F embedded. The first one is GTF binary. It's a very concise format where all the information about meshes, textures, and so on is packed into a single binary file. We could use this option. The downside of this format is that it's not human readable. Then we have the GIT F embedded option. What do we get using this option is adjacent text-based file, the blender documentation, you will find the following warning. This is the least efficient of the available forums and should only be used when a required. We could use this option to share the model over a plain text only connection, which is not the case. We're not going to choose this option either. Then there's a third option, GL TF separate. Here's a description from the blender documentation. This produces adjacent text-based gtf file describing the overall structure along with a bin file containing mash and vector data. And optionally a number of PNG or JPEG files containing image textures reference by the gtf file. We can also see a tip. Having an assortment of separate files makes it much easier for a user to go back and edit any JSON or images after the export has completed. Rehab to remember though, is be aware that sharing this format requires sharing all of these separate files together as a group. As documentation of Blender puts it. Anyway, the binary format seems pretty simple to handle as there is just one file with all the information packed in it. However, we're gonna use the GTF separate option in this class so that we can see how our models are represented in it. Selected in the drop-down menu. Then you will see another field, textures, where you can type the name of the folder in which the texture images, or like in our case, just the one image that we baked should be put. The folder will be in the same location as the GeoTIFF file. Let's name the folder tax. You can also fill in copyright information, but I'm gonna skip it. Let's also check the remember export settings checkbox so that the same settings will be used when we opened the blend file again. Remember export settings. 5. Other Export Settings: Then we have the include section. Click on the arrow to expand it. Here we're only going to check limit to selected objects. This is to ensure that only the selected objects will be exported. In our case, the UFO model. We don't want to export other objects like the camera or the light. Next, in the transformed section, Let's leave the plus Y up checked. This is the GTF convention of exporting models. In the geometry section, you don't need to change anything either. We don't have any other applied modifiers. There is nothing to apply. We want to export the UE base and normals. Leave these options on nationally. We also want to export materials. Now let's collapse. To see the other staff. The last section is animation hour yet oh, model is not animated, so we're not going to tweak the settings here either. 6. Export the Model: Now with all the settings in place, you can press the export GLD F button. This will export our model to the GTF format. Now open your project folder. You should see 2D files there. The UFO gtf file, the binary you have been file, as well as the tax folder with the texture. Now, you can also have a look at a gtf file. Let's open it in Notepad. Open with Notepad. Here, you can see it's human-readable. What's more? You can edit it and influenza model this way even now after the model has been exported from Blender, not going today though. Even though scroll up and down the notepad window, you will see that the model information is pretty clear. Meshes, textures, images, and so on. We're going to go into open the binary file because it's binary. So not the most readable format file. But don't take my word for it. Go ahead and open it in Notepad to see how it differs from the text file. The model is not exported and we can use it in panda 3D. 7. The Project Folder and File: We have our model exploited to GATS and it's time to load it in panda 3D. Now, make sure the GIT F and bin files and detects folder are in the project folder. To keep things simple and using a very simple setup here with everything put directly in the project folder, I also created a simple text file for our pattern code. Now, Let's open this in a text editor like for example, Visual Studio Code. This is a very simple file. And let's have a look at this. Here. We have the imports, some configuration like the size of the window. And here loading our model just as if we were loading an Ag model without an extension, you have, you know, that egg miles can be loaded without the extension. So we know that our model is not an act file, it's a gtf file. So is it going to work? Let's run our application. As you can see, there's a problem. You have an error. Could not load model file UFO. The problem here is that we didn't specify the file extension. We don't have to do it with X-Files, but we do have to do it with other file formats, including Giardia. Let's quickly fix this. In order to do that, let's just type G, L, T, F. Good. Now let's run it again. Now we can see the model. The good news is, our program works. The bag, nice A's, the model is completely black. Let's fix it next. 8. The panda3d-gltf and panda3d-simplepbr Utilities: Now panda 3D doesn't handle gtf files out of the box. We have to install the panda 3D gtf utility. You will find it on the following page. Now you can use pip to install the panda 3D gtf package. Let's open the terminal and run the following command. Pip install panel 3D GL, TF. Well, I'm not going to do that because I have already installed this utility on my computer. But if you haven't, make sure to do it. Now independence with the GLD after utility shapes with a GeoTIFF viewer, which you can use to view or models from the terminal. So let's try it out in the terminal. Let's navigate to our project folder. So let me do that quickly. Now. We can type in the following command, G on TI viewer, and the name of our file Hit Enter. You will now see your model in a new window. You can use the left mouse button to pan. The middle mouse button to orbit. The right mouse button to zoom in and out. Well, the model seems to be working fine, but before we load it in 3D, we need another utility. Let's insight to. The other utility is panda 3D simple PBR. You will find it here. This utility is necessary to output the textures correctly. You can install it using pip as well. Just run the following command in your terminal. Pip install penta 3D simple PBR. Well, I'm not going to do it either because I have already died. But you should. 9. Load the Model in Panda3D: Now with the two utilities installed, let's load our model in panda 3D. Now in order to see the textures, we must import simple PBR. We need to import simple PR is important. And then inside the init method of the AP class, which is the class that inherits from show base test app. In our case, it's innate method. Here. Now, watch this name. There are no underscores in it. This should do. Let's run the app. Here it is. Our fully textured model in panda 3D. You can use our mouse to navigate, pan, rotate, it doesn't degree. Good in panda 3D. Zoom out, zoom, and so on. Our model is now ready to use in 3D. I hope you will now have no problem using GTF models in your panel 3D applications. 10. Conclusion: You now know how to expert model is created in Banner to gtf format and how to input them in a game engine like panda 3D. Naturally, there are multiple other formats you can export your model to from Blender. It all depends on what kind of software you want to use it. And also, you can export two formats that are not available in Blender out of the box. For example, you can export your model to act format, which is panda through these native file format. But then you need to install an atom. But this is a topic of its own.