Skip to content

Ensure environment map adheres to lazy loading semantics #490

Closed

Description

@cdata

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.

Activity

  1. pushmatrix commented on Nov 4, 2019

    @pushmatrix
    Contributor

    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?

  2. richardmonette commented on Nov 4, 2019

    @richardmonette

    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.

  3. added this to the milestone on Nov 4, 2019
  4. cdata commented on Nov 4, 2019

    @cdata
    ContributorAuthor

    @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!

  5. pushmatrix commented on Nov 4, 2019

    @pushmatrix
    Contributor

    0.9 works :)

  6. richardmonette commented on Nov 4, 2019

    @richardmonette

    @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.

  7. elalish commented on Nov 4, 2019

    @elalish
    Contributor

    @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.

  8. elalish commented on Nov 4, 2019

    @elalish
    Contributor

    @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.

  9. pushmatrix commented on Nov 4, 2019

    @pushmatrix
    Contributor

    @elalish 0.7, I'll test master

  10. richardmonette commented on 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).

    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?

  11. elalish commented on Nov 4, 2019

    @elalish
    Contributor

    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.

  12. cdata commented on Nov 4, 2019

    @cdata
    ContributorAuthor

    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).

  13. 5 remaining items

  14. modified the milestones: , on Jan 6, 2020
  15. added
    flag: partner
    on Jan 8, 2020
  16. modified the milestones: , on Jan 8, 2020
  17. modified the milestones: , v0.10.0 on Mar 4, 2020
  18. modified the milestones: v0.10.0, , on Apr 13, 2020
  19. removed this from the milestone on Jun 11, 2020
  20. elalish commented on Mar 30, 2021

    @elalish
    Contributor

    Pretty sure this is working these days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arc: performancearc: rendering & effectsflag: partnertype: feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions