PDA

View Full Version : Dual-paraboloid omnidirectional shadow mapping demo



Slang
01-04-2005, 10:47 PM
I have just released a techdemo of my own engine.
http://www.doomiii.jp/slang/flx_demo_pa_1_0.htm

It demonstrates the Dynamic Dual-Paraboloid Omnidirectional Soft Shadow Mapping using GLSL.
Please let me hear your opinions, questions or bug reports.

BTW, the demo version is still 0.8 because the penumbras of soft shadows are not blended well.

rgpc
01-05-2005, 12:24 AM
I get about 15fps on my gf5900 Ultra - AMD64 3200+ - but I don't get any shadows. The shadow maps don't include the pillars or the torus (so no shadows).

wizzo
01-05-2005, 12:55 AM
It's working great here (radeon 9800 pro 128 mo) at 45 fps in windowed mode.
Shadows are nicely soften, even if you can notice some blocky artefact when you're nose is on the wall.

I was so waiting for a flexion engine demo =)
Great job slang

wizzo

Slang
01-05-2005, 01:14 AM
Originally posted by rgpc:
I get about 15fps on my gf5900 Ultra - AMD64 3200+ - but I don't get any shadows. The shadow maps don't include the pillars or the torus (so no shadows).Unfortunately, I have no NVIDIA videocards to test it.
Sorry about that.

However, to make up for the issue, I made a movie of the demo.
http://www.doomiii.jp/slang/files/demos/dposm08.m1v

Please enjoy (though it's only 30 seconds).

Slang
01-05-2005, 02:47 AM
Originally posted by wizzo:
It's working great here (radeon 9800 pro 128 mo) at 45 fps in windowed mode.
Shadows are nicely soften, even if you can notice some blocky artefact when you're nose is on the wall.Yes, I'm working on the aliasing problem of the shadow maps.

Currently I'm using two 512x512 textures for shadow maps,
and another two 512x512 textures for blurred edge maps,
then I get 50 FPS on my ATI Radeon 9800 pro (Athlon XP 2800+).
But totally four 1024x1024 textures to avoid the blocky artifacts, I get only 20 FPS.

And also the DPOSM is a little heavy on R3x0 or NV3x because it requires vertex shader processing power
due to the transformations of all the vertices into the dual-paraboloid light space.
(These transformations are described in "data\shaders\dp_osm.vsh".
The shaders tell mush more than I speak in my poor English. :D )
However, I guess it runs 60 FPS or higher on NV40 and R420, though I don't have any of them.

You can run the demo in fullscreen mode by setting the commandline as "-fullscreen", by the way.

ZbuffeR
01-05-2005, 03:26 AM
No shadows on GFFX 6800. Only specular component seems shadowed (but shadow has hard edges).

By pressing F3 once, the dual-paraboloid shadow maps looks correct, same as the bottom picture in your page. Pressing a second time gives only a white quad.

As a side comment, even if the demo is pretty fluid (more than 20fps at 1280x960), the mouse moves does not seem fluid at all, it is very jerky.

The engine looks very nice, I hope you will find a way to make it work on all GLSL cards.

Slang
01-05-2005, 06:33 AM
Alright, I got email from NVIDIA and fixed bugs!
Now it should run correctly on NVIDIA-based videocards, I think.

Please download and try it again.
I'm very looking forward to hearing your opinions.


Originally posted by ZbuffeR:
As a side comment, even if the demo is pretty fluid (more than 20fps at 1280x960), the mouse moves does not seem fluid at all, it is very jerky.Yes, I'm understanding the problem and now working on it.
Please wait for the updates.

EDIT: Also changed the mouse movement smoothly.

Slang
01-05-2005, 09:05 AM
Oops! Looks like still bugs in there.
And I've just fixed'em and released the version 0.84.

This time I bet! :)

Adrian
01-05-2005, 09:34 AM
That hasn't fixed it I'm afraid. I'm getting the same problems as ZBuffer on my GF5900.

zed
01-05-2005, 10:30 AM
runs ok on a gffx5900 70.90

And also the DPOSM is a little heavy on R3x0 or NV3x because it requires vertex shader processing power
due to the transformations of all the vertices into the dual-paraboloid light spacedid u try offloading some of the work from the gpu to the cpu? im speaking from my experiences (yes i know all the docs mention let the gpu as much as possible but they would say that wouldnt they?)

knackered
01-05-2005, 11:03 AM
With good reason, as all the time you spend processing render data on the CPU is time the GPU could spend actually rendering it, unless you double-buffer it, which then reveals the problem of memory consumption and management. And that's aside from the non-trivial cost of transferring that amount of vertex data to the GPU every frame.

dorbie
01-05-2005, 11:32 AM
The fact is there's no "one answer fits all" solution to the gpu/cpu load ballancing question.

