# Physical Based Rendering fails with renderer.SetEnvironmentCubeMap not found

**URL:** https://discourse.vtk.org/t/physical-based-rendering-fails-with-renderer-setenvironmentcubemap-not-found/3318
**Category:** Support
**Created:** [May 15, 2020, 8:45pm UTC](https://discourse.vtk.org/t/physical-based-rendering-fails-with-renderer-setenvironmentcubemap-not-found/3318 "2020-05-15T20:45:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [May 15, 2020, 8:45pm UTC](https://discourse.vtk.org/t/physical-based-rendering-fails-with-renderer-setenvironmentcubemap-not-found/3318/1 "2020-05-15T20:45:00Z")

</div>

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

---

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [May 15, 2020, 9:07pm UTC](https://discourse.vtk.org/t/physical-based-rendering-fails-with-renderer-setenvironmentcubemap-not-found/3318/2 "2020-05-15T21:07:03Z")

</div>

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

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

Doug

---

<div class="post-metadata">

### Author: ![Michael](https://discourse.vtk.org/user_avatar/discourse.vtk.org/michael/32/16_2.png) [@Michael](https://discourse.vtk.org/u/Michael)
#### Post date: [May 16, 2020, 2:34pm UTC](https://discourse.vtk.org/t/physical-based-rendering-fails-with-renderer-setenvironmentcubemap-not-found/3318/3 "2020-05-16T14:34:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [May 17, 2020, 1:26am UTC](https://discourse.vtk.org/t/physical-based-rendering-fails-with-renderer-setenvironmentcubemap-not-found/3318/4 "2020-05-17T01:26:13Z")

</div>

@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:

```python
    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.

---

<div class="post-metadata">

### Author: ![scotsman60](https://discourse.vtk.org/user_avatar/discourse.vtk.org/scotsman60/32/6000_2.png) [@scotsman60](https://discourse.vtk.org/u/scotsman60)
#### Post date: [June 4, 2020, 11:35pm UTC](https://discourse.vtk.org/t/physical-based-rendering-fails-with-renderer-setenvironmentcubemap-not-found/3318/5 "2020-06-04T23:35:24Z")

</div>

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…
