6

I am implementing a "glow" effect in RealityKit. I followed this open source library which is in SceneKit: https://github.com/laanlabs/SCNTechniqueGlow. The basic idea is to create a "mask" texture that includes all the nodes that we want to "glow", then do a gaussian blur (in both horizontal and vertical direction) of the mask, then combine the blurred mask and the original texture to create the effect.

I was able to replicate the same result in RealityKit using post-process. However, I am not sure how to apply the "glow" to only selected entities (For example, only those entities with a GlowComponent). In SceneKit, this can be easily done by includeCategoryMask, as documented here: https://developer.apple.com/documentation/scenekit/scntechnique:

A bitfield used for including nodes in the drawing pass if the draw key specifies DRAW_SCENE or DRAW_NODE. Defaults to all bits set. See Category Masks.

There doesn't seem to be similar API in RealityKit.

I have uploaded a sample project here: https://drive.google.com/file/d/1-CakPFTvc4ckbIWrirGxx8EQI94Q_051/view?usp=sharing

When you run it, you can see 2 views (screenshot): the top view is a SCNView that uses the SCNTechnique; the bottom view is a ARView that uses postprocess to achieve the same effect:

  • For SceneKit (top), the left box has the category bit mask specified in includeCategoryMask, so only left box has the contour.

  • For RealityKit (bottom), I'd like to only apply the contour to the left box which has a GlowComponent, and leave the right box out (Right now it's applied to all entities)

enter image description here

asked Oct 27, 2025 at 4:29
3
  • Note that I don't want to add a "outline" entity that's slightly larger than the original entity to mimic the effect, because i want the outline to always be on top of all entities, and that it should be the same thickness, regardless of how far they are from the camera. So post-process is likely the only solution in RealityKit that's comparable to SCNTechnique. Commented Oct 27, 2025 at 4:34
  • Unlike SceneKit with its fine-grained controls, in RealityKit (26.1), post-processing methods still apply filters, be it CI or MPS, to the entire rendered scene. To apply a blur to specific rendered model entity (in order to get a desired glow effect) you need an alpha and/or depth targets for masking. Creating an accurate mask requires from you a well-designed algorithm in the Metal kernel. I think category masks are useless in this case. Commented Oct 29, 2025 at 14:44
  • Of course, there's always a second approach, although it's even more processor-intensive and it's outside the scope of standard post-processing API. To achieve a blur effect on a single model entity, you'd need to render that specific entity into a separate texture and then combine it with the main scene's render output (a.k.a. premultiplied rgb*a image compositing). Commented Oct 29, 2025 at 15:01

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.