I want to make glass effect in SceneKit. I searched in google but there's no perfect answer. So I'm finding SceneKit warrior who can solve my problem clearly. There's an image that I'm going to make.
It should be looks like real. The glass effect, reflection and shadow are main point here. I have obj and dae file already.
So, Is there anyone to help me?
Create a SCNMaterial
and configure the following properties and assign it to the bottle geometry of a 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 won’t 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.
Depending on what else is in your scene, the background, and the lighting used, you will probably have to tune the values above to get the desired results. If you want a bottle without the label, use the .transparency property (set its contents to a gray color) instead of the .transparent property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With