MZ
01-05-2005, 11:54 AM
GF5200 66.93, still doesn't work.

Actually there is very, very pale, barely visible shadow for short moments when light is far from viewer and behind pillars (shadow oriented towards viewer). Too difficult to even tell if it's soft or hard. This happens in all versions I downloaded, the only thing that has changed is there are no GLSL compiler errors anymore.

mogumbo
01-05-2005, 01:26 PM
Hi slang. dposm084 on 6800GT 6.6.9.3. I think I'm seeing what MZ is seeing. The shadows aren't anywhere near as well defined as the ones in your mpeg. And they don't always appear to be in the right place. For example, sometimes a torus casts a shadow on the floor when it should be casting a shadow on the wall. They look aliased to me; not soft. Let us know if there are any specific tests we can try to help you out. I'd like to see this work on my machine.

V-man
01-05-2005, 01:54 PM
This dual paraboloid method requires tesselating the geometry right?
It's not bad, but the shadow edges look shaky.

I'm getting about 36 FPS on R9500 128MB Cat 4.12 Athlon XP 2800+, 512 MB

I'm also getting errors

GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW
GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW
GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW
GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW
GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW
GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW
GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW
GL ERROR - Function glPopMatrix() generated error GL_STACK_UNDERFLOW

Slang
01-06-2005, 12:19 AM
Version 0.85 is now available.
But I'm not convinced this is gonna work correctly on NVIDIA cards...


Originally posted by zed:
did u try offloading some of the work from the gpu to the cpu?Well, it is not possible to calculate the dual-paraboloid transformation in CPU
because the texcoords used to fetch the shadow maps are needed to be calculated per-vertex.


Originally posted by mogumbo:
Let us know if there are any specific tests we can try to help you out. I'd like to see this work on my machine.Thank you.
Okay. Could you send me or upload a screenshot of the issues you've got?
Because I'm not good at understanding English, you know. :D


Originally posted by V-man:
This dual paraboloid method requires tesselating the geometry right?
It's not bad, but the shadow edges look shaky.Yes, the geometry of the scene is must be tesselated well
in order to transform into the dual-paraboloid light space.

I'm not using any anti-aliasing to the shadow maps
so the soft shadow are somewhat jaggy when you are close to them.

EDIT: New version 0.86 is now available. I'm so sorry, again and again...

Slang
01-06-2005, 08:05 AM
I've released the version 0.87.

If you still have problems on NV-based videocards,
I'm sorry that there's nothing I can do any more without NVIDIA cards.
(Doesn't NVIDIA have the surplus of NV40? :p )

Anyway it runs really correctly on ATI cards.
So, if you are an ATI user, please enjoy!

mogumbo
01-06-2005, 10:05 AM
http://www.reallyslick.com/dposm087_1.jpg

The shadows are pretty faint in this screenshot, but you can make them out if you look closely. They aren't at all like what you have in your mpeg.

Slang
01-06-2005, 11:07 AM
Originally posted by mogumbo:
The shadows are pretty faint in this screenshot, but you can make them out if you look closely.So, basically you've got shadows on the scene at least?
Then please try this out:

1.) Open the "data\shaders\dp_osm.fsh" shader file using notepad or something.
2.) Comment out the following codes.


vec4 disco = textureCube(DiscoLight, CubeTexCoord);

vec4 d = (LightType > 0) ? disco : vec4(1.0);
float k = (depth > shadow) ? blur : 1.0;
float s = (depth > shadow) ? 0.0 : 0.35 * specular;

gl_FragColor = d * k * (diffuse * base + s) * atten + ambient;3.) Then, copy and paste the following codes to the end of the main().


if (depth > shadow)
gl_FragColor = vec4(0.0);
else
gl_FragColor = vec4(1.0);4.) Finally, save it and run the demo again.

If you get the result like this:
http://www.doomiii.jp/slang/images/osm_demo_04.jpg

then the depth comparison is okay. In other words,
the shadow maps are fetched correctly in the fragment shader
and also the texcoords are calculated correctly too in the vertex shader.

Otherwise, the issue is caused by the shadow map feching or texcoord calculation.

However, even if the depth comparison is no problem,
there may be problems in the blur filtering shader or the edge detection shader.

Anyway, please try out above at first and let me know what you get.

mogumbo
01-06-2005, 11:43 AM
I almost get that same result. But I only see shadows on the near side of the light source. There are no shadows on the other side of the light. It's as if only one parabaloid is being used.

If I toggle on the shadow maps, the first shadow map looks fine, but the second is all white. Some black pixels flicker into the white occasionally, but most of the time it's just pure white.

gulgi
01-06-2005, 11:45 AM
Without that change to the fragment shader the shadow "worked" on in the sense that there was no specular lighting where the shadow should be.

