Welcome, Unregistered.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Reply
Old 23-Apr-2012, 15:56   #1
subsym
Registered
 
Join Date: Apr 2012
Posts: 3
Default Advice on mirror reflection on iPad?

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
subsym is offline   Reply With Quote
Old 23-Apr-2012, 16:12   #2
Davros
Darlek ******
 
Join Date: Jun 2004
Posts: 10,795
Default

cube environment map maybe ?
__________________
Guardian of the Bodacious Three Terabytes of Gaming Goodness™
Davros is offline   Reply With Quote
Old 23-Apr-2012, 16:41   #3
pcchen
Moderator
 
Join Date: Feb 2002
Location: Taiwan
Posts: 2,466
Default

Quote:
Originally Posted by subsym View Post
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 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.
pcchen is offline   Reply With Quote
Old 23-Apr-2012, 17:37   #4
Davros
Darlek ******
 
Join Date: Jun 2004
Posts: 10,795
Default

Was my idea, bad ?
__________________
Guardian of the Bodacious Three Terabytes of Gaming Goodness™
Davros is offline   Reply With Quote
Old 23-Apr-2012, 17:59   #5
pcchen
Moderator
 
Join Date: Feb 2002
Location: Taiwan
Posts: 2,466
Default

Quote:
Originally Posted by Davros View Post
Was my idea, bad ?
Cube environment map is probably better for curved reflections, such as a ball, or water waves.
pcchen is offline   Reply With Quote
Old 23-Apr-2012, 18:06   #6
Arwin
Now Officially a Top 10 Poster
 
Join Date: May 2006
Location: Maastricht, The Netherlands
Posts: 14,509
Default

Can you use a (transform of) the previous framebuffer?
Arwin is offline   Reply With Quote
Old 23-Apr-2012, 20:49   #7
Davros
Darlek ******
 
Join Date: Jun 2004
Posts: 10,795
Default

Thanks for that Pcchen
ps: where I got the idea from
__________________
Guardian of the Bodacious Three Terabytes of Gaming Goodness™
Davros is offline   Reply With Quote
Old 23-Apr-2012, 20:50   #8
subsym
Registered
 
Join Date: Apr 2012
Posts: 3
Default

Quote:
Originally Posted by Arwin View Post
Can you use a (transform of) the previous framebuffer?
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??)
subsym is offline   Reply With Quote
Old 23-Apr-2012, 20:54   #9
subsym
Registered
 
Join Date: Apr 2012
Posts: 3
Default

Quote:
Originally Posted by Davros View Post
Thanks for that Pcchen
ps: where I got the idea from
Very nice 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).
subsym is offline   Reply With Quote
Old 23-Apr-2012, 21:12   #10
Davros
Darlek ******
 
Join Date: Jun 2004
Posts: 10,795
Default

ps: if you want it
http://www.nvidia.com/object/cool_st...ml#!/demos/601
__________________
Guardian of the Bodacious Three Terabytes of Gaming Goodness™
Davros is offline   Reply With Quote
Old 24-Apr-2012, 07:30   #11
Simon F
Tea maker
 
Join Date: Feb 2002
Location: In the Island of Sodor, where the steam trains lie
Posts: 4,425
Default

Quote:
Originally Posted by subsym View Post
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
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.
__________________
"Your work is both good and original. Unfortunately the part that is good is not original and the part that is original is not good." -(attributed to) Samuel Johnson

"I invented the term Object-Oriented, and I can tell you I did not have C++ in mind." Alan Kay
Simon F is offline   Reply With Quote
Old 24-Apr-2012, 09:15   #12
Arwin
Now Officially a Top 10 Poster
 
Join Date: May 2006
Location: Maastricht, The Netherlands
Posts: 14,509
Default

Quote:
Originally Posted by subsym View Post
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??)
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.
Arwin is offline   Reply With Quote
Old 25-Apr-2012, 23:15   #13
zed
Member
 
Join Date: Dec 2005
Posts: 2,428
Default

Quote:
Was my idea, bad ?
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
__________________
"Kinect is like a zero-button mouse with a lot of latency on it." John Carmack
zed is online now   Reply With Quote

Reply

Tags
ios, opengl, relfections

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:13.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.