View Full Version : pointlight shadowmaps
08-18-2002, 02:44 AM
I finally found an example code for shadowmap implementon which is not 4500 lines long ( I have better to do that kill my self with those).
So, as I have understood, shadowmaps can only be used for spotlights to generate a depthmap and so on, but how to make shadows from a point light?
I have heard that it can be done using cubemaps (which I don't know really).
Does that mean simply that you generate 6 depth maps from every direction in the pointlight's of view and then handle them all? Six passes, doesn't that crash down the performance?
Secondly´: are shadowmaps better for hi-polygon model that stencil hadows then talking about speed?
What about when using shadowmaps with pointlights?
08-18-2002, 02:54 AM
highly flameable topic.
you can do it with cubemaps by rendering the six sides, bind this cubemap and use it. doing it on todays hw is a) quite overkill due the 6 passes and b) quite difficult due the normally quite lowprecision depthvalues. hacking that is difficult and not that useful as we soon have floatingpoint anyways..
using shadowvolumes on highresmeshes is rather simple, as there you normally be able to use the hw accelerated faked shadow volume. and the resolution of the mesh doesn't affect the fillrate by much => its not really slower to draw the volume (except if the mesh i so detailed that you can't draw it smooth anyways..)
my flameable opinion: shadowmaps are crap. they got much bether due the postperspectivespace mapping => much more detailed, but i still stay with shadowvolumes. they are now generic usable for all sort of (hard) shadows.
as long as i can't render directly in one pass on a cubemap i don't think about shadowmaps for anything but possibly some sweet spotlights (wich i rarely use..)
08-18-2002, 05:26 AM
Anyway, I'm a little bit interested about shadowmapping, so could you tell me more specificly about using cubemaps for pointlights.
08-18-2002, 09:15 AM
BTW, have any of you played/seen Hitman: codename 47 or incoming Mafia?
They have realtime soft shadows, any idea how they're done?
I got soft shadows (from characters) in Hitman with Gf2 MX, and I think the shadows are fast; up to 4 shadows from each character and no hit to performance that I could notice.
08-18-2002, 09:31 AM
possibly they just render the mesh in black onto the texture, and project that onto the world. due to bilinear filtering you get faked softshadows then.
i bet they don't selfshadow, do they?
08-18-2002, 10:15 AM
No. But could it be possible to project the texture also on the model so it could self-shadow?
08-18-2002, 10:35 AM
Check out my tutorial here: http://www.ronfrazier.net/apparition/research/advanced_per_pixel_lighting.html
One of the limitations of the method discussed in my tutorial is that you are limited to 8 bit precision. Since I wrote that article, I haven't yet had a chance to play with newer hardware. It may now be possible using 4 texture units and/or fragment programs to use much better 16 bit.
As a general note, personally I like shadow mapping a lot more than shadow volumes in the ideal case. However, I don't see it being very realistic to expect hardware to be able to handle these very well in games for at least a few more years. In a few special cases, it is just now starting to become reasonable, but not for the general case.
08-18-2002, 10:54 AM
What about new world order -game, there are some fine shadows, but I doubt they are realtime. What do you think?
08-18-2002, 03:50 PM
Shadow maps are pretty good, many examples suffer from poor "percentage closer filtering" or even no PCS filtering (which is central to the algorithm), and insufficient shadowmap resolution. Yes they are lower frequency as you move away from the light in some circumstances this is a GOOD thing not a bad thing.
08-18-2002, 05:39 PM
Hey! What shadowing capabilities does the Radeon 8500 have compaired to the GeForce cards? Could somebody list a couple shadowing sceems and tell what is good about each one? Which one is easiest to implement?
shadowmaps suck see shrek, toystory etc of sucky examples http://www.opengl.org/discussion_boards/ubb/smile.gif
to answer the original poster yes unfortunatley u will have to render the scene from various viewpoints (usually 6) when using shadowmaps. this normally creates a big speedhit, thus like stenciled shadows the more lights the bigger the hit. ouch. if u have a scene with heaps of lights u might be better with radiosity etc (though this usually runs like a dog also but doesnt have a problem with heaps of lights)
08-18-2002, 09:34 PM
sorry, dude, but i'm looking at hitman currently on the screenies all around the web. most pics dont have realtime shadows at all, and those _THAT_ have simply have stencil shadows (shadow volumes? one of them looks more like simple projected stencilshadow..)
have you some screenies that _PROVE_ that there are real shadowmaps wich work with depthtests? i dont think there are..
some of them has some "jagginess" in them, but i think they works fine.
addition: and yes, they are in realtime, even the 'multishadow.jpg' with 77 renderpasses ( due to the reflective balls )
[This message has been edited by Mazy (edited 08-19-2002).]
08-19-2002, 08:10 AM
Edit: Oh... Sorry zed, you were being sarcastic weren't you :-)
Mazy it's the jaggies that people object to and you can help there with bilinear filtering to give percentage closer filtering on the shadow map.
[This message has been edited by dorbie (edited 08-19-2002).]
08-19-2002, 08:59 AM
davepermen, I know for sure that hitman has soft shadows (only casted by characters), but as someone told they might be done so models are rendered to a texture as black and then it is projected on the environment.
Also in hitman there can be even 4 shadows from each character and their alpha changes.
08-19-2002, 10:00 AM
I don't know if this is interesting for you but I wrote an algorithm that takes a depthmap and uses a scanline algo to create shadow volumes in real time.
The depth map is then filtered by a "border shrink" filter (my own name) and then used to generate a second shadow volume and so on.
The number of shinks could be used proportional to the radius of the light source and you will get when you combine all shadow volumes a soft shadow in real time.
I have some sample pictures on my page..
perhaps not the best pictures but they illustrate that a fast extension in HW could be created to make the shadow volumes right on the HW without transfer the depth map to the CPU. This would give us soft shadows with a very easy implementation.
Even in my software version I get framerates about 50-100 HZ depdning on how many passes and how big the depthmap should be.
08-19-2002, 10:23 AM
ToolTech: Is it just me, or in that first picture, are the shadows of the 2 evergreen tree/bushes (the ones in front of the white car on the road) at a different angle from all the other trees? Nice images though.
08-19-2002, 10:35 AM
I think you are right. Those images are made by Pixxim in France, a customer of us that are using Gizmo3D.
08-19-2002, 11:18 AM
hey tooltech, i think you know that the new hardware supports displacementmapping... actually your shadowvolume is a displacement mapped quad, with the depthtexture as displacement, sort of, isn't it? just as hint for your future..
08-19-2002, 11:20 AM
Very nice images, ToolTech. Have you seen the paper "Shadow Volume Reconstruction from Depth Maps" by Michael McCool (http://www.cgl.uwaterloo.ca/Projects/rendering/shadow.html)? McCool uses an edge detection filter on his depth map to generate the shadow volume edges. Sounds similar to your approach?
08-19-2002, 11:47 AM
Yes. I did exchange some words with some NVidia guys about this issue 6 months ago but they thought at that time it would be difficult to realise, but the dpslacement map might be the perfect thing. Will check that ;-) Thanx..
The work I do is simillar to MCCool but the real trick I think is the way to use a "shrinking" image process to generate the simulation of soft shadow with umbra/penumbra fx. I have also made some image passes that takes care of the capping so you get perfect capped volumes without any problem as you walk into the volumes etc.. The algo is alsoe described on the web pages I have..
Will go and check the image displacement mapping now ;-)
08-19-2002, 12:35 PM
The original poster is confusing the point-lights and omni-lights. Omni-lights are point-lights, but so are spot-lights. Spot-lights require one depth-map, but omno-lights require up to 6.
Rendering the scene 6 times is not as bad as you might think. The set of things that have to be drawn is only the things that can occlude light falling on objects that the camera can see that are within range of the light.
You ussually do not have omni-lights that can 'see' anywhere near as much geometry as the viewer can see. This is because the omni-lights are ussually fairly short range, while cameras can ussually see all the way to the far plane. The far plane for a light is ussually very close.
Even if you do have to send your geometry to the card 6 times to draw a cube depth map, it still may take less time than rendering your whole scene from the camera point of view (for many reasons), especially if the light has a small range.
Your visible light occluder determination algorithm may even determine that no geometry is important in certain directions and make it completely unnecessary to draw 1 or 2 of the cube faces.
All this is discussion is pointless because no one can prove or disprove anything about the slowness of cube depth maps until depth maps are extended to include cube depth maps. I would believe stencil-shadow volumes to be too slow as well if I had not seen fast implementations. I can still hardly believe that Doom 3 will run at acceptable framerates.
The proof of the pudding is in the eating. So far no one can even make any pudding (hmmm, pudding). All we have is imitation color index shadow map pudding.... opps, be careful with metaphors, you might get hurt.
08-19-2002, 10:05 PM
Where can i find more info about the new hardware and displacement mapping ?
08-20-2002, 06:03 AM
Here is a start. Since Matrox is the only IHV with support right now, you may find more on their site.
EDIT: There is also an artists guide, and in the paper there is an e-mail address to get more (hopefully technical) information from Matrox.
[This message has been edited by Nakoruru (edited 08-20-2002).]
08-20-2002, 07:25 AM
Hey, blender, do you have a link to the sample you are referring to?
08-21-2002, 01:01 AM
Here's your shots: http://www.3dactionplanet.com/hitman47/hitman/screenshots/screens/rotterdam/16.jpg http://www.3dactionplanet.com/hitman47/hitman/screenshots/screens/budapest/10.jpg
But these doesn't show how the shadows are actually casted on more complex environment.
In the game it looks very realistic.
08-21-2002, 09:44 AM
thats just what i said, a projected shadow, rendered from the character. the other one doesn't have shadows, the other shadows look different, and the maincharacter doesn't selfshadow.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.