<!--
{
  "availability" : [
    "iOS: 8.0.0 - 26.0.0",
    "iPadOS: 8.0.0 - 26.0.0",
    "macCatalyst: 13.1.0 - 26.0.0",
    "macOS: 10.8.0 - 26.0.0",
    "tvOS: 9.0.0 - 26.0.0",
    "visionOS: 1.0.0 - 26.0.0",
    "watchOS: 3.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SceneKit",
  "identifier" : "/documentation/SceneKit/SCNSceneRenderer/stencilPixelFormat",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SceneKit"
    ],
    "preciseIdentifier" : "c:objc(pl)SCNSceneRenderer(py)stencilPixelFormat"
  },
  "title" : "stencilPixelFormat"
}
-->

# stencilPixelFormat

The Metal pixel format for the renderer’s stencil buffer.

```
var stencilPixelFormat: MTLPixelFormat { get }
```

## Discussion

Use this property, along with the [`depthPixelFormat`](/documentation/SceneKit/SCNSceneRenderer/depthPixelFormat) and [`colorPixelFormat`](/documentation/SceneKit/SCNSceneRenderer/colorPixelFormat) properties, if you perform custom drawing with Metal (see the [`SCNSceneRendererDelegate`](/documentation/SceneKit/SCNSceneRendererDelegate) and [`SCNNodeRendererDelegate`](/documentation/SceneKit/SCNNodeRendererDelegate) classes) and need to create a new <doc://com.apple.documentation/documentation/Metal/MTLRenderPipelineState> object to change the GPU state as part of your rendering.

> Note:
> This property is valid only for scene renderers whose ``doc://com.apple.scenekit/documentation/SceneKit/SCNSceneRenderer/renderingAPI`` value is ``doc://com.apple.scenekit/documentation/SceneKit/SCNRenderingAPI/metal``. You create a SceneKit view that renders using Metal with the ``doc://com.apple.scenekit/documentation/SceneKit/SCNView/Option/preferredRenderingAPI`` initialization option or in Interface Builder, or an ``doc://com.apple.scenekit/documentation/SceneKit/SCNRenderer`` that uses Metal with the ``doc://com.apple.scenekit/documentation/SceneKit/SCNRenderer/init(device:options:)`` method. For OpenGL-based scene renderers, this property’s value is always `nil`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)