Using a dynamic cubemap to create reflective materials

In the Using a cubemap to create reflective materials recipe, we showed how you can create a material that reflects its environment. The only caveat was that other meshes rendered in the scene didn't show up in the reflection; only the cubemap was shown. In this recipe, we will show you how you can create a dynamic cubemap that also reflects other meshes in the scene.

Getting ready

To get ready for this recipe, you need to follow the steps explained in the Getting ready section for the Using a cubemap to create reflective materials recipe. For this recipe, we provide a separate example that you can display by opening 04.11-use-reflections-dynamically.html in your browser.

If you look closely ...

Get Three.js Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.