How to show background when alpha is zero in scenekit

Hello, everyone, I work as AR Graphic Programmer.

I have a some question about alpha blended in scenekit with arframe.

I expected when shader defines the pixel's alpha to zero, and then they rendered background color like this.

Yeah it's not problem in case background of scnview scene is nothing.

But in case I changed scnview.scene.backgound.contents to ar frame, it looks black like this.

I can using discard in fragment shader but heard using discard in fragment shader makes performance issue. (And I implement shader using scnprogram...)

changing alpha blend option or transparency option can solve this?

I hope solve it.

Answered by wonkieun in 722121022

I find a way myself.

this method works well! (https://gist.github.com/delasign/2b797c6afd819c7cc04ee42158ec5787)

Accepted Answer

I find a way myself.

this method works well! (https://gist.github.com/delasign/2b797c6afd819c7cc04ee42158ec5787)

How to show background when alpha is zero in scenekit
 
 
Q