Home > Net >  SceneKit – Loading lightingEnvironment and BG from HDR has no effect
SceneKit – Loading lightingEnvironment and BG from HDR has no effect

Time:04-14

I tried loading an .hdr file to use it as a skybox and use its lighting informations. This is the code I used:

backgroundColor = UIColor.gray 
// check if a default skybox is added

let environment = UIImage(named: "studio_small_09_2k.hdr")
scene?.lightingEnvironment.contents = environment
scene?.lightingEnvironment.intensity = 1.0
scene?.background.contents = environment

Unfortunately I recieve a grey screen and also no errors. Has anyone experience in using hdr files in SceneKit?

XCode Version: 13.2.1 iOS version: 15.3.1 hdr file: enter image description here

And let's set it for BG:

sceneView.scene?.background.contents = UIImage(named: "std.hdr")

enter image description here

  • Related