Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The generated image does not match the screen resolution #284

Open
smart4654154 opened this issue Sep 13, 2024 · 3 comments
Open

The generated image does not match the screen resolution #284

smart4654154 opened this issue Sep 13, 2024 · 3 comments

Comments

@smart4654154
Copy link

I can provide images of various resolutions to the browser, but my monitor resolution is fixed (1920 * 1080),
I have observed that even if the resolution of my photos is high or low, they can always fill the browser
When the returned image resolution is small, such as 100 * 100, I know that Viser stretched the photo to fill the browser.
Q1:Based on the code that you provided(#247), I guess this is stretch code. Can you tell me specifically what 'file' refers to in the getFilmWidth function.may be browser resolution?

// Resize the mesh based on focal length.
const f = camera.getFocalLength();
backgroundMesh.current!.scale.set(
  camera.getFilmWidth() / f,
  camera.getFilmHeight() / f,
  1.0,
);

Q2:
When the returned image resolution is high, such as 2000 * 2000 or 3000 * 3000, the results I see in the browser are very clear. Does Viser downsample high-resolution photos to the browser resolution?Because the resolution of the monitor is limited.
For example, converting 2000 * 2000 photos to browser resolution and allowing users to view them. 3000 * 3000 photos are also converted to browser resolution for users to view. Can you tell me the specific code? Or is it this code that completes the downsampling task?
// Resize the mesh based on focal length.
const f = camera.getFocalLength();
backgroundMesh.current!.scale.set(
camera.getFilmWidth() / f,
camera.getFilmHeight() / f,
1.0,
);

Q3:
I guess both photos (3000 * 3000) and (2000 * 2000) will be downsampled to the same resolution. My problem is that users can render high-resolution photos, such as 2000 * 2000, 3000 * 3000, and Viser will automatically downsample to the same resolution. Therefore, rendering high-resolution photos is meaningless because the final displayed photo resolution is the same.am I right
Thank you very much.

@brentyi
Copy link
Collaborator

brentyi commented Sep 13, 2024

Hello!

Q1: For getting more information about getFilmWidth / getFilmHeight, your best bet is probably Google. Or, here's the threejs docs page: https://threejs.org/docs/#api/en/cameras/PerspectiveCamera.getFilmHeight

Q2/Q3: There's no explicit image downsampling. But otherwise we just display your image as a texture to fill the browser window, which will either be up- or down-sampled automatically by the WebGL renderer.

rendering high-resolution photos is meaningless because the final displayed photo resolution is the same

Yes, rendering photos that are higher in resolution than the screen/browser has no value!

@smart4654154
Copy link
Author

Hello!

Q1: For getting more information about getFilmWidth / getFilmHeight, your best bet is probably Google. Or, here's the threejs docs page: https://threejs.org/docs/#api/en/cameras/PerspectiveCamera.getFilmHeight

Q2/Q3: There's no explicit image downsampling. But otherwise we just display your image as a texture to fill the browser window, which will either be up- or down-sampled automatically by the WebGL renderer.

rendering high-resolution photos is meaningless because the final displayed photo resolution is the same

Yes, rendering photos that are higher in resolution than the screen/browser has no value!

Thank you very much.
Is there any function that can obtain the resolution of the current browser?

@brentyi
Copy link
Collaborator

brentyi commented Sep 29, 2024

Is there any function that can obtain the resolution of the current browser?

Unfortunately this isn't exposed right now, you would have to modify the source code. If you have time for a PR I'd also appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants