Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

General direction

Discussion in 'General Discussion' started by Anatidae, Apr 25, 2014.

  1. Anatidae

    Anatidae

    Joined:
    Apr 25, 2014
    Posts:
    1
    Hello,
    I'm an ex-Flash developer and general all-around HTML/Javascript/Java coder. I really like what Unity has to offer and I'm moving here as my platform of choice for the time being.

    So, my first project is already a bit out of the "norm" scope. If you have the knowledge and time to point me in the correct direction, I would greatly appreciate it!

    Goal: To create a game in the style of a comic book. Quite literally, I want to have a "page" with the various frames. Each frame comes "alive" and you play within it for a bit, then jumping to the next frame.

    So, not being a Unity3D expert, my first thought was to find a way to make each frame area a viewport for a camera. Each page will have a handful of scenes set up somewhere in space with independent cameras. These all get mapped to these portals to form the page, where the "master camera" is pointing to. Portals might be a bad term actually. My first instinct is to find a way just to simply map the output of each camera as a texture applied to a primitive plane with an alpha map attached to it to create the more unique shapes for various frames.

    Requirements:
    1. Master camera needs to be able to pan/zoom all around the entire page without each frame having any 3D parallax movement. If I want to inherent any movement from the master camera, I'll write a smarter method to move the frame camera in a more controlled manner.
    2. I'd like to be able to nest my frames for the occasional effect of zooming into a frame and then zooming into a frame within the frame to pull all the way back out.

    Thanks in advance. I'm sure I'll figure out something, but if any Unity experts can point me in the correct direction. I've seen a few examples of secondary camera being used for maps or HUD elements, and that is close. But since I really want the feel of a page with a strip of easily a half dozen frames each with their own camera, it would be very handy to hear the best starting point and I can charge forward from there.

    Thanks!
     
    Last edited: Apr 25, 2014
  2. smd863

    smd863

    Joined:
    Jan 26, 2014
    Posts:
    292
    The most straight-forward way to implement this is with RenderTextures. Have a separate camera rendering to texture for each panel, and one main camera that renders to the scene. For efficiency you will likely need to unload scenes for panels you aren't using and continue showing the last rendered frame.

    RenderTextures are Pro only, but you could achieve a similar effect in Unity free with multiple cameras directly to the screen (by dynamically updating their draw rect) but it will be a bit more complicated and won't work if pages aren't perfectly flat. You can also render a panel to texture (slowly using ReadPixels) in Unity free to capture a texture when you deactivate a panel's scene. Not usually fast enough for real-time effects, but should be fast enough for switching between active panels (or capturing a static frame while a page is turning). Definitely easier with Pro.