• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Controlling the view

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 3 Posters 598 Views
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.
  • M Offline
    mattr
    last edited by 5 May 2008, 03:53

    Hello,

    I'm a total beginner with sketchup and ruby so forgive me if this is a silly question. By way of background, I'm trying to use sketchup to make tiles for a simple 2d isometric game. Basically I make all of my models within a certain bounding cube, then I set the view/camera to a specific position and rotate the model to the eight compass directions, stopping to write a 2d image at each step. This way I can make tiles of my characters, and buildings at every orientation.

    What I'd like to do is make a plug-in to make this process completely repeatable. Ideally once I have a model that's within the appropriate bounding cube the script would set the view/camera to the standard position, set the standard rendering options, rotate the model 8 times and write an image at each step.

    So far I can set the rendering options (background color, axis display off, no perspective, etc) and the camera position and write out images, so that's great. The thing I'm currently stuck on is setting the view itself. I don't want the images to be the wrong size because the window has the wrong aspect ratio. Also, setting the camera position doesn't control the zoom level as I had hopped, and sometimes there seems to be some foreground clipping (like stuff that is too close to the camera is cut off), I don't understand why that happens. I would like to set the window so that it's always the same size and shape and my bounding cube fills it completely.

    If anyone knows of another plug-in that does what I want (or something similar) or can give me some tips I'd really appreciate it!

    Thanks,
    Matt

    1 Reply Last reply Reply Quote 0
    • J Offline
      Jim
      last edited by 5 May 2008, 09:06

      Hi Matt,

      It might be easier to set up scenes for each image you want to export. You can traverse the scenes and export the images using Ruby.

      Hi

      1 Reply Last reply Reply Quote 0
      • D Offline
        Didier Bur
        last edited by 6 May 2008, 19:49

        Hi,
        I remember looooooong time ago I have coded a basic VR objet exporter that might help you.
        It's here:
        http://www.crai.archi.fr/RubyLibraryDepot/Ruby/em_ren_page.htm
        The camera moves on a virtual hemisphere, rotates around the model and exports numbered snapshots a any desired angle.

        DB

        1 Reply Last reply Reply Quote 0
        • M Offline
          mattr
          last edited by 6 May 2008, 21:00

          Hey,

          Thanks for your suggestions, unfortunately they don't quite meet my needs. Basically I'm building a bunch of different models for different tiles. What's important is that they are all exactly the same size (to the pixel). I need to precisely set the view zoom and camera angles to make sure the sizes always match up. I looked at the ado code, here you rely on "zoom extents" which doesn't work for me. Some of the models fill the whole tile, others are smaller than a tile, if I do zoom extents some things will be too big and others too small.

          I'm pretty surprised that you can't get precise control over the exact camera view from a script, surely there must be a way? For example I want to set up a camera such that the image represents exactly the rectangle [0,0,0], [0,5,0], [5,5,0], [5,0,0], with a fixed aspect ratio, say w/h = 2. I actually can set the aspect ratio, but I can't find a way to control the zoom (I should mention that I'm using parallel projection, maybe that's related).

          Thanks again for your help!
          Matt

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

          Advertisement