Jump to content
  • Advertisement
Sign in to follow this  
megatron244

OpenGL Reflection

This topic is 4075 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

Hi, I'm working on a racing game project. I want to add reflection to the vehicles. I've tried the following method: http://www.opengl.org/resources/code/samples/mjktips/Reflect.html First of all, the frame rate went from ~30 to ~20. Secondly, this technique seems to be easy to implement, when the surface is simple (i.e., a plane), but in my case, the track is rather complicated, and there are several objects (vehicles) that needs to be reflected, which add further complexity. Are there other more efficient methods to do such reflection ? Notice, that I don't need an exact solution, an approximation would be fine too. One idea that I had, was to prepare a texture of the reflected vehicle, and to draw is as a blended quad on the track, next to the real vehicle. I didn't implemented it, so I don't know if it's any good. Thanks in advance, Vince

Share this post


Link to post
Share on other sites
Advertisement
The method that you are linking to is specifically intended for planar or semi-planar reflectors. Technically it could work, but I don't think it is suited to the type of reflective objects that you are working with. You need some form of environment mapping, which usually comes in two flavors:

1. Cube Mapping - requires six render targets/rendering passes for each update of the cube map.

2. Paraboloid Mapping - requires two render targets/rendering passes for each update.

Both methods render the scene into a set of render targets for lookup later on when rendering the reflective object. Cube mapping will likely give more realistic results, while paraboloid mapping will likely be faster. For more details on paraboloid mapping, check out the article link in my signature for a sample implementation in HLSL.

P.S. - depending on how fast your graphics card is, both of these methods will slow down your framerate significantly when compared to not performing reflection!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!