How to add transparency with a shader in SceneKit?

后端 未结 3 1358
不思量自难忘°
不思量自难忘° 2021-01-13 16:31

I would like to have a transparency effect from an image, for now I just test with a torus, but the shader does not seem to work with alpha. From what I understood from this

3条回答
  •  庸人自扰
    2021-01-13 17:10

    SceneKit uses premultiplied alpha (r, g and b fields should be multiplied by the desired a) :

    vec4(0.0, 0.2, 0.0, 0.2); // `vec4(0.0, 1.0, 0.0, 1.0) * alpha` with alpha = 0.2
    

提交回复
热议问题