Physical Based Rendering fails with renderer.SetEnvironmentCubeMap not found

Hello!!!

I’m using VTK 9.0 with Python 3.8 on a windows 64 bit machine.

I downloaded the PBR example from the VTKExamples site and the sample cubemaps, textures etc.

But the example program exits with the message

renderer.SetEnvironmentCubeMap(cubemap)
AttributeError: ‘vtkmodules.vtkRenderingOpenGL2.vtkOpenGLRenderer’ object has no attribute ‘SetEnvironmentCubeMap’

renderer is a vtkRenderer and I see from the nightly docs that this class does not in in fact have a SetEnvironmentCubeMap method,

If anyone help me get this example running, I’ll be vey grateful.

Doug

OK - Looks like vtkRendere.SetEnvironmentCubeMap() is now SetEnvironmentTexture().

I made this replacement and the demo now works perfectly!!!

Doug

Indeed the API changed before 9.0 release.
Please note that the examples are outdated and there are plans to update them in the future.

The name of the API changed because this is not required to set a cubemap but you can set alternatively a 2D equirectangular texture directly as well.

@scotsman60 Yes, unfortunately the site has not been updated in a while since the passing of Bill Lorenson.

In the meantime, I have been catching these changes and updating the master. So there is now a disconnect between the web pages and the master.

In the master the changes are:

    renderer.UseImageBasedLightingOn()
    if vtk.VTK_VERSION_NUMBER >= 90000000000:
        renderer.SetEnvironmentTexture(cubemap)
    else:
        renderer.SetEnvironmentCubeMap(cubemap)
    renderer.SetBackground(colors.GetColor3d("BkgColor"))
    renderer.AddActor(actor)

I have been maintaining the master so the VTK 9.0 changes are present for Python and C++. So at this stage, if there is a problem with an example, it is best to check out the master.

I have other examples (Python/C++) to go in.

Thanks Andrew. I had no idea that Bill Lorensen had passed.
He responded to several of my questions over the years and even though I never met him in person I did feel somehow that I knew him…