Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    It's still possible to reply to existing private message conversations during the migration, but any new replies you post will be missing after the main migration is complete. We'll do our best to migrate these messages in a follow-up step.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Static Image Effects

Discussion in 'General Discussion' started by Marble, Feb 12, 2006.

  1. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,271
    How versatile can you get in a 3D environment with 2D images?

    If you have something like a prerendered image of a landscape, are there any special techniques for changing the colors in the image to reflect the time of day?

    What about embedding 2D animations like a waterfall or blowing trees without making the whole image a quicktime movie?

    Or masking parts of the landscape (with layers?) that a player object finds themself "behind"?

    Or creating a very high dpi image so that the camera can zoom in without losing detail? Would this be hard on VRAM requirements?

    I'm just interested in how much an illusion of 3D you can create with 2D images if you've got a camera that is always pointing at a background image at the same angle.

    Thanks!
     
  2. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    Curious about this too, would be nice to have some basic image control... hue/saturation, brightness/contrast, etc... might be expensive on the CPU. Changing the texture images slowly over time might be passable for this effect though.


    Since QT movies aren't compressed in Unity it's better to make a script that cycles through the images. Should work for short image sequences. Not sure about how fast you can get anything above say 128 x 128 to play reliably though.

    Works for games like Final Fantasy, Earlier Resident Evils, and other RPG type games, but the camera has to remain relatively static or the illusion is of course lost.

    I'm pretty sure the limit is 1024 x 1024, but filtering keeps textures at that res looking pretty nice and smooth as you zoom in... or you could UV map and stitch a few of these textures together to create one big image.

    http://unify.bluegillweb.com/scriptwiki/index.php/LookAtCameraYonly is one way to do billboards...or the static camera solution, or parenting billboards in front of the camera for certain effects.
     
  3. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,271
    Hey, thanks so much for responding.

    Stitching textures together for larger images (i.e. landscapes) seems like a good idea even ignoring the texture size limit because I guess it would allow the camera to cull away parts of what could very easily be an enormous image.

    Anyway, interesting questions! 2D done well can be absolutely amazing. I recently broke open some old SCUMM adventure games and was absolutely amazed at the sophistication of the art and animations. The pre-rendered environment and the characters interacted together really well.
     
  4. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    Apologies in advance for the quoting frenzy. ;)

    I'd imagine you could get a pretty good effect just by tinting the texture by changing the colour of the shader. If that's not sufficient, you could probably write custom shaders to get specialised effects.

    I've had good results from abusing the font rendering system for sprite animation. You simply make a texture containing a grid of sprite frames, set up a Font object which explains how the frames are laid out, then use a script to cycle a Text Mesh through the frames in whatever way you want.

    In a similar way, you can use Text Meshes to make tile maps similar to those found in the SNES Final Fantasy games.

    That will automatically work if you have alpha masked textures arranged at appropriate depths in space. You'd want to add some colliders to stop characters from walking through the scenery, but that's all pretty easy.

    Unity's limit is 2048x2048. Recent Nvidia graphics cards support 4096x4096, but ATI cards only seem to go up to 2048x2048 in any case, so you probably need to work within that limit.

    Texture compression (DXT) will allow you to have very large textures without filling so much VRAM, but watch out that the quality will drop as a result. It can look pretty bad on smooth gradients like skies.

    If you're only zooming into parts of the scene, you could concentrate more distant, higher resolution textures in those locations to simulate an overall high resolution.

    If your camera remains horizontal, this script might be more effective, or you could write a combination of the two. The script I'm linking provides less distortion than the other one.

    I'm positive that you could get good results from Unity if you tried this. I did a little test piece to work out the sprite animation thing I mentioned above and it turned out to be pretty easy to set up, and it still looked good.

    Give it a go. I'll look forward to seeing what you come up with. :)
     
  5. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,271
    Thanks for all the tips and of course for the vote of confidence. The font map trick sounds clever (though outside of Unity there remains the difficulty of creating sprite animations that blend in seamlessly with the background, but that's unrelated), and changing the color of a shader seems so obvious now! Mostly it seems obvious because actually writing shaders terrifies me.

    Using the script you suggested, would it then be possible to have a camera hanging in the "air" above a landscape (or whatever) rotate in place above the 2D plane without destroying the illusion of the three dimensions in the image? I'm imagining those Super Nintendo games that had flying vehicles over a world map that was really just a flat picture. I guess that would make it hard to put any perspective (mountains shadowing a valley) onto the plane. (If that makes sense!)

    Interesting!
     
  6. NCarter

    NCarter

    Joined:
    Sep 3, 2005
    Posts:
    686
    I think the 'destroying an illusion' thing is a bit odd here. Either you're going for realism, in which case you're probably better off using 3D models where it's appropriate to do so, or you're intentionally going for a stylised look. In the latter case, I'd say it's OK to destroy the illusion of 3D a bit. If it were me, I'd specifically choose a visual style which allows me to take liberties with 3D space.

    However, you could probably use that script to do what you describe, providing your sprites/billboards contain images which make sense for whatever it is you're trying to do. I'm not sure exactly what you have in mind, so it's difficult to give a clearer answer....
     
  7. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    Sorry Marble, I misunderstood what you were trying to achieve exactly. So you're talking about an overhead game using 2D sprite animations with the alpha knocked out in a 3D environment. When you said landscape I pictured mountains and trees in the distance of a 3D scene. My favorite game that did this 2 1/2 dimension overhead effect was the first couple Grand Theft Autos.

    NCarter, brilliant with the Font Texture technique :wink:
     
  8. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,271
    Good point. I don't have anything in particular in mind. Just interested in the theory right now, and not the least because a lot of 3D games all seem to look the same if you compare them to the really distinctive 2D styles of the early 90s.