Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: 2D view with Z scaling, but no perspective

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jun 2006
    Location
    Edinburgh - Scotland
    Posts
    147

    2D view with Z scaling, but no perspective

    I'll probably use wrong terms but hopefully I can explain this to make some kind of sense...

    I'd like to set the projection so that objects are scaled based on their Z value, but their X,Y screen position doesn't change. i.e. if the Z of the camera was changed all the objects would scale about their centers, but the center wouldn't move.

    So it's the same as what happens with the perspective projection when the camera is at 0,0,0 looking down the Z axis at an object at 0,0,Z but for all objects. Is that possible?

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    2,882
    So you sort-of want the effect that each object is rendered with symmetric perspective but that the eye-space Z axis runs straight through the middle of the object?

    One way is to set up an orthographic frustum, and use a shader to scale the object about it's own local origin in object space by a function of the eye-space Z value before transforming it via MVP to clip space.

  3. #3
    Junior Member Regular Contributor
    Join Date
    Jun 2006
    Location
    Edinburgh - Scotland
    Posts
    147
    Aha yes. I hadn't thought of using a shader. I'd just assumed that since my maths is so bad that there was way to do is just with a glFrustum. Cheers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •