Glass effect in SceneKit material

I want to make a glass effect in SceneKit. I searched on google but there is no perfect answer. So I find a SceneKit warrior who can solve my problem clearly. There will be an image that I am going to make.

Final

It should look like real. Glass effect, reflection and shadow here. I already have an obj and dae file.

So, is there anyone who could help me?

+4
source share
1 answer

Create the SCNMaterialfollowing properties and assign it to the geometry of the bottle SCNNode:

.lightingModel = .blinn
.transparent.content = // an image/texture whose alpha channel defines
                       // the area of partial transparency (the glass)
                       // and the opaque part (the label).
.transparencyMode = .dualLayer
.fresnelExponent = 1.5
.isDoubleSide = true
.specular.contents = UIColor(white: 0.6, alpha: 1.0)
.diffuse.contents =    // texture image including the label (rest can be gray)
.shininess =           // somewhere between 25 and 100
.reflective.contents = // glass wont look good unless it has something
                       // to reflect, so also configure this as well.
                       // To at least a gray color with value 0.7 
                       // but preferably an image.

, , , , , , . , .transparency ( ) .transparent.

+8

Source: https://habr.com/ru/post/1687402/


All Articles