Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
Better forget about normal shadow maps and try to get shadow volumes working. Shadow maps have too many drawbacks to be really usefull in most scenes. The worst thing about them is getting the values for polygon offset right, cause they are different for all scenes.
There are techniques like perspective shadow maps that decrease the drawbacks of that technique for general use, but those techniques are really hard to learn/implement.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
The error must be somewhere in the matrix calculation and order of matrix values, but i cannot seem find the problem.
Sascha Willems: The advantage of doing shadows this way is that it is hardware accelerated. There is no need to calculate geomtry on the cpu. (have a look at the tutorial).
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
I know that. I have a working sample on that on my homepage (including source, so you may look at taht), but as I said it's no general purpose technique, as you always have to tweak the values for glPolygonOffset depending on how your scene looks like, or you'll get nasty artefacts. But what makes things even worse is the fact that these values not only differ from scene to scene, they also may differ from gfx-card to gfx-card. On top of that, you need depending on the scene mostly a huge texture for the shadow map, and the bigger the part of the scene gets thats shadowed by the shadow map, the worse aliasing gets. That's because the huger the scene get's, the huger the part that's covered by one texel of the shadow map. And last but not least : Filtering for shadow maps is different on different cards. Where NVidia cards do a nice filter, so that the edges of shadow maps look almost smooth, ATI cards don't do filtering at all (cause they can't of a hardware limitation). This means that your result looks totally different on NVidia compared to ATI.
So to make it short : If you want shadow maps for general purpose, use perspective shadow maps. But I suggest you go with shadow volumes.
Shadows from shadow maps are ugly and suffer from aliasing. You have to render six views for a pointlight. That's slow because of the switch to the pbuffer context. You can copy from backbuffer, but that forces you to render all the lights before the scene and to store 6 highres shadowmaps pre light. The only chance to get acceptable results is filtering in a fragment program. The problem with Radeon cards is, that the max. length of a fp is very limited and they don't even support texture filtering on shadow maps. You can emulate this filtering but it costs you 4 texture accesses and 10-20 arithmetric instructions. Applying a 8x8 random blur filter to the unfiltered shadow in screen space looks also very good, but it's too slow to be usefull today. The problem is, that the shadow is pass is usually only one pass during the rendering of a complex scene. I added soft shadows to Sascha's Demo for testing.
The edge detecting on CPU is not really a problem. You don't need millions of polygons if you use complex shaders and with z-correct bumpmapping the stencil shadows are also z-correct automatically.
Polygon Offset is not necessary if you render the backfaces only.
BTW if you don't need self shadowing for objects, it's entirely sufficient to use a simplified mesh for stencil shadow generation (just have a closer look at the shadows in Morrowind ).
Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast
Du darfst keine neuen Themen in diesem Forum erstellen. Du darfst keine Antworten zu Themen in diesem Forum erstellen. Du darfst deine Beiträge in diesem Forum nicht ändern. Du darfst deine Beiträge in diesem Forum nicht löschen. Du darfst keine Dateianhänge in diesem Forum erstellen.