Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
I know that switching depht compare function in a frame turns off depth optimizations on Radeon 9500 and up, but in my case it haven't had a noticeable impact on the framerate.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
Just found out that ~0 means not 0. Maybe that gets things working...
EDIT:
Yes now it works!!!! It was the stencil function that was wrong.
This means there is also a bug in dglopengl in the way tgluint (and gluint) is defined. It should not be cardinal, but integer!.
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
This won't work :
glStencilMask(not 0),
but this will
glStencilMask(Byte(not 0)) or glStencilMask(255).
I guess you used the first one, but in that equation it does an integer-not which will result in a negative. You you must either explicit set 255 or use a "hard" typecast to byte.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
i got that working. I am still not happy with the framerate however. It goes way down.... Basicly i get 1/10 of the original framerate..... Is that supposed to be normal. Maybe for a scene with a static light i could put the shadows in a displaylist for static objects.
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
What hardware are you using. As I said the hit on the framerate is normally big, but it should not be that big. In a current demo, I render a huge racetrack with a terrain and my framerate is still > 50 fps most of the time. That's about half of what I get without shadows. One thing you should do is to calculate and extrude the shadowvolumes only when the light moves, that'll take much work off the CPU.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
you are right, i am testing in a worst case scenario with a moving light that moves every frame. Also i can try optimizing the shadow render routine. It starts with:
Code:
for i := 0 to FNumIndices DIV 3 - 1 do
if Ffaces[i].visible then
for j := 0 to 2 do
begin
k := Ffaces[i].neighbour[j];
if (k = 0) or (not Ffaces[k-1].visible) then
begin
then it renders the shadow by calculating 2 new points. ((vertex - lightpoint)*100)
There is not much to get or i should make a new list storing the result of the first path during visibility calculation, but then that also needs to be done after the light changes. So i don expect speed advantages there.
BTW my videocard is a geforce ti4200 and my pc has a p4 running at 2.4ghz
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
Could you download this shadow volume demo (~300k) and take a look at the framerates? It's one of my first shadow volume tests that uses almost the same scene as you, so you can see how shadow volumes impact on performance and see if your demo performs good. This demo also calculates the shadow volumes every frame. Some keys :
r - toggle shadow volumes on/off
v - show volumes
s - show silhouettes
z - switch between zPass (which is default and gives errors when you enter the volume) and zFail
Cursor left/right - Rotate scene
+/- - Zoom
Performance on my Radeon 9700 (no AA/16xAF, defatult window size and start view) : With shadows (zPass) = 200 fps, without = 250 fps.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
hmmm, again something unexpected:
On pressing r the scene only darkens, but no shadows, and the framerate goes up to 360 from 240 initial.
On showing volumes framerate goes back to 188-230.
EDIT:
Scene with my test program:
Normal rendering (no Shadows, one pass): 388 fps
Rendering with volume shadows: 60 fps
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
That's about normal. Pressing r turns off the shadow volumes, so your FPS-increase sounds right to me. So it really seems you do something wrong in your demo if you don't get the same performance.
Registriert: Di Jul 01, 2003 18:59 Beiträge: 887 Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
i split one procedure in 2 so the face vicibility is now calculated once, now the scene with shadows renders about 135fps. Still no 188 but it is better now.
Code:
side := FFaces[i].Plane.a*lp.x + FFaces[i].Plane.b*lp.y
Registriert: Di Nov 26, 2002 22:12 Beiträge: 259 Wohnort: Dresden
I’ve the same problem like noeska. I cannot see any shadows. If I press “r” the scene becomes a little bit darker, but there are still no shadows.
The text message in on the screen says that the depth of the stencilbuffer is zero. Maybe it’s a hardware specific problem or there is a bug in your code.
_________________ Nichts auf der Welt ist so gerecht verteilt wie der Verstand. Denn jederman ist überzeugt, dass er genug davon habe.
Rene Descartes, frz. Mathematiker u. Philosoph, 1596-1650
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
Oh, I guess you both have NVidia-cards, am I right? It may be the case that I accidentely left over some ATI-specific code and the demo still uses GL_ATI_separate_stencil even if it's turned off...I'm gonna take a look at it and upload a new file if I find the error.
But the stencil = 0 is very suspicous and shouldn't happen. Do you both have your desktops set to 32 Bit?
Registriert: Mo Sep 23, 2002 19:27 Beiträge: 5812
Programmiersprache: C++
Please try this new exe. I forgot (back in that demo, it's old and was one of my first steps with stencil shadows) to explicit request a stencil buffer. But most cards (at least ATI) automatically give you 8 stencil bits if you request 24 bits of depth under 32 bits of colordepth.
Mitglieder in diesem Forum: 0 Mitglieder und 3 Gäste
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.