Jump to content
  • Advertisement
Sign in to follow this  


This topic is 2911 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hy pals. Ok, I thought that I had learnt the basics about how to set my sources of light and so on. But unfortunately I have noticed that the objects in my scenario do not make shade each other. In the code below, the upper sphere does not shades the second sphere just below of it. What should I do inorder to get such effect?

Thanks in advance.

void display(void)
{ int i,j,f,k=0;
glutSolidSphere (0.2, 20, 16);
glTranslatef (0.0, 0.70, 0.0);
glutSolidSphere (0.5, 20, 16);
glFlush ();


Share this post

Link to post
Share on other sites
This requires a shadowing technique, for example shadow mapping or stencil shadows. Older games faked this by drawing a polygon that looks like a shadow under the object or similar, and newer games do it with GLSL shaders.

If you want the true effect without shaders, the following tutorials seem to do it.
For stencil shadows: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=27.
For shadow mapping: http://www.paulsprojects.net/tutorials/smt/smt.html.

I found these with Google, and searching for stencil shadows or shadowmapping tutorials will give you several hits. I would recommend learning GLSL shaders first however, as it will make it easier and more efficient to implement such techniques.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!