cognitedata / reveal

Cognite Reveal 3D viewer

Home Page:https://cognitedata.github.io/reveal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3.1.0 defaults to using Medium SSAO on mobile devices

Strepto opened this issue · comments

case 'disabled':
case undefined:
return ssaoQualityHint;

There is a bug here where the default fallthrough of restrictSsaoOptionBasedOnDevice is the input value, and the input value might be undefined. This makes the switch here

const ssaoParameters = { ...defaultRenderOptions.ssaoRenderParameters };
switch (quality) {
case undefined:
break;

just use the default value, which is "SSAO medium", and this makes performance on mobile unusable. Its easy to work around in the client by specifying the quality to 'disabled, but it might be nice for new users fo the library to not have to specify the ssaoQualityHint.

(Remark: i have looked at this for about 10 minutes and did not actually verify this is a fix)

Also:

The isMobileOrTablet check does not detect iPad when they have "Request Desktop Website" (Which is the default). Then the iPad returns same user agent as a Intel Mac 🎉 ...

An ugly workaround using deprecated everything could be:

function iOS() {
  return [
    'iPad Simulator',
    'iPhone Simulator',
    'iPod Simulator',
    'iPad',
    'iPhone',
    'iPod'
  ].includes(navigator.platform)
  // iPad on iOS 13+ detection ('Request Desktop Website' workaround)
  || (navigator.userAgent.includes("Mac") && "ontouchend" in document) // Super hacky and will fail when Macs get touch...
}

Thanks for reporting!

I'll try to get a patch out tomorrow to fix this.

Hey @Strepto,

Would it be possible for you to verify this fix: #2239?

@Strepto Has been merged now. Is this something you need us to release asap. or is it ok to defer?

No rush for us.

Feel free to close the issue 🥇