using raytracing to create shadows

I’m sure everyone knows that OpenGL doesn’t consider whether an object is obstructing another when it performs lighting calculations. Are there websites where I could learn how to implement ray tracing in OpenGL to create shadows in these instances?

If possible I’d like to find a source that teaches this at a beginner’s level.


OpenGL is for realtime graphics. You can not do ray tracing in real time.

OpenGL won’t help you if you want to write a raytracer. OpenGL is only able to draw some primitives and ignores what’s a light ray. But if you just want shadows, you can do it without performing raytracing. You just project one polygon over another and draw it in black. You could easily find books on this topic, for example, the superbible… On the internet, have you tried NeHe or flipcode ?

Originally posted by nvidia_linux:
OpenGL is for realtime graphics. You can not do ray tracing in real time.

Thats not entirely true, realtime ray tracing does exist but it is only the simple stuf done at ultra low resolution (160*100).

i was doing some raytracing the other day 256x256@10fps on my celeron. though it was only a simple antialiased scene with reflections/refractions traced 2 deep

If I’m right Black & White uses Raytracing.
And it’s quit fast.
Now about the shadows.
It can be done with acumulation buffer.

Originally posted by Maku:
If I’m right Black & White uses Raytracing.

I dont think it does - no. The engine was written about 18 months ago. It uses some very clever texture blending stuff, stencil buffer etc. But definately no raytracing. All, the effects such as shadows etc are pre-calculated. The possibilities of doing it dynamically were out of the question cos of the amount of AI stuff involved…

Hello. Im a man from the future. Realtime Ray tracing is a thing now. You can do that.
also you can use something new called DXR.