Chapter 13. Basic 3D Programming

3D programming is an extremely complex topic, which cannot be explained completely in a single chapter. However, here I will provide very basic knowledge about the LibGDX 3D API. In this chapter, you will learn how to generate basic models (such as sphere, box, and cylinder) as well as loading models exported from 3D modeling software (such as Blender). Furthermore, we will see how to improve performance using frustum culling.

Selecting items in a 3D world is quite different, yet simpler, than in a 2D game. We will see how a user can interact with objects inside a 3D world using ray picking.

In this chapter, you will learn about the following topics:

  • Create a basic model using the LibGDX 3D API
  • Load a 3D model exported from Blender
  • 3D frustum culling
  • Ray picking

Light sources

Light clusters from the sun fall on an object, which reflect and reach our eye. This is how we see things. OpenGL ES allows us to create four types of light sources:

  • Ambient light: This is not exactly a light source, but light reflected from other objects, thereby limiting the light intensity when compared with directional lights.
  • Directional light: This comes from a faraway source. Light from sun is a perfect example of directional light.
  • Point light: This is the light from a point source such as a bulb.
  • Spotlight: This is similar to point light; however, it has a direction in which it shines. A flashlight/torch is a perfect example of a spotlight.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.15.80.101