With the modified fragment shader it looks just like your screenshot.

Good luck! :)

(GeForceFX 5800, 67.02)

gulgi
01-06-2005, 12:04 PM
I tried it a bit more, and it's the blur variable that always seems to be 1 (or close to it).

If you change the line:
float k = (depth > shadow) ? blur : 1.0;
to:
float k = (depth > shadow) ? 0.0 : 1.0;
it looks correct (and jaggy ;]).

Slang
01-06-2005, 08:55 PM
Thanks very much for your feedbacks, mogumbo and gulgi.

As gulgi pointed out, it seems that
the blur filtering shader is the suspect!

But it's pretty strange because
the ForceWare driver compiles the shader correctly.
And of course, the Catalyst driver also does it, too.

Anyway, I "arrested" it for some questions and
just released the new version 0.88.

Could you try it out?
And please let me know whether it works or not.

Slang
01-06-2005, 09:23 PM
Oh, I just got email and heard that...

Now it should run correctly on NVIDIA videocards!!!

I'd like to express my gratitude to all people who helped me at this forum and emails.
Thanks again! :D

BTW, do you think that this DPOSM will be a major shadowing technique in the near future?

John Carmack decided to replace shadow volumes with shadow mapping in the next id's project.
And it is clear that a dynamic omnidirectional-shadowing technique must be needed in the games.

I think that this DPOSM will be one of the practical and robust solutions for that.

zed
01-06-2005, 11:40 PM
vs traditional point shadowmaps

pros
- less render targets
cons
- objects must be greater tesselated
- lesser visual quality
- not as simple

so ild say theyre roughly equal (though havent tested both methods fully, to see which method does give the best performance, i may do this next week (dont hold me to that though))

Ysaneya
01-07-2005, 12:41 AM
Honnestly, i don't think DPOSM will be the "major" shadowing technique. Because of the deformations, it requires a heavy tesselation, which makes it unsuitable for games that already have a high polycount. You'd need to tesselate all the walls and large flat areas.

Personally i prefer to use cube maps. The main drawback with cube maps is the update time, since you basically need to update 6 views instead of 2 in DPOSM. But using a cache system and a priority queue (only updating the most important cube maps per frame), it's possible to get pretty good framerates. Applying the cube map to the scene is also much more simple since there is no need for any projection of any sort.

You can see it in action here: http://www.fl-tw.com/Infinity/Docs/Demos/et_corridor_ppl_11.jpg
http://www.fl-tw.com/Infinity/Docs/Demos/et_corridor_ppl_14.jpg

Y.

knackered
01-07-2005, 01:33 AM
Beautiful pictures, Ysaneya.
I have to ask - what tesselation scheme are you using in your terrain videos?

Chuck0
01-07-2005, 04:11 AM
Demo Runs fine on an Radeon9700pro.

About the matrix stack underflow... i had some problems with a project of mine as well on nvidia cards because i missed doing correct matrix pushing and popping. ati cards are probably more lenient in this respect while nvidia cards seem to tend to produce quite strange behaviour if the matrix stacks arent handled correctly (in my case texture fetches in a fragment program produced qutie strange results).

OT:
Also just downloaded the terrain videos from Ysaneya and all i got to say is wow :) ... i already thought about implementing dynamic fractal terrain generation to render whole planets but never found the time to really start this project. So its just great to see, that it does work really well and generates wonderful results.

mogumbo
01-07-2005, 06:32 AM
Now it works on my 6800GT. Good work slang. Is there some difference in the way ATI and NVidia implement GLSL that was causing the problem?

Slang
01-07-2005, 06:56 AM
Originally posted by Ysaneya:
Personally i prefer to use cube maps. The main drawback with cube maps is the update time, since you basically need to update 6 views instead of 2 in DPOSM. But using a cache system and a priority queue (only updating the most important cube maps per frame), it's possible to get pretty good framerates. Applying the cube map to the scene is also much more simple since there is no need for any projection of any sort.Yes, certainly the DPOSM requires well-tessellated scene
in order to transform into the dual-paraboloid light space.
But it has the advantage of the ease of doing soft-shadowing.

Though the quality of soft shadows in my demo is not good,
however, you can do soft-shadowing using only 4 textures with the DPOSM.
Two shadow maps, and another two blurred edge (silhouette) maps.

To tell the truth, I haven't implemented the cube-mapped omnidirectional shadow mapping (CMOSM?)
but I think that it is too expensive to do soft-shadowing using the CMOSM
because you need totally 12 passes (or more?) to do it.

And the CMOSM doesn't requires any vertex transformation but
it is commonly needed in the both DPOSM and CMOSM
to visualize the distance between the vertex and the light source
because, you know, currently it is impossible to store the depth values into textures directly
due to the non-support of GL_DEPTH_COMPONENT format with GL_TEXTURE_CUBE_MAP.

