1
\$\begingroup\$

I'm completely new to this graphics and game development. I have read about Rendering (drawing a 3D graphic on a display 2D) and there are many ways of rendering, Rasterization, Ray tracing, radiosity, ray casting. And my doubt is if OpenGl implements one of these. I mean with OpenGL I can draw lines, circles and so on, so there should be a rendering algorithm on OpenGL, am I right? Which one is it?

What if I want to implement a different rendering algorithm, does this mean I'm no longer using OpenGL?

\$\endgroup\$
2

2 Answers 2

3
\$\begingroup\$

Like Nicol said, virtually every rendering system used in modern 3D games is a rasterizer. Your graphic card is also built with rasterization in mind, so if you implement a raytracer you either have to do it on the CPU or use some more recent "general computation on GPU" technologies such as CUDA because it's not supported directly by your hardware.

With that said, you "can" implement raytracing, rasterization, radiosity, etc., in virtually any rendering system - just don't expect it to run well.

For instance, I've written (for educational purposes) a rasterizer and a raytracer from scratch on Windows Forms and the only thing I needed from the library was GDI and the Bitmap class. Everything else was calculated by the application.

So the answer to the question "Is it possible to implement a ray tracing algorithm while using OpenGL?" would be: sure, but neither the software or the hardware will be helping you, and the result might not fast enough to be used in a game or another realtime application.

What most modern games do (including those built with the enignes you mentioned) is to fake some of the effects of raytracing and radiosity (i.e. global illumination) by using other techniques such as shadow mapping, depth of field and ambient occlusion, which can generate visually similar results with a much smaller computational cost.

\$\endgroup\$
1
  • \$\begingroup\$ Yey ! Thanks a lot ! This answer is straight to the point. I get it now ! I understand many things. Indeed I made my Bachelor's thesis on CUDA and then I thought using that technology on graphics and games and that's why I was searching info and there is lot of work about CUDA and rendering. Thanks again! \$\endgroup\$
    – BRabbit27
    Dec 7, 2011 at 23:29
5
\$\begingroup\$

In general, you can assume that if a rendering system is not explicitly advertized as a ray tracer, then it's a rasterizer. OpenGL, D3D, REYES (much of it at least), and others are reasterizers.

\$\endgroup\$
4
  • \$\begingroup\$ Ok, thanks for clearing that out. Now, is it possible to implement a ray tracing algorithm while using OpenGL? I ask this because of the Unreal Engine and CryEngine, I read they use ray tracing as render algorithm but also they are built over OpenGL (for non-microsoft platforms). \$\endgroup\$
    – BRabbit27
    Dec 7, 2011 at 20:36
  • 1
    \$\begingroup\$ opengl.org/resources/faq/technical/miscellaneous.htm , Point 24.090 - "Can I raytrace with OpenGL?" TL;DR: not directly, but a lot can be faked. \$\endgroup\$
    – Exilyth
    Dec 7, 2011 at 20:55
  • 4
    \$\begingroup\$ Unreal and CryTech do not use ray tracing for rendering. \$\endgroup\$ Dec 7, 2011 at 21:10
  • \$\begingroup\$ In most realtime situations like games, raytracing is not used. There have been some interesting projects using raytracing, but it is still too computationally intensive. However, sometimes raytracing is used in limited amounts, such as line of sight calculations, curved mirrors, ambient occlusion/lightmapping, collision detection and occlusion culling. Also, you can use rasterisation as a first hit calculator. You rasterise position/normal/objectID into buffers (like deferred rendering), and then continue the slower raytracing calculations from there for reflections/refractions. \$\endgroup\$
    – DaleyPaley
    Jun 13, 2013 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .