Generate environment mapping

Hello there!

I would like to create a 3D scene with a reflective object that reflects the environment, the environment being other 3D objects in the scene (for example a reflective spoon in the middle of a 3D kitchen).

In order to achieve this I would like to generate an envmap given the other 3D objects in a scene (the 3D kitchen) and use this envmap for the reflection.

How should I proceed? I saw in this example that there is an envMap property to some materials, where does this come from? It does not seem to be documented. Are there some helper functions that would help me create the TextureCube representing the envMap (given the spoon bounding box) or should I create 6 cameras myself and create a rendering target that would render the envmap?

Edit: Let’s say I want to replicate this scene using ThreeJS:

I just found the solution in the ThreeJS documentation.

I need to use a CubeCamera.This will help me generate the TextureCube by rendering the entire scene using this camera before rendering the spoon.