Replies: 1 comment
-
Solved by using EXRLoader --- this is seemingly advantageous to useEnvironment with disrupts the main thread
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to load 4 .exr maps which can then be toggled through using a piece of state.
The problem is that the useEnvironment hook takes multiple seconds and so I just get a white screen for ages. I'd like to be able to use a 'loadingMap' state to be able to return a loading component while the maps load, but putting the useEnvironment inside a useEffect causes it to crash - I think because hooks have to be at the top level of the component. If I put the path to the .exr file as the files property of Environment directly, then the application freezes while it is being loaded and any spinner/loading state looks rubbish, I think because the loading of the maps occupies the main thread?
How can I load these maps elegently and in the background, and without disrupting my spinner animation?
and then the Environment component renders the relevant map:
Beta Was this translation helpful? Give feedback.
All reactions