Shadow technique for a Car

Started by
9 comments, last by robert_s 20 years, 6 months ago
Hi. I am working on a rally car simulator. I need to add shadow to my car as it is hard to tell if its standing on ground or not. See HERE I''ve read about shadows a bit and it looks as there are several methods to implement shadows. What shadow technique do you think is most appropriate to use for a rally car and not too expensiove in terms of processing? What techniques are used in real rally games?
Advertisement
BTW, that screen shot looks really nice! Congrats.

As far as what kind of shadows to use, it really depends on how accurate you want your shadows to be.

If you just want something that looks ok, you can use projection shadows. These types of shadows basically take your car geometry and project it onto a plane. Older style games used this technique because it wans''t very expensive and for most games, it was enough

If you want very accurate shadows, there are basically two types to techniques to choos from: Shadow Volumes and Shadow Mapping. I''m not sure of which technique rally games use but I think that Splinter Cell used Shadow Mapping. There are also some equally impresive games that have used Shadow Volumes. Each of these have good and bad points. For example, shadow volumes are expensive when it comes to geometry processing, and shadow mapping is expensive when it comes to pixel processing.

Do a search in the Graphics Programming forum for any of these: "projection shadows", "shadow volume", "shadow map" and you''ll see a lot of info. Shadows is a very common topic and I''m sure you''ll find plenty of info.

Hope this helps,
neneboricua
Cars don''t have much self-shadowing, so shadow maps or volumes are overkill really. Projected shadow textures are a good way for this. Basically just render your car to a texture from the point of view of the light, then project this generated shadow onto your track.
Thx. guys!
Yes, after reading about the two above techniques neneboricua19 mentioned ie. shadow volumes & shadow mapping, I think they''re a bit expensive for my app to handle at the moment as I have already quite low FPS (avg 70). Mainly caused by my unoptimized physics engine

neneboricua19 you''re right, there is alot of stuff on the above mentioned shadow techniques but I''m still having problems fining something on projected shadow textures. Do you guys happen to know some good tutorials or papers on projected shadow textures GrangyTang mentioned? Thanks
I don''t get one thing with projected shadow textures (because I couldn''t find much on this stuff).
1. Do I render my car to a texture every frame?
2. Once I have this texture should I apply this texture to my terrain mesh (multitextures) or I create a plane on which I apply this texture with alpha blending?

Sorry I am a bit confused how you guys do this stuff.
1. Usually every frame. You could render it every other frame if you wanted to save on speed (or cache it like imposters and only update it after the object or light have rotated/moved over a certain threashold.

2. Typically projected onto your terrain mesh. If you''ve got a texture unit to spare you can multitexture. Failing that re-render the appropriate section of the terrain with the shadow darkening the appropriate area.

I don''t really know much on the subject, but I may have a few ideas to consider when it comes to projection shadows.

The shadows themselves I think pretty much just depend on the position of the camera, and the position of the light source. That said, if your camera position is static, or at least is always at the same angle relative to the car, I see no reason why you couldn''t just render the shadow to a texture once at the beginning, and reuse it later. Furthermore, you could generated it once, write it to a file, and use that file instead.

If your camera is continuously bouncing around and revolving around your car (this is probably more realistic), you would probably have to generate it every frame, or even better, generate it only when your car, camera, or light source changes position.

A third possibility would be to render the shadow from a select few angles. However, this limits you to having some-what predictable camera, car, and light movements.

I hope I helped somewhat.. looking back it seems as though OrangyTang summed it up pretty well.

    ___       ___       ___       ___       ___       ___       ___       ___      /\  \     /\__\     /\  \     /\  \     /\  \     /\  \     /\  \     /\__\    /::\  \   /:/ _/_   _\:\  \   _\:\  \    \:\  \   /::\  \   /::\  \   /:/ _/_  /::\:\__\ /:/_/\__\ /::::\__\ /::::\__\   /::\__\ /::\:\__\ /::\:\__\ /::-"\__\ \/\:\/__/ \:\/:/  / \::;;/__/ \::;;/__/  /:/\/__/ \;:::/  / \:\:\/  / \;:;-",-"    \/__/   \::/  /   \:\__\    \:\__\    \/__/     |:\/__/   \:\/  /   |:|  |               \/__/     \/__/     \/__/               \|__|     \/__/     \|__|  
Thx . Fuzztrek. I roughly know as much as you as the name "Projected shadow Texture" is self explanatory.
There are some details you have to get from somewhere in order to develop it from scratch. Unfortuantely I could not find it in my books or on the net. Thus these questions.

ok. I have one more thing to ask, its about putting the shadow texture on my terrain mesh. I initially though that I should create a 2D plane onto which I should apply the shadow texture which would quite easy to transform. I know its wrong coze it would always be flat even on bumpy terrain.
So. you''re saying that the texture should be directly mapped on the terrain mesh right?
ok. now, each triangle in my terrain is 2 meters long. my car is 4.5 meters long. now how can you know while driving when to jump from one set of coordinate texture to another with my shadow texture. I guess I would have to update tex coords dynamically right?

Even if I could work out the new set of tex coords dynamically then I wil probably see my texture jumping from one set of polygon stripes to another set (on regular grid terrain). How about rotating the texture when the car turns? it sounds a bit weird.

Do you guys know what I mean?
How do you solve this? thanks in advance.
hehe. yes, I skipped the technical stuff and went right to the fun part (or at least, the fun part for me). Sorry :|
quote:Original post by robert_s
I guess I would have to update tex coords dynamically right?


Yup. See here.

This topic is closed to new replies.

Advertisement