A starry sky dome

What if the Universe was just a giant ball and we're inside it? That's what we're going to imagine to implement a starry sky spherical background.

In computer graphics, you can create backgrounds to make the scene look bigger than it really is. You can use a spherical texture, or skydome, as we will use here. (A common alternative in many game engines is a cuboid skybox, constructed from six internal faces of a cube.)

Among the set of textures that we provided with this book is milky_way_tex.png. Drag a copy of this file into your res/drawable/ directory, if it's not there already.

Now, we can add the starry sky dome to our scene. Add the following code to MainActivity.setup():

 //Stars in the sky Transform stars = new Transform() ...

Get Cardboard VR Projects for Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.