Sign in to follow this  

basic shadows

Recommended Posts

For a project I am doing, I have a height map which has trees scattered across the ground. There is also a car that can drive across the ground. My problem is that I need to have the trees cast shadows onto the terrain. There is a specific way I've been asked to do this (bear with me, I swear I am not asking anybody to do my homework for me). In order to avoid the complexities of having to cast a shadow onto the curved terrain, we are to first render the shadows (cast by the moving sun) to a flat plane of size (64x3)x(64x3). The actual height map is 64x64, so we are supposed to average the color values for a 3x3 square from that plane, and darken the appropriate point on the heightmap when rendering in order to create the appearance of a shadow. I've been able to successfully render the tree and car shadows to a plane using glMultMatrixf(). What I can't figure out is how to render that plane to a 2dimensional view so that I can pull out the shadow information. I think I need to use the ortho view, and maybe set the camera so it is looking directly down on the shadows from the positive Y axis, but what i cant figure out is how to make sure the entire map fits neatly into this (192x192) grid so i can just copy the information out as a bitmap. Could someone please help me out? I've been at this for quite some time. Any help is greatly appreciated. -Mike Quinn

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this