You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ensure environment map adheres to lazy loading semantics #490
As of #487 , we will have introduced progress bars, the notion of loading progress and the notion of new reveal semantics. However, we still need to ensure that environment maps are not aggressively loaded if the user has appropriately configured <model-viewer> to indicate that they would rather defer loading the environment map until the last possible moment.
This is something we just bumped into this morning. For our shops that initially have model-viewer elements hidden, the environment map still gets generated and eats up 200-300ms of time even if not viewer is visible.
IMO environment map generation should happen on viewer loading. Can we get this in before 1.0?
How detailed is the environment map that is being generated? If it doesn't contain high frequency details (think the "ambient" sort of light in Apple's QuickLook) then spherical harmonics / light probe could be an alternative to PMREM. Light probes are now supported in threejs mrdoob/three.js#16223 An option could be to pre-compute the spherical harmonic coefficients offline and then store them in model viewer as the default. These coefficients comprise just a few vectors (think a few bytes at most) and easily embedded directly into the codebase.
@richardmonette 👋 I think you and @elalish could have an enriching (for the rest of us) discussion on this topic :)
@pushmatrix we can definitely defer generation of the environment map, we just don't right now. I scheduled it for v0.9.0, let's chat if you think it should land sooner!
@pushmatrix Agreed, but was that timing for 0.7 or master? Since #856 landed the generation time should also be quicker. If you have a chance to test it, I'd like to see what result you get.
@richardmonette Thanks, however SH has enough resolution only for the diffuse portion of the reflection, not the specular (even for a blurry env-map like our generated one). Additionally, I'm actually not happy with SH even for diffuse light when it comes to HDR environments. More on this later when I've finished my current set of rendering improvements.
Thanks, however SH has enough resolution only for the diffuse portion of the reflection, not the specular (even for a blurry env-map like our generated one).
Agreed, one last thought before I drop it, what if you used it as a progressive loading intermediate step, so the user would see the model sooner, with some lighting while PMREM finished in the background?
Possible, but I think there are simpler solutions. I'd like to spend some time improving our startup performance, and I think there may be more significant gains simply by organizing the threads to do more work in parallel with the networking and such.
Just to offer a compromise view, at the limit we will want to wring out every last drop of time we can to get our TTFI down. In that world, I can definitely imagine us relying on lower-fidelity intermediate lighting from SH while we generate something that looks nicer.
That said, the devil is in the details: what is the practical consequence for fidelity? I suspect folks are just as likely to be annoyed by a "flash of low-fidelity lighting" as they are by an extra second (possibly more) of load time. It's something that warrants experimentation.
It's also worth mentioning that we don't have a great tooling story to help folks generate SH for their own environment lighting (yet).
Activity
pushmatrix commentedon Nov 4, 2019
This is something we just bumped into this morning. For our shops that initially have model-viewer elements hidden, the environment map still gets generated and eats up 200-300ms of time even if not viewer is visible.
IMO environment map generation should happen on viewer loading. Can we get this in before 1.0?
richardmonette commentedon Nov 4, 2019
How detailed is the environment map that is being generated? If it doesn't contain high frequency details (think the "ambient" sort of light in Apple's QuickLook) then spherical harmonics / light probe could be an alternative to PMREM. Light probes are now supported in threejs mrdoob/three.js#16223 An option could be to pre-compute the spherical harmonic coefficients offline and then store them in model viewer as the default. These coefficients comprise just a few vectors (think a few bytes at most) and easily embedded directly into the codebase.
cdata commentedon Nov 4, 2019
@richardmonette 👋 I think you and @elalish could have an enriching (for the rest of us) discussion on this topic :)
@pushmatrix we can definitely defer generation of the environment map, we just don't right now. I scheduled it for v0.9.0, let's chat if you think it should land sooner!
pushmatrix commentedon Nov 4, 2019
0.9 works :)
richardmonette commentedon Nov 4, 2019
@elalish we could just load the spherical harmonics coefficients https://github.com/mrdoob/three.js/blob/dev/src/lights/LightProbe.js#L10 directly If you have an example of the env map we want to use as the default I've got some command line tools we can use to generate the sh coef.
elalish commentedon Nov 4, 2019
@pushmatrix Agreed, but was that timing for 0.7 or master? Since #856 landed the generation time should also be quicker. If you have a chance to test it, I'd like to see what result you get.
elalish commentedon Nov 4, 2019
@richardmonette Thanks, however SH has enough resolution only for the diffuse portion of the reflection, not the specular (even for a blurry env-map like our generated one). Additionally, I'm actually not happy with SH even for diffuse light when it comes to HDR environments. More on this later when I've finished my current set of rendering improvements.
pushmatrix commentedon Nov 4, 2019
@elalish 0.7, I'll test master
richardmonette commentedon Nov 4, 2019
Agreed, one last thought before I drop it, what if you used it as a progressive loading intermediate step, so the user would see the model sooner, with some lighting while PMREM finished in the background?
elalish commentedon Nov 4, 2019
Possible, but I think there are simpler solutions. I'd like to spend some time improving our startup performance, and I think there may be more significant gains simply by organizing the threads to do more work in parallel with the networking and such.
cdata commentedon Nov 4, 2019
Just to offer a compromise view, at the limit we will want to wring out every last drop of time we can to get our TTFI down. In that world, I can definitely imagine us relying on lower-fidelity intermediate lighting from SH while we generate something that looks nicer.
That said, the devil is in the details: what is the practical consequence for fidelity? I suspect folks are just as likely to be annoyed by a "flash of low-fidelity lighting" as they are by an extra second (possibly more) of load time. It's something that warrants experimentation.
It's also worth mentioning that we don't have a great tooling story to help folks generate SH for their own environment lighting (yet).
5 remaining items
elalish commentedon Mar 30, 2021
Pretty sure this is working these days.