3D Graphics at a High Level

There are some things that are different about 3D graphics engines, and obviously simple things in 2D become much much harder in 3D.

Modeling and Rendering

Imagine trying to draw a cat in tkinter. Ugh. It's much easier to just import a picture of a cat, righAw. This is in 2D.

Now imagine this in 3D. Think about trying to create a cat in 3D. With code.

This sounds incredibly difficult, doesn't it? Yeah, you're right.

In fact, it's so hard that Panda3D doesn't let you do it.

Objects in a graphic engine are imported. From where? As a file, from some modeling software.

Now, Panda3D is a super powerful renderer. Aka, what it does is it takes a 3D object file (often called meshes), and displays (i.e., renders) them. And it's really beautiful. Now, in Panda3D, you can move them around, rotate them, look at them, color them, etc. But you can't create them.

For that, you need modeling software. Now, there's a bunch out there. We usually recommend that you use Blender (because you can do some cool Python scripting in Blender), so we're going to go with all our gitbook using Blender. However, there's some others you can use (Maya, 3Ds Max). We can't do a detailed tutorial on Blender (that would need to be a whole new gitbook), but it can be slightly difficult to use. However, we won't penalize for downloading a mesh off the internet and then importing to Panda3D - this is ok, since it's not code. Here is the link to Blender's webpage: https://www.blender.org/


Coding in 3D

This one's a little more straightforward. Using a 3D graphics engine, there is an x, y, and z coordinate field. You gotta consider all 3.

Also, rotations have 3 directions as well: pitch, yaw, and roll.

Panda3D has a (0,0,0) point, but it's kind of arbitrary. It's just a randomly assigned point in space. Imagine just assigning a random point in space in your room to (0, 0, 0) and trying to base everything else in your room off this random point. Ugh. You'll need to experiment with things a little if you want them to move in the right direction.

There's also a camera. This camera is something you can control, and essentially, it functions as a camera in the real world. You can move it, zoom in and out, attach it to an object (so it follows the object), etc. Through the camera is how the user views the 3D graphics world.

Lastly, just a warning. Debugging by looking suddenly becomes a lot harder in 3D. Is something really far away, or is the angle of the camera just wrong? Is one object way above the other, or is it just really far away?

Be careful :)

results matching ""

    No results matching ""