---
title: stencilPixelFormat
framework: scenekit
role: symbol
role_heading: Instance Property
path: scenekit/scnscenerenderer/stencilpixelformat
---

# stencilPixelFormat

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

## Declaration

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

## Discussion

Discussion Use this property, along with the depthPixelFormat and colorPixelFormat properties, if you perform custom drawing with Metal (see the SCNSceneRendererDelegate and SCNNodeRendererDelegate classes) and need to create a new MTLRenderPipelineState object to change the GPU state as part of your rendering. note: This property is valid only for scene renderers whose renderingAPI value is SCNRenderingAPI.metal. You create a SceneKit view that renders using Metal with the preferredRenderingAPI initialization option or in Interface Builder, or an SCNRenderer that uses Metal with the init(device:options:) method. For OpenGL-based scene renderers, this property’s value is always nil.

## See Also

### Customizing Scene Rendering with Metal

- [currentRenderCommandEncoder](scenekit/scnscenerenderer/currentrendercommandencoder.md)
- [device](scenekit/scnscenerenderer/device.md)
- [commandQueue](scenekit/scnscenerenderer/commandqueue.md)
- [colorPixelFormat](scenekit/scnscenerenderer/colorpixelformat.md)
- [depthPixelFormat](scenekit/scnscenerenderer/depthpixelformat.md)
