hi please i have an example to show me the best way to draw shadow mapping
Here is an adaptation of Cascaded Shadow Maps NVIDIA
Shadow mapping depends on shaders and FBOs. If you are familiar with these concepts, shadow mapping is relatively easy to implement.
I've obtained good results using this tutorial: Soft shadows with VSM. The original paper is also useful as a reference.
I have simple shadow mapping in my old csat engine (http://www.opentk.com/project/CSat) but I suggest that you write your own, it's not so hard to do (first draw your scene from light, to fbo, and only z-values, then draw your scene from camera and compare if pixel is invisible from light (shadow) or not).
And later use CSM or PSSM so you can use directional light (sun).
Aactually if using light frustum when render from light, it does directional light (used it in my xsat-engine (xna+monogame project, its sourcecodes isnt available yet).
thank you for all suggests but how can i compare Pixels between Camera Position and light position this is my code when read pixel
byte pixel = new byte;
int viewport = new int;
Gl.glReadPixels(x, viewport - y, 1, 1, Gl.GL_RGB, Gl.GL_UNSIGNED_BYTE, pixel);
pleas i need a simple example
pleas it's so important for me
You perform the comparison in a fragment shader, not GL.ReadPixels().
There is some example code here and here, but unless you know how to use shaders and FBOs (render-to-texture), this is not going to be very helpful.
You really need to know how to use shaders before you implement shadow mapping.
Site design by Stefanos A. Icons courtesy of gnome-colors.