In the Xcode SceneKit Scene Inspector, there is a Procedural Sky
option under the Environment
section.
According to some tutorials, enabling this option will impart more realism to 3D models.
1) If you're creating a scene from code and not from the Scene Inspector, how do you enable the Procedural Sky
option? There is no Environment
property.
2) Does the Procedural Sky
option only work if you using PBR materials?
Yes, you can: The class you are looking for is MDLSkyCubeTexture
The most basic way to use it to put it into your scene's background contents:
class MyGameScene: SCNScene {
override init() {
super.init()
self.background.contents = MDLSkyCubeTexture(name: "sky",
channelEncoding: .float16,
textureDimensions: vector_int2(128, 128),
turbidity: 0,
sunElevation: 1.5,
upperAtmosphereScattering: 0.5,
groundAlbedo: 0.5)
// To let the sky influence the lighting:
self.lightingEnvironment.contents = self.background.contents
}
}
You'll have to read up on the parameters yourself since I just stumbled over this.
I found these links of interest:
These sources are 5 years old, so I'm sure some stuff has changed meanwhile.
Regarding the second part of your question: You can pipe this into your materials, but I'm not too knowledgeable yet.
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