Graphics Reference
In-Depth Information
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 re-
flects 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 at the central sphere in the preceding, you can see that it not only
reflects the environment, but also reflects the cylinder, and if you rotate the scene,
you can also see the cube reflection.
How to do it...
To accomplish this, we first need to perform a couple of the same steps, like we did
in the
Using a cubemap to create reflective materials
recipe. So, before you start with
the steps in this recipe, take the first three steps from that recipe. After these three
steps, you can continue with these steps: