swifttexturesscenekitaugmented-realityarkit

How do I invert the normal of a sphere in SceneKit?


I have a sphere with a texture on the outer side. I want the texture to be on the inside of the sphere. The outside should be transparant, so texturing both sides won't work.

I want to use the sphere for an AR portal to display 360 content.


Solution

  • Set the cullMode property of the SCNMaterial to front instead of the default back. The doubleSided property has to be NO/false. Both sides are textured by default, setting the cull mode to front will cause it to render only back facing faces, as if the normals are flipped, and will give you the desired results.