Skip to main content
GameDev.net gamedev.net
🔒 Locked

Reflection

Started by megatron244 Jun 23, 2007 at 11:37 AM 0 replies 1.1k views
Original Post
megatron244
megatron244
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
Jason Z
Jason Z
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!
Jason Zink :: DirectX MVP   Direct3D 11 engine on CodePlex: Hieroglyph 3 Direct3D Books: 

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.