Advice on mirror reflection on iPad?

Discussion in 'Rendering Technology and APIs' started by subsym, Apr 23, 2012.

  1. subsym

    Newcomer

    Joined:
    Apr 23, 2012
    Messages:
    3
    Hi,

    I'm wondering if anyone can give me some advice. I am trying to implement mirror relfection for planar surfaces (glass tables, polished wood floors and so on) on the iPad.

    How to do this? My current thinking is to render the reflector first, use that as a stencil, then render the scene normally, and afterwards the scene mirrored by the reflector plane and using the stencil. Straightforward, but is it the fastest way?

    I'm a bit new to this, so any help is really appreciated :smile:
     
  2. Davros

    Legend

    Joined:
    Jun 7, 2004
    Messages:
    12,774
    cube environment map maybe ?
     
  3. pcchen

    Moderator Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,645
    Location:
    Taiwan
    I think this is the traditional way and if all you want is planar reflection it should be fast enough.
    However, if you have performance problem you may want to render it with a reduced resolution, although I'm not familiar enough with iPad's GPU to know if it worth the effort.
     
  4. Davros

    Legend

    Joined:
    Jun 7, 2004
    Messages:
    12,774
    Was my idea, bad ?
     
  5. pcchen

    Moderator Veteran

    Joined:
    Feb 6, 2002
    Messages:
    2,645
    Location:
    Taiwan
    Cube environment map is probably better for curved reflections, such as a ball, or water waves.
     
  6. Arwin

    Arwin Now Officially a Top 10 Poster
    Moderator Legend

    Joined:
    May 17, 2006
    Messages:
    16,998
    Location:
    Maastricht, The Netherlands
    Can you use a (transform of) the previous framebuffer?
     
  7. Davros

    Legend

    Joined:
    Jun 7, 2004
    Messages:
    12,774
    Thanks for that Pcchen
    ps: where I got the idea from ;)
    [​IMG]
     
  8. subsym

    Newcomer

    Joined:
    Apr 23, 2012
    Messages:
    3
    Not sure. I guess that would make it a screen-space method? There are probably a number of subleties involved even if you look at the reflector from the side.

    I've heard that some commercial engines have something like that (UE3??)
     
  9. subsym

    Newcomer

    Joined:
    Apr 23, 2012
    Messages:
    3
    Very nice :smile: For this you still need to prerender part of the scene from a different camera. With cube maps though you'd have an extra resampling step later which will probably mean a lower image quality (haven't tried it though).
     
  10. Davros

    Legend

    Joined:
    Jun 7, 2004
    Messages:
    12,774
  11. Simon F

    Simon F Tea maker
    Moderator Veteran Subscriber

    Joined:
    Feb 8, 2002
    Messages:
    4,521
    Location:
    In the Island of Sodor, where the steam trains lie
    Obviously some additional culling of the reflected geometry would help both at the database traversal level and, if possible, at the clipping stage. What I don't know, however, is whether user clip planes are exposed on IOS.
     
  12. Arwin

    Arwin Now Officially a Top 10 Poster
    Moderator Legend

    Joined:
    May 17, 2006
    Messages:
    16,998
    Location:
    Maastricht, The Netherlands
    I know about it because PGR used it and that was discussed as one of the cheapest reflections possible that can still look top quality. Of course it only works for stuff that is already visible to the viewer - you can't use it for a rear-view mirror in a car. But for reflections of planar surfaces it could work quite well?

    I'm just guessing though based on stuff I read on these boards. No idea if that kind of thing could end up expensive on the iPad or if there are cheaper ways to do it.
     
  13. zed

    zed
    Veteran

    Joined:
    Dec 16, 2005
    Messages:
    3,538
    yes :) cubemaps only give a correct reflection at one spot only (the center of the cube)

    @subsym depends on what youre doing a single surface eg floor, I'ld use it its straight forward and gives nearperfect results, perhaps use a scaling matrix also so the reflections are squashed (or elongated).
    the powervr gpu doesnt like it when you start doing different texture coordinates in the fragment shader (way slower than a desktop GPU from my testing), so screenbased stuff will prolly be slow
     

Share This Page

Loading...