2
\$\begingroup\$

I'm an amateur in 3D game development. The thing I want to know is shading related. For reflection purpose, which will be the efficient way? Either "Realtime render to Cubemap" or "Ray trace based" reflection? In which way I will get better frames per second and my gpu gets less tired? No matter which API I use (e.g. DirectX, GL, GL ES, Metal). And please note my question is out of any game engine.

\$\endgroup\$
  • 4
    \$\begingroup\$ Neither. Dual paraboloid depth impostors. \$\endgroup\$ – MickLH Dec 31 '15 at 6:33
2
\$\begingroup\$

For games, there are two main reflection techniques.

You mentionned cube maps that is one of them. Cubemaps are good for reflections on arbitrary complex objects (sphere, teapots, ...). One other advantage is that they can also easely handle reflections on normal mapped objects.

In terms of computing poxer needs, you have to be aware that for each reflecting objects, you have to render 6 times you scenes to the cube map. There are several optimisation possible (not render cube map at each frame, use low def render surface, ...) but it remains costly.

The other way is to use "portal" related techniques that are very well described in this question.

The main advantage of this technique is that you will only require one more rendering pass. Another good point is that you can handle mirrors reflecting mirrors in a more complete and easy way than with cube maps (still it is not esay to handle such cases).

The main drawback is that you have to cull objects that are behind the reflective surface. Another drawback is that reflective surface must be a plane.

Raytracing in real time games is, afaik not used because it is too much resource hungry.

\$\endgroup\$
  • \$\begingroup\$ You only need to render the scene 3 times, because effrctively, you can only see 3 sides of the cube at once. \$\endgroup\$ – Bálint Apr 2 '16 at 9:13
  • \$\begingroup\$ @Bálint Nope, even a simple reflective sphere allows you to see all 6 cubemap sides. \$\endgroup\$ – HolyBlackCat Jul 12 '16 at 0:01
0
\$\begingroup\$

Cubemaps are much much faster than realtime (raytraced is realtime) although it does have its disadvantages.

https://en.wikipedia.org/wiki/Cube_mapping#Advantages

Cube mapping is preferred over other methods of environment mapping because of its relative simplicity. Also, cube mapping produces results that are similar to those obtained by ray tracing, but is much more computationally efficient – the moderate reduction in quality is compensated for by large gains in efficiency.

\$\endgroup\$
  • 1
    \$\begingroup\$ Its still possible for cubemaps to be realtime by rendering to texture each face. I think that's what the op is curious about. \$\endgroup\$ – Steven Dec 30 '15 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.