Archived

This topic is now archived and is closed to further replies.

Ripple effects and windows

This topic is 5896 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to make a window in my game. What i want it to do is be a space in the world where you look at it from the front and you see another area, from the side, you just see a thin sliver of an area, and from the back you see another area, as if you were looking from the other side of the window, in its area. i guess i am not making that much sense, so you should see the picture i made to give an example [url]http://www.geocities.com/black_mage_s/Image3.gif[/url] you may need to delete the http:// part at the beginning

Share this post


Link to post
Share on other sites
Ehm, let me see... Let''s say we have a HUGE piece of black paper. Cut a hole in it and you can only see through the hole. Is this your idea?

In that case, where do you wanna use this? OpenGL? Graphics in general?

OpenGL:
I only know that there''s something called stencil buffer. Try get some docs on it, haven''t played around with OpenGL very much.

General graphics:
Create a filled (or inverely-filled) ellipse with the bresenham method (lightning fast!). Then check against this mask for every pixel if the pixels are to be put or not.

Hope this gave some ideas...

- coelurus

Share this post


Link to post
Share on other sites
Your picture is inaccurate. Looking through a window from the other side never yields an lateral mirror image (unless inverted objects are on either side of the window.

Anyway, if you''re speaking in 3D perspective is automatically handled. For an arbitrarily shaped window, create a rectangular (simply because rectangles are the fundamental building block in our world) hole in the wall/surface (compose the wall from a couple of closed polygons) and apply a texture that has pixels with the transparent color everywhere you want to be able to look through the window, and opaque colors everywhere else.

Share this post


Link to post
Share on other sites
ugh.
i just used window for lack of a better word.
lets say... interdimensional portal.
the image isnt supposed to be mirrored exactly. more like...you look at the worl from one area and you see some building, and you look at it from another and see an interly different set of buildins

Share this post


Link to post
Share on other sites
If it''s in 3d, then you can do it using 2 polygons (okay, maybe 3 and billboarding). The first polygon will be the portal, 2-sided. It maintains its orientation in 3d space. The other two are larger and have images of what you''d see if you looked through the portal. You always keep them behind the portal polygon with respect to the camera. You now have transparent pixels for the "body" of the portal and non-transparent for the border.

I hope that was reasonably clear, but if it wasn''t I''ll be happy to try again.

Share this post


Link to post
Share on other sites