3D Graphics with Scene Kit

All of the sample code for this book is available on GitHub. There is a sample project for most chapters in the book, and some chapters have more than one sample project.

The repository contains the finished projects for you to download and experiment with. This is the same code that you will find at the end of each chapter (in the book itself). Some chapters require assets (3D models and/or textures) to follow along in your own project with what is being explained in the book. In those cases the folder also contains an Assets folder for you to download.

These projects are documented to the extent of explaining what is happening in the code, but not necessary enough to explain underlying concepts. That is what the book is for. The sample projects are made to make sense if you’ve followed along with the chapter in the book.

Blue cubeChapter 1 - The First Scene

Get something to show up on the screen as quickly as possible. Introduces concepts such as lights, cameras, nodes, geometry and materials.

One glossy and one matte cubeChapter 2 - Lights & Materials

Get more familiar with lights and materials and how their configurations work together to create different visual effects.

Bar chartChapter 3 - More of a Scene

Leverage the node hierarchy to create a scene with more things in it. Introduces shadows, reflection, and animation using Core Animation.

Pie chartChapter 3 - Pie Chart

Create extruded 3D objects from Bézier paths and use them to build a pie chart.

Textured space shipChapter 4 - Adding Detail with Images

Render a COLLADA (.dae) file. Use images and Core Animation layers as textures to add more detail to a 3D object. Learn to export a scene and its textures.

Chess pieces on a boardChapter 5 - Chess

Import geometry objects from a COLLADA (.dae) file. Copy and modify the imported objects to put different chess pieces on a board. Hit-test the scene to determine which chess piece was clicked.

The earthChapter 5 - Earth

Perform advanced hit-testing on a 3D object representing the earth to position a pin on the clicked location, make the pin perpendicular to the surface of the earth, and approximate the geographical location of the clicked point.

Blue cube made of white trianglesChapter 7 - Custom Cube

Create a custom geometry object (a cube) made out of triangles. Introduces geometry sources and geometry elements, and shows what it means to create a geometry element with multiple elements.

A custom mesh that looks like a waveChapter 7 - Custom Mesh Geometry

Use a triangle strip to create a more advanced geometry object out of dynamic data.

A cell shaded torus that has been rotated around the x-axisChapter 12 - Custom Shaders

Recreate the default Scene Kit shading with custom shaders in GLSL (the OpenGL Shading Language) and create more custom rendering effects that wouldn’t be possible by just configuring lights and materials.