Rotating Environment

I’ve seen a few questions asking this, and it appears to be on the roadmap for three but is a way off. It seems like a very popular thing to want to do, and some people have managed it like this…

Can anyone shed any light on how they are doing it?

I did read somewhere (though now can’t find the source) a sphere was used as part of the pmremGenerator, but I can’t find any examples/documentation about how that would work?

Any guidance would be appreciated.

EDIT found the example on Github so I will go through that as it appears well structured. Feel free to delete this post, i cant seem to do it

If you zoom out enough, you will see the structure:

you basically render the cubemap onto a sphere, into the environment map, and now you can rotate the sphere.

in vanilla you would use a cubecam, render that sphere with backfaces, the cube texture goes into scene.background and scene.environment.

1 Like

Thanks! I wont be using react, so I’ll be looking at doing it in vanilla, and I’ve never used cubecam before but I’ll see if I can figure it out (if anyone has it mocked up in a straightforward code pen or similar that would be appreciated)

Are there any downsides to this approach I should be aware of? Performance etc, im wondering why this approach wasn’t more visible upon searching (e.g. why is not shown in any of the examples) when it seems like quite a common thing to want to do??

you only need to render it once, or whenever the user is roating. there’s no performance impact otherwise.

1 Like