We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Change camera settings on the fly

Home Forums Puzzles Change camera settings on the fly

  • This topic has 6 replies, 6 voices, and was last updated 1 month ago by xeon.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #21204
    scalare
    Customer

    Hello,

    is there a way to change the active camera settings on the fly? Not just animate it to make it look to a different target, or tween the camera, but changing its focal length for example, or make it zoom in without actually moving the camera. I ask this because sometimes, when I display a 3d scene at full width and height on the browser, the view changes a lot between what you see on desktop and what you see on mobile, more so if you visit the page in vertical mode on mobile. I’d like to be able to adjust the camera if I detect that the user is visiting the page using a mobile device to get closer, for example. All of this applies to the case where there are no camera controls (in Blender, Controls set to “No controls” in Verge3D Settings for the camera)

    Is this possible?

    Thank you!

    #21209
    Crunch
    Customer

    Scalar it sounds like you want what I also want – a “responsive” 3d scene similar to what you can do with webpages (via HTML/CSS, media queries etc) to make them “responsive”. (i.e things automatically adjust/’scale’ to accommodate the smaller screen size of mobiles including switching between mobile portrait and mobile landscape)

    unfortunately, just like when you frame a photograph of a football team in your camera view finder and everything looks good, if you then suddenly flip the camera on its side into portrait mode, you’re going to cut a lot of players out of the shot.. The only solution is to back way up… and by the time you back out far enough, everyone’s faces are so small.

    That’s the problem I run into when I make a beautiful looking app on desktop then bring it up on my phone in portrait only to find everything is so far away its hard for my fat fingers to navigate.

    Aside from programming the app to automatically adjust the actual positions of objects (similar to telling your football players to get up on each others shoulders to all squeeze nicely into the shot), which isn’t a very practical option (it technical becomes a separate scene), the only option is to swap to a different camera/angle.

    I’ve done something similar using techniques discussed here

    How to adapt device screen size

    Basically you just have to write some procedures to “survey” the scene on start, and re-size events and use that to figure which camera angle/position, fits best to corresponding screen sizes/orientation.

    Unfortunately, mobile screen real estate (relatively speaking) will always have its drawbacks.

    #21338
    scalare
    Customer

    Hi Crunch,

    Yes, that is exactly the problem. In fact, I’ve solved it in another app by checking about the resolution and increasing/decreasing some buttons inside the 3D viewport to make it easier for users to touch them. But in that case, it wasn’t so important to be able to view the 3D scene in detail, I just needed the buttons to be easier to touch.

    Now I have a different situation, where the whole scene framing does not make much sense when the device is rotated. In any case, I’ve checked the example you’ve linked to above, and I see that what is being done is to move the camera to a different position, while using the same focal length. I can reproduce that without problems.

    I checked the scooter example, and while it works, I think I’ll have to check the resolution proportion not only at the start, but also dynamically, so that the camera adjusts as well if you happen to resize the browser window in a desktop computer to reduce its width to become a vertical proportion (The scooter example interface elements change their size, but the camera does not change dynamically)

    But let’s say that I want to use the same camera, and change the focal length instead, based on resolution, so that, for example, I make it more wide-angle when in vertical mode, and more tele in landscape mode, that would probably let us adjust things without having to tween the camera to a different position, just a parameter for the camera, while also providing an interesting way of doing some effects (tweening the focal length parameter)

    Anyway, thank you for your suggestion and link. I can work with that for the time being!

    #26573
    GLiFTeK
    Customer

    I know this post is from awhile ago, but I had an idea I’ll share…

    You could have a generic (almost works for all device models screen sizes) with camera position and settings keyframed at frame 0

    Then make many other camera position/settings keyframed at say, intervals of 10 frames from smallest to largest or vice versa.

    Do the standard @media query to get users screen size.

    Use the new clone animation puzzle to animate(if desired) to the proper settings keyframed spot of that screen resolution you made (ie: frame 30, or 50 etc) or just jump to it before screen rendering is shown in preload.

    I’ll probably use this method if there’s nothing about it that isn’t supported.

    ..is there? Will that work?

    #26591

    this might work!

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #44051
    jdhutchinson
    Customer

    Okay so pulling up this old post…

    I don’t quite understand glifTeks method, so would be interested to see how others would do breakpoints essentially for camera controls. At the moment, I’ve used offsetwidth over offset height for less or greater than one, and changing maxZoom in an exec script puzzle for the document (or camera, i don’t understand whether it is global or per camera).

    See attached. Perfect at full 1080, and pointless anything less and I can’t fit the entire object on. What’s the reason for that?

    I thought that to try and make it neat, there could be some way to detect with js the change from a certain resolution to another? and when changed, the camera position changes?

    https://lage.us/Javascript-Watch-Variables-for-Change.html

    My biggest confusion though is just why does it even do it in the first place?

    Attachments:
    You must be logged in to view attached files.
    #46406
    xeon
    Customer

    I use a different method. I use a series of empties to target camera positions for different devices. I typically have three sets, mobile, tablet and desktop.

    I then detect which device the app is running on and then set my camera locations and targets to change based on the device type, aspect ratio, etc.

    This way my scene doesn’t change, editing is as simple as adjusting an empty that can be done in the 3D app or in puzzles as needed.

    Since the targets are precise locations it also lets me swap cameras if needed moving from first person to orbirt etc based on needs knowing the locations are locked in based on the empty.

    Xeon
    Route 66 Digital
    Interactive Solutions

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.