sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Control over camera lens shift ?

    Scheduled Pinned Locked Moved Developers' Forum
    15 Posts 4 Posters 3.7k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by

      Are you are referring to what is described here, as "shift"?

      Tilt/Shift Photography

      If so, (I think,) you just move the camera's eye position to a new position, that is on the plane, that is perpendicular to the camera's target.
      EDIT: Actually you might also have to move the target, in the same direction, but by an amount proportional to the distance:
      dist = cam.eye.distance(cam.target)

      Here's another wikipage: Perspective Control Lens

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Closest you get in SketchUp is perhaps 2pt perspective?

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Oh @kioobee: If you are on Windows, you can use a built-in Camera Properties test dialog...

          at the console:
          Sketchup.send_action(10624)

          or to add it to the "Camera" menu:

          m = UI.menu('Camera');m.add_item(('Camera Properties...')) {Sketchup.send_action(10624)}
          

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            So kioobee: How would like a camera shift tool to work ??

            My guess would be click the tool button, then

            The current camera target is indicated, and a vector attached to the mouse allows the user to indicate shift at target and direction in one click.

            The target is shifted, and the camera is shifted in proportion.

            Is there any standard symbol for a lens shift ??

            EDIT: Actually it seems that the "Pan" (aka "Dolly") tool already does this.

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              @dan rathbun said:

              EDIT: Actually it seems that the "Pan" (aka "Dolly") tool already does this.

              Dan, lens shifting is correcting perspective - often done when photographing architectural images to keep vertical lines parallel. Also called keystone correction.
              doc_keystone_bookshelf.jpg

              Thomas Thomassen — SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                You can post-process images to have parallel verticals with ShiftN... http://www.marcus-hebel.de/


                Converging.jpg


                Non-Converging_ShiftN.jpg

                TIG

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @tig said:

                  You can post-process images to have parallel verticals with ShiftN... http://www.marcus-hebel.de/

                  He's looking for a Ruby API method though. Within SketchUp "Camera -> Two-Point Perspective" will create the desired effect - but the Ruby API does not allow you to get/set this property.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    You could use perspective OFF mode for the camera AND transform-rotate the whole model about its origin, so that the camera's view direction is square on to a selected face. Like 'align view to face', but with the model moving rather than the camera!

                    Of course this would be messy and can't apply to just one Scene tab, as the entire model is thereafter foobarred.
                    However, if you want to export just an image in code... then model.start_operation('!'), save the camera's details, set perspective OFF for the camera, do the model transformation-rotation relative to a [pre]selected face/point, perhaps zoom extents of zoom-selected ?, export the current view's image and then use model.abort_operation to reset the model back to how it was, and also change the camera back to what it was too as the abort won't encompass that...

                    What exactly are you trying to achieve 'in code' here ??

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      @thomthom said:

                      He's looking for a Ruby API method though. Within SketchUp "Camera -> Two-Point Perspective" will create the desired effect - but the Ruby API does not allow you to get/set this property.

                      Windows only:
                      Sketchup.send_action(10627)

                      I'm not here much anymore.

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        @dan rathbun said:

                        @thomthom said:

                        He's looking for a Ruby API method though. Within SketchUp "Camera -> Two-Point Perspective" will create the desired effect - but the Ruby API does not allow you to get/set this property.

                        Windows only:
                        Sketchup.send_action(10627)

                        And if the camera is already in 2pt mode then this will toggle it of. ... wonder if toggling perspective on/off wil reset a 2pt perspective. But then again the problem is that it's Win only.

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • Dan RathbunD Offline
                          Dan Rathbun
                          last edited by

                          @thomthom said:

                          And if the camera is already in 2pt mode then this will toggle it off. ... wonder if toggling perspective on/off wil reset a 2pt perspective. But then again the problem is that it's Win only.

                          Nope.. toggles between Parallel Projection and normal Perspective.

                          The easiest thing to do is setup a template with at least 2 Scene pages.
                          Set one to Perspective... and Update the scene.

                          Set the another to 2Pt Perspective (I named this one "Keystone Correction",) and update the scene.

                          Then turn Scene Tabs ON, and switch between them, as desired.

                          Sample:
                          shift.skp

                          I'm not here much anymore.

                          1 Reply Last reply Reply Quote 0
                          • K Offline
                            kioobee
                            last edited by

                            Wow, i can't believe how reactive you guys are ! Thanks so much for your feedback.

                            It looks like the Two Point Perspective is the tool i need, thanks for poiting it out.

                            Although it could be triggered by the send_action command, to control it precisely in ruby afterwards is still problematic : how can i control the amount of shift to apply in ruby ?

                            The reason i want to do it ? I'm developping a video projector simulator plugin, and i would like the user to be able to 'see' from the projector perspective.

                            On the image below, i put an image of a projector with a vertical lens shift of 100%. You can see what the projection cone looks like, it is off centered, and i would need to place a camera, and apply two point perspective to match the projection of the video projector.

                            http://kioobee.com/images/simproj.png

                            I hope this clarifies what i want to achieve 😄

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              Unfortunately there is no control over the amount of lens shift in SketchUp. 😞 There is currently just 2pt perspective - as mentioned, not even that can be controlled reliably.

                              Thomas Thomassen — SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post
                              Buy SketchPlus
                              Buy SUbD
                              Buy WrapR
                              Buy eBook
                              Buy Modelur
                              Buy Vertex Tools
                              Buy SketchCuisine
                              Buy FormFonts

                              Advertisement