Sign in to follow this  

Simple shadows using a list of objects?

This topic is 4202 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

Hi, a friend of mine and I are making a game, we're finishing with the graphic engine, we used a list (template class of the STL, you know) and we'd like to proyect shadows into the terrain... could you tell me an easy way of doing this? Thanks in advance :)

Share this post


Link to post
Share on other sites
Quote:
Original post by n4x0
Hi, a friend of mine and I are making a game, we're finishing with the graphic engine, we used a list (template class of the STL, you know) and we'd like to proyect shadows into the terrain... could you tell me an easy way of doing this?

Thanks in advance :)


There is no easy way to do shadowing, however I think the easiest way is using projected textures.

It is a technique of rendering the scene from the light's point of view and then saving the depth values.

Then when you render the real scene the pixel on the monitor is mapped through matrix transformation into uv coordinates and you do a simple check to see if it s shaded.


This is the easiest because it requires no extra coding like extruding triangles and stuff

Share this post


Link to post
Share on other sites
Thanks, I know shadowing is complex, and not easy, but I wanted to know what is the easiest way of making shadows when having a list of objects. With list of objects this is what I mean:

vector<object*> objects; // List of instances of the class 'object'

void DrawObjects(void)
{
for (vector<object*>::iterator Iter = objects.begin(); Iter != objects.end(); Iter++)
(*Iter)->Draw();
}

That's the way I do the drawing... so I wanted to know what are the easiest steps I have to do to make shadows. I guess I've got to include a flag in the object to know if either it proyects a shadow or it recieves the shadow...

Thanks in advance [smile]

Share this post


Link to post
Share on other sites
Depends entirely on the realism of the shadows required and your object class.. If your object class is a bunch of triangles then doing a bruteforce volume shadows will be relatively easy but relatively slow.

I STill think the one mentioned above is the best because it is PROJECT/OBJECT independant and so you add glPrimitives and very complex objects without changing your shading technique

Share this post


Link to post
Share on other sites
Hi [smile] Thank you.

Actually my object class has just a model (which is an instance of a class that loads the model from an obj-file and contains all the polygons that have to be drawn), a texture, and a Draw function, that's all. So I ask what's the easiest way (I don't mind the realism...) to acomplish that. Something that can be called like... object->DrawShadows(); ... or something like that. What is the easiest type of shadows I can use?

Share this post


Link to post
Share on other sites

This topic is 4202 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.

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