Turn environment map to z-up

I’m adding environment maps for the first time. I work in a z-up world. When I simply naively add an equirectangular map as environment map (and skybox), it’s clear that the world in the skybox and in observed in the reflection is a y-up representation. In the image below, the world y-axis goes off to the right.

Now, I can set the floor equation of the skybox to lie on the Wz = 0 plane. And, in the rendering, the skybox is now rendering z-up as I would expect. However, the reflections still reflect a y-up world. (See image below):

I’ve tried setting a transform on the texture passed as the environment map, but that seems to have no effect. Am I missing something? How do I inform the vtkOpenGlRenderer that the spherical coordinates should have the poles on the z-axis instead of the y?

    // skybox orientation
    double front[3];
    vtkMath::Cross(this->RightVector, this->UpVector, front);
    this->SkyboxActor->SetFloorPlane(this->UpVector[0], this->UpVector[1], this->UpVector[2], 0.0);
    this->SkyboxActor->SetFloorRight(front[0], front[1], front[2]);

    // environment orientation
    this->SetEnvironmentUp(this->UpVector);
    this->SetEnvironmentRight(this->RightVector);

From: https://github.com/f3d-app/f3d/blob/master/library/VTKExtensions/Rendering/vtkF3DRenderer.cxx

As @mwestphal suggested, you should use the vtkRenderer::SetEnvironmentUp and vtkRenderer::SetEnvironmentRight to re-orient the map.

1 Like

I feel foolish. The documentation for SetEnvironementUp() is right below the documentation for SetEnvironmentTexture(). Thank you for such a swift and helpful response.

For the sake of completeness:

  1. vtkRenderer already sets the environment right to be [1, 0, 0].
  2. Therefore, it was enough to set the environment up to be [0, 0, 1] to get the desired result.