I have a spherical HDR image that is being used for environment lighting in a SceneKit scene. I want to rotate the environment image.
To set the environment lighting, I use the lightingEnvironment SCNMaterialProperty
. This works fine, and my scene is lit using the IBL.
As with all SCNMaterialProperty
, I expect that I can use the contentsTransform property to rotate or transform the HDR. So I set it as follows:
lightingEnvironment.contentsTransform = SCNMatrix4MakeRotation((45.0).degreesAsRadians, 0.0, 1.0, 0.0)
My expectation is that the lighting environment would rotate 45 degrees in Y, but it doesn't change at all. Even if I throw in a completely random transform on all axis, there is no apparent change.
To test if there is a change, I added a chrome ball and a diffuse ball to my scene and I'm comparing reflections on the chrome ball, and lighting on the diffuse ball. There is no change on either.
It doesn't matter where I set the contentsTransform
, it doesn't work. I had intended to set it from the renderer(_:updateAtTime:) method on the SCNRendererDelegate
, so that I can rotate the IBL to match the point of view of the scene, but even if I transform the environment immediately after it is set, there is never a change.
Is this a bug? Or am I doing something entirely wrong? Has anyone on here ever managed to get this to work?