Jump to content

Fitting the scene to canvas?


agmcleod
 Share

Recommended Posts

Hi there. I'm working on a 3d piece for a client project where there will be both desktop & mobile users. The scene itself is a landscape setup, so it sits wider than it is tall. I have an on resize event to call the engine.resize(). The canvas is set to width: 100vw; height: 100vh, and does resize quite well. However once i shrink it so the bottom of the scene is touching the bottom of the window, and then shrink it horizontally, the scene gets cut off. I've tried playing with the fovMode, but that hasn't helped. Is there a way for me to allow to be more fluid to the canvas size, even though it will look skewed? I think it's more varying sizes of mobile screens that I need to adapt for, so it shouldnt be too much of a negative effect, or at least i hope not. Main thing is that we noticed things would appear off screen on our phones, but only by a little.

Link to comment
Share on other sites

I indeed gave that a try yesterday, though i would never see the right green wall on screen. Like it was hard to keep the scene within the viewport at all. But it did some what solve the above issue. With your playground link, I can also tell that it clips the viewport when shrinking vertically. I dont think we'd lose too much with that, but If dice get cut off by landing higher or lower on the screen, that's bad. I realize this is a tricky thing, as perspective usually fixes one of the two directions for FOV.

 

image.thumb.png.cc7171fca88282aa66b59020993df738.png

Link to comment
Share on other sites

Not really an answer to the original question, but kind of a solution. Since changing horizontally, it does solve the landscape problem, clearly the camera just needs to see more of the scene. So I pulled the camera up about 5 units. I also adjust the FOV angle depending on aspect ratio. Definitely seems to operate better than before.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...