Weird reverse perspective, animated

Discuss

38 Responses to “Weird reverse perspective, animated”

  1. Beanolini says:

    Maybe I am being pedantic, but you’ll get a quite different result if you can replace the perspective divide. In standard perspective projection, the rate of change of screen size is greatest at the near z plane, and straight lines will always be projected straight.

    In your projection, rate of change of screen size is greatest at the far z plane (demonstrated in the video by the cars rapidly changing in size near far z, not changing much at near z), and straight lines will curve increasingly as they approach far z (demonstrated in the video by the increasing width of the road approaching far z).

    Replacing the perspective divide with a multiply would give a uniform increase of size with distance, and straight lines would (I think) remain straight after projection.

    If you did write a shader that could replace the perspective divide, this would also give far greater control over the strength of the ‘reverse perspective’ effect- you could even animate from standard to reverse perspective- that I would love to see.

    • JMS7 says:

      OK, here’s a funny thing: I read that and was totally sold. I was just writing a reply saying it was a fair and interesting statement (which it is) and went on to explain the limitations of the platform I was using.

      But then I realised (slowly; I’m tired) that what you are describing is, in fact, what I intended. You say that rate-of-change is happening in reverse to how standard perspective works.. surely that’s the point. When the cars drive toward us in reverse perspective, they are driving into the notional “distance”, so they will apparently change less at nearZ than at farZ (contrary to standard perspective).

      Maybe I’m not reading you right, but it seems that when perspective is reversed the rate-of-change-over-distance should be reversed too.

      Still, thanks for the input, and if I am getting you wrong please do let me know.

  2. arkizzle / Moderator says:

    This version was never released. The original is here.

  3. feedbackart says:

    I’m with Flatfive: credit for the music???

  4. Beanolini says:

    Does the road widen unevenly, though? In the video, it appears to widen more on the left side of the screen than the right (it curves more on the left side than the right; the left side is further from the centre line than the right).

    I think this is probably more apparent in your ‘perpendicular array’ test video- the blocks appear to be arranged in a curve, and the far blocks seem to slow slightly as they approach the (horizontal) centre of the screen, and ‘surge’ away from it.

    It is, admittedly, quite subtle, and you could tweak it quite a lot by moving the far z. I think, though, that it gives a (subliminal?) ‘seasick’ sort of effect, and a linear increase might give a ‘cleaner’ result. But I guess the small difference may not be worth the extra work.

    I appreciate it too, it’s made me think a lot about the artefacts of perspective projection.

  5. JMS7 says:

    Hmm.. In fairness though, the road is never really on-axis WRT the camera, so it will display subtle RP in the slightly-off-x direction as well as z. Do you know what I mean?

    And if you pause the ‘perpendicular array’ video, you can take a ruler and see that the edges of the objects form a straight edge into farZ, even if it looks curved to the eye.

    Or if you go on to the next test, you can see a grid of actual lines, and see no curvature.

    And I’m not sure how the geometry would curve with the very minor changes I’ve made to the perspective matrix. Would I not need more complex maths to do that?

  6. Sweetcarovan says:

    This made me feel a bit seasick…

  7. Beanolini says:

    Perspective is truly reversed

    Er, no. You’re just tweaking the projection matrix, the perspective divide is still happening.

    It’s effectively reversing the direction of the depth buffer in a particularly perverse way. You can get the same effect by clearing the depth buffer to the opposite end, and reversing the depth test.

    If I get time, I’ll post an OpenGL example.

    • JMS7 says:

      If I get time, I’ll post an OpenGL example.

      Here, why not just use mine:

      glViewport(0, 0, w, h);
      glMatrixMode(GL_PROJECTION);

      float m[16] = {
      -1.0f, 0.0f, 0.0f, 0.0f,
      0.0f, 1.0f, 0.0f, 0.0f,
      0.0f, 0.0f, -1.0f, 0.0f,
      0.0f, 0.0f, 0.0f, 1.0f };

      glMatrixMode(GL_PROJECTION);
      glLoadMatrixf(m);

      http://www.vimeo.com/12532918

      Er, no. You’re just tweaking the projection matrix, the perspective divide is still happening.

      Sigh. The projection matrix is the digital manifestation of how-perspective-functions in the CG universe. I inverted the way that works; hence perspective in the CG universe is now reversed. I’m not sure of your distinction. What exactly would I have to do to “truly reverse perspective” to your satisfaction?

      And I didn’t simply reverse the depth order. As seen above I simply flipped the sign of the z-scale in a custom matrix, and then multiplied it by the PM, so that when the ViewFrustrum is stretched into the CanonicalViewVolume, it happens backwards (the VF is now backwards, so when the CVV transformation happens the vanishing point is now near (shrinks) and the focal point is now far (expands)).

      Arkizzle made a decent attempt at it explaining it above, about the “in camera” line. The “truly” is a way of separating this work from some of the other interpretations of Reverse Perspective that are not consistent in their application, like Russian Orthodox Icons etc. They follow the intent but not the rules. Here, the rules are everything.

      I’m not sure about your tone. It sounds like you’re personally offended somehow.

      • Beanolini says:

        The projection matrix is the digital manifestation of how-perspective-functions in the CG universe. I inverted the way that works; hence perspective in the CG universe is now reversed. I’m not sure of your distinction. What exactly would I have to do to “truly reverse perspective” to your satisfaction?

        The projection matrix is not the whole picture. That just maps the view to a unit cube, and stores distance in the 4th (w) component of each vertex.

        The perspective divide is where perspective is actually applied- this happens after the projection transform; x,y, and z are divided by the w component.

        In your example, you’ve not changed the 4th row of your matrix, so your w component is identical to a standard perspective projection. Now when the perspective divide happens, your x & y will map to the same position as normal, whereas your z will map to something like farz-z. So you’re effectively reversing position in the z-buffer.

        What you really want is screenx=x*z; you’re getting something that resembles screenx=x/(farz-z) instead. It does make things increase size with distance, but not in an exact reversal of perspective.

        Incidentally, why do you flip x as well as z?

        To get true reverse perspective, you’d have to get rid of the perspective divide, and replace it with a multiply instead.

        You can’t (as far as I know) stop it doing the perspective divide in OpenGL or D3D, but if you force w components to be 1 (use 0,0,0,1 in the w bit of the projection matrix) it will effectively do nothing. You could then do the projection and the perspective multiply in a vertex shader, and you would really have ‘true reverse perspective’. Sounds like a fun experiment.

        • JMS7 says:

          Wow, I’m not even sure I agree with your assessment, but that’s pedantic.

          As I said, the “truly” is to differentiate from earlier inconsistent implementations of RP, just that.

  8. Beanolini says:

    OK, there’s a python script here to demonstrate with a teapot. Needs Python (I’m on 2.6), wxPython & PyOpenGL.

    Press the button to reverse the z-test, L-click & drag to rotate, R-click & drag to zoom.

    With reverse off, it does
        glClearDepth(1.0)
        glDepthFunc(GL_LESS)
    and with reverse on,
        glClearDepth(0.0)
        glDepthFunc(GL_GREATER)

  9. flatfive says:

    Okay, I’ll be the first to ask – what’s that song?

  10. Eltanin Antenna says:

    The amazing thing is how quickly the eye (or rather, the brain) seems to adapt to it – I’m sure that in just a few hours of walking around in a world like that, you could operate almost normally.

    • JMS7 says:

      Eltanin,

      It’s true :) But try working in this environment, there are still some oddities that don’t come across in this video; like when you zoom toward an object it gets smaller! That take a lot of getting used to :)

      Also, try the TRP-Silhouette video on the same vimeo page. You’ll see that your brain can keep getting fooled, even though it knows the true shape of the geometry.

  11. JMS7 says:

    Sounds like we’re just coming at it from different… (dare I?) perspectives!

    http://www.instantrimshot.com

    Butseriously, I’m not sure what you mean by the straight-lines thing. Straight lines stay straight throughout; have a look at my test videos. Do you mean a sort of fish-eye distortion? You mention the road, above, but in world-space the road actually curves as it approaches farZ (to the left and up, over the hill) – is that what you are referring to?

    I’m not sure there is one projection system that will ‘reverse’ every single feature of ‘standard’ perspective.

    I’m sure that’s true, too. Again though, the “true” was not to say “definitive”, it was to distinguish it from previous, non-rules-consistent attempts (in paint, usually).

    When I originally wrote the description of TRP for the vimeo page, the paragraphs were arranged differently; the “truly reversed” phrase came directly after the descriptions of the previous RP styles, making it a comparison to them rather than an explicit declaration.

    The paragraphs were rearranged for clarity, and that line ended up getting precedence over the RP descriptions, so the context was lost. This may have coloured your reading of my intent somewhat.

    Thanks again, I really do appreciate the dialogue.

  12. jfrancis says:

    It’s neat looking but the guy acts like it’s never been done before. In the 70s and 80s when hidden surface removal was still a chore one of the first things you’d wonder is what would happen if you changed the sorting, or made screen X and Y proportional to, instead of inversely proportional to Z.

    Here’s a web example from Martin Wattenberg, 1997

    http://www.bewitched.com/m/models/depth.html

    • cinemajay says:

      Not sure what you mean by “…the guy acts like it’s never been done before…” Since:

      1. If you click the link he only says it’s not been done in CG before and

      2. He actually talks about the other times it has been done before

    • arkizzle / Moderator says:

      JFrancis, from the description:

      I am unaware of anyone attempting a full environment in RP on purpose, but I can’t imagine it hasn’t happened, at the very least accidently, when people were developing computer-visualization algorithms and writing game-engines.

  13. noahpoah says:

    I felt like the airplane character was underdeveloped, though I liked the tension between the red and blue cars. It takes real guts to leave that story line unresolved.

  14. Anonymous says:

    A simpler but more mind-boggling trick is to switch the prism on an (old) 3-D projector. Objects will appear to almost vanish as they crash into the screen

  15. a random John says:

    For an even more disturbing effect, attend a 3D movie and flip the polarized glasses they give you upside-down. The background is suddenly sticking into your face while the foreground objects seem to punch moving holes in the background and are far away.

    • Sogwa says:

      I’ve done that b4 but I never noticed any wierd effects from the polarized glasses upside down OR looking at them thru the front instead of properly from behind.

  16. Beanolini says:

    but it seems that when perspective is reversed the rate-of-change-over-distance should be reversed too

    I guess that’s one way of looking at it. I’d argue that as ‘standard’ perspective halves the size of an object as its distance doubles, ‘reverse’ perspective should double its size as distance doubles. This would also result in straight lines in world-space being rendered straight in screen-space (I think this is quite important; you might disagree).

    This would mean that rate of change of screen size would remain constant over the whole distance range- perhaps not a ‘reversal’ of ‘standard’ perspective, but definitely different. I’m not sure there is one projection system that will ‘reverse’ every single feature of ‘standard’ perspective…

  17. neurolux says:

    …or build a pseudoscope and see the world around you this way. http://en.wikipedia.org/wiki/Pseudoscope

  18. SkullHyphy says:

    cool game possibilities

  19. Hodge says:

    Wow ! It’s half like being in a three-sphere !

  20. Anonymous says:

    If you go to a 3D movie, try turning the glasses around. It’s kind of like the reverse perspective trick looking through a weird tunnel.

    Oddly this is I see those weird steroegram pics where you look unfocused at carefully distorted visual noice.

  21. dculberson says:

    I was mostly curious about referring to an effect as “in-camera” when it’s computer generated imagery. Is he just using a colloquialism or is there some other meaning behind “in-camera” when there’s no actual camera involved?

  22. arkizzle / Moderator says:

    dc,

    The effect above is achieved by altering the camera’s algorithm, so the results are as the camera “sees”, as opposed to just building trick geometry (or just animating the cars bigger and smaller in place, or setting them on a script based on their distance from the camera).

    If you move the camera around the world, the effect will be consistent to the viewer. Therefore “in camera”.

  23. dculberson says:

    Understood. Thanks!

  24. grikdog says:

    Shizuku’s novel-within-a story in Studio Ghibli’s “Whisper of the Heart” uses the same perspective trick, although as a metaphor for the untutored dramaturge’s penchant (as Shakespeare noted) to produce marvelous tales about seven pages long.

  25. arkizzle / Moderator says:

    Check out the test videos, you can see more of it in action. It’s weird stuff :)

    http://www.vimeo.com/12532918
    http://www.vimeo.com/12534042
    http://www.vimeo.com/12544644

  26. andygates says:

    It’s like the perspective break you get with too much amanita muscaria. Wibble.

Leave a Reply