• Advertisement
Sign in to follow this  

2D Smooth "infinity" ortho zoom

Recommended Posts

I'm wondering if I'm missing any steps or making incorrect assumptions anywhere in creating an "infinite zoom" effect in a viewport similar to what happens in the software Mischief where you can pan LRUD and zoom in and out. Mischief claims trillions of levels of zoom.

w2jsLCG.jpg

In this prototype in Maya as you can see I have a front facing orthographic camera and a tree-like structure of 1x1 planes that have been scaled down and/or translated in Z. Imagine the planes as having arbitrarily sized textures on them. Later I want this to be in 3D stereo or VR with depth playing a factor as well as size. I am prototyping this in Maya before I move it to my engine in GL with GLM.

 

I can successfully zoom the ortho camera and set camera bookmarks that I can recall. However I quickly run out of camera zoom resolution as the zoom parameter approaches zero. For example in this scene pictured above I only have 24 1x1 planes but when I'm zoomed far enough in that I can only see the smallest one, the camera zoom is near zero, (even if I query the internal double value), everything starts to shake, and I can't really go any smaller than 0. With mischief, I can zoom in way deeper, to where I haven't found a limit, and do it smoothly.

 

How can I keep on zooming in more with ortho? I tried using a perspective cam and just transforming it, but the perspective distortion warps the perceived position of the planes too much to where once you zoom in far enough everything begins drifting behind each other. 

 

They could also be moving objects back in world space with a real flat perspective cam as they "zoom" in...?

Anotherquestion is why have I only seen this implemented in Mischief out of all the other programs? Is the implementation that difficult or not useful and if its not useful, why did the Foundry buy out the program?

Edited by mrMatrix

Share this post


Link to post
Share on other sites
Advertisement

I'm making some progress. From what I've read so far basically the algorithm is scaling individual objects up and down and disabling ortho zoom while retaining the ability to move L/R. This gives the benefit of having an ortho camera in regards to 2d plane placement always lining up and makes it so you aren't limited by hitting zero on the ortho zoom parameter.

You can write a function to calculate if the plane has scaled so much that it surrounds the screen meaning you can now cull it. Also if it gets too small you can cull it. Of course you can still move the ortho cam L/R

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Tags

  • Advertisement
  • Popular Now

  • Similar Content

    • By Manuel Berger
      Hello fellow devs!
      Once again I started working on an 2D adventure game and right now I'm doing the character-movement/animation. I'm not a big math guy and I was happy about my solution, but soon I realized that it's flawed. My player has 5 walking-animations, mirrored for the left side: up, upright, right, downright, down. With the atan2 function I get the angle between player and destination. To get an index from 0 to 4, I divide PI by 5 and see how many times it goes into the player-destination angle.

      In Pseudo-Code:
      angle = atan2(destination.x - player.x, destination.y - player.y) //swapped y and x to get mirrored angle around the y axis
      index = (int) (angle / (PI / 5));
      PlayAnimation(index); //0 = up, 1 = up_right, 2 = right, 3 = down_right, 4 = down

      Besides the fact that when angle is equal to PI it produces an index of 5, this works like a charm. Or at least I thought so at first. When I tested it, I realized that the up and down animation is playing more often than the others, which is pretty logical, since they have double the angle.

      What I'm trying to achieve is something like this, but with equal angles, so that up and down has the same range as all other directions.

      I can't get my head around it. Any suggestions? Is the whole approach doomed?

      Thank you in advance for any input!
       
    • By Terry Jin
      Hi everyone! 

      I am from an indie studio that has received funding for our concept and is ready to create the next generation 2D Pokemon-inspired MMORPG called Phantasy World. This ad is for a volunteer position but hopefully will transition into something more. Our vision is to create a game that draws inspiration from the series but is dramatically different in both aesthetics and gameplay as the work would be our own.
       
      We are hoping that you can help us make this a reality and are looking for game developers familiar with the unreal engine and would be happy to work on a 2D top down game. Sprite artists are also welcome as we are in desperate need of talented artists! Join our discord and let's have a chat! https://discord.gg/hfDxwDX

      Here's some of our in game sprites for playable characters while moving around the game world! Hope to see you soon!
       


    • By Sean Meredith
      Hi all, I am starting to develop a tactics game and ran into a problem I had not thought of. I began by drawing a screen with a hex grid, and this is no big deal. I got that working fine. But, I realized it didn't look quite right. This is because in most strategy games, you're not looking straight down. There is a bit of a tilt. Attached is an example of what I mean. The hexagons on bottom are larger than the hexagons on top, and I'm unsure of how to go about adding this effect. Especially when you consider that some maps may be of different sizes. 
      I'm not sure if this is the right place to post something like this, but it seems as though some sort of linear transformation would be applied? No? I don't even know where to begin in a problem like this.
      Thanks.

    • By nick1
      Hello,

      I have limited programming experience in C++, but have always had a passion for games.  Where do I start?  I have a rough idea of the type of game I want to develop and am ready to commit the time necessary to learn new languages.  Are mobile games too difficult to begin with? Should I begin learning the basics of keyboard controls before attempting touch screens?  I would appreciate any input or advice!
      Thanks!
      Nick1
    • By MochiArtist
       draw stuff like this 
       
      Okay, so I am an artist and have been for 6 years. However, I struggle to write code. I'd like to make a small demo of a game I'd like to make one day. If your willing to help it'd be much appreciated. so here is the concept: it's a survival game that involves cute characters that are mochi. 
      Mochi Universe
      Draft version 0.01 (24 December, 2015)
       
      Concept
      The game concept revolves around city building and exploration. The target audience will be age 9+ (most likely because of the possibility of fighting). The cute graphics should appeal to all audiences male and female. The gameplay includes elements of real-time strategy games (such as warcraft ) with faster paced action (such as clash of clans). In order to build your city, you will need to explore the surrounding environment and collect items (such as in minecraft). The gameplay will less intense than warcraft and clash of clans, so the focus will be more on casual gamers than hardcore gamers.
  • Advertisement