Search code examples
iosscenekitmetalscnmaterial

SceneKit, how to support opacity (or transparency) map properly for geometry on the back?


As the image below, it's a cube with opacity map. We can see the front 3 faces rendered correctly with transparency. But the back 3 faces totally disappeared. Logically, we shall see something from the back faces.

So, what is the correct steps to support transparency and fix this problem?

enter image description here


Solution

  • hmmm... doubleSided? By default, scenekit doesn't render front and back. Since the back panels on the cube are facing away from you, they aren't being rendered.

    Should be something like:

    plane.firstMaterial?.isDoubleSided = true