How to create fast and easy scene-independent shadows without shaders in OpenGL

Suppose I have a grid (for a sphere) in the center of the room, full of cubes and one light source. How can I make quick and easy shadow casting in OpenGL using only the "standard" (fixed) functions? Note: the result should also contain cubic and spherical shadows.

+6
opengl shadowing lighting
source share
3 answers

If you can create a silhouette of a sphere, you can use shadow volumes . The nVidia hardware also supported a fixed shadow display feature at a fair time.

Shadow volumes lack the very high fill requirements. Shadow maps may be better, but require an extra pass.

If you are projecting onto the same plane, it may be easier for you to simply project the object onto the plane .

+4
source share

There is no quick and easy way. There are many different technologies, each of which has its pros and cons. You can see the project that I am posting on github that uses very simple code to create shadow using the shadow volume technique (http://iuiz.github.com/VolumeShadow/). However, it is written in Java, but should not be ported to any other language.

The most important ways to create shadows are the so-called shadow matching method, where you visualize your scene (using a camera on a light source directed to each object of the shadow cast) on the texture. The second method is the shadow volum method (the famous Doom3).

+2
source share

I found one way to use StencilBuffers. For a while I was a little embarrassed, I finally realized that this most difficult thing would happen through every light source and project all the objects in the scene. It looks more beautiful than texturing and works faster than volumetric shadows. here and here - these are some resources that helped me understand the matrix step of multiplication (it confused me a bit when I was watching the demo version of the dinosaur). For me, this method is the easiest to understand and use. It remains only to decide how to calculate the multiplication matrix.

Although this method can be slightly modified using textures as shown here .

Thanks everyone! =)

+1
source share

All Articles