So I think that it is almost equal performace;
to transform all the vertices into the dual-paraboloid light space
and store the depth into 2 textures and;
to visualize the distance between the vertex and the light source
and store the result into 6 textures.

Anyway, your screenshots are pretty cool. :cool:
I gotta implement the CMOSM too and see which works better.

(And sorry for my poor English. I usually speak Japanese.)

Slang
01-07-2005, 07:19 AM
Originally posted by mogumbo:
Now it works on my 6800GT. Good work slang. Is there some difference in the way ATI and NVidia implement GLSL that was causing the problem?I'm glad to hear that.

Well, the issue was caused because I had forgot to turn the texture units off. :eek:
So after all, there was no problem in my shaders but main programs.

I'm sorry that I made such a disturbance to you all people here.

SKoder
01-09-2005, 08:32 AM
Seems like I just found a bug:
ScreenShot (http://evolution.times.lv/Bug.jpg)
It's appears when two shadows being connected.

Hampel
01-09-2005, 09:16 AM
@Ysaneya: what navigation controls have you used to record this smooth animation? Cursour keys & mouse & ...? How do you influence the flight speed, direction, ...?

Slang
01-09-2005, 11:04 AM
Originally posted by SKoder:
Seems like I just found a bug:
ScreenShot (http://evolution.times.lv/Bug.jpg)
It's appears when two shadows being connected.That's why the demo version is NOT 1.0.

Well, it cannot be avoided that the artifact emerges with the current silhouette detection algorithm.
So I'm now doing research on another algorithms to solve that.

Do you have any ideas?

Ysaneya
01-09-2005, 12:25 PM
That's a bit OT so i hope nobody will complain, but here are some answers about my planet engine:

knackered:
I have to ask - what tesselation scheme are you using in your terrain videos?Geomipmapping with 33x33 patches. The LOD calculations are basically done in "flat space" (ie. a plane), which is then later distorted to a piece of a sphere. A whole planet is made as a cube (6 "faces") deformed into a whole sphere. This avoids distortions at the poles.

The heights are calculated by 18 octaves of Perlin noise, which i'm in the process of improving now (it's far too repetitive at the whole planet scale).

The LOD engine is pretty fast. When geomorphing is disabled and polycount upped, i get up to 70 millions triangles per second on a P4 2.8 Ghz + Radeon 9700.

Chuck0:
So its just great to see, that it does work really well and generates wonderful results.Thanks, but that's still very far from what i'm trying to do. What is shown in the video is the geometric engine. It's missing lighting/shadowing and texturing. It's also lacking the atmosphere, the details (vegetation), the water, the clouds, etc.. I hope to get something half-decent in the next 6 months. If i succeed i'll post a newsbit here on OpenGL.org.

Hampel:
what navigation controls have you used to record this smooth animation? Cursour keys & mouse & ...? How do you influence the flight speed, direction, ...?In real-time, movement is newtonian based (your typical rigid body physics). To record the path i press a key, which adds a "waypoint" to two splines (one for position, one for view direction). When recording the AVI, the splines are simply played back, independantly of the framerate (which suffers a lot due to writing the video to the disk).

Y.

zed
01-09-2005, 10:30 PM
Geomipmapping with 33x33 patches. The LOD calculations are basically done in "flat space" (ie. a plane), which is then later distorted to a piece of a sphere. A whole planet is made as a cube (6 "faces") deformed into a whole sphere. This avoids distortions at the poles.yeah but bunches them up in the corners ;) , (joking) they can be minimized


The heights are calculated by 18 octaves of Perlin noise, which i'm in the process of improving now (it's far too repetitive at the whole planet scale).perlin noise, whilst giving sort of acceptable cursory results doesnt really cut it compared to how real terrain is generated eg glaciers/vocanic/sesimic activity, do u know of any better looking (but still reasonbly fast) methods. please dont mention vterrain.org

Ysaneya
01-10-2005, 02:09 AM
yeah but bunches them up in the corners ;) , (joking) they can be minimized
Yeah that's true :) But you know, at a planet scale, the chances to land near a seam where it's visible is pretty small.



do u know of any better looking (but still reasonbly fast) methods. please dont mention vterrain.org
Texturing and Modeling: A procedural approach, is giving some pretty good hints. Their multifractal terrain is looking quite good i think. Check out their Gaia zoom at http://www.kenmusgrave.com/animations.html

Although multifractal gives better results than pure noise, i do believe it's only good for terrains at the kilometer level. At the planet scale, you must take into account different things, like the latitude/longitude, probability to have deserts of sand/ice, temperature, humidity, etc.. I do not have a precise answer except that i believe the best solution would be a combination of planet-scale parameters, multifractal, and then noise for ground details.

Y.