Paraboloid mapping in view space

Started by
18 comments, last by Viik 13 years, 11 months ago
That's actually good idea, indeed it's faster to just provide matrix with inverse view already in it.

Quote:How many lights are you targetting for this operation?

About 16 per fragment.
Advertisement
Trying to do another thing with paraboloids. Before, i've used them with VSM, right now it's not an option and at max what I can afford is a 2x2 PCF. Antoher limitation is the resolution of shadow maps that I need to keep quite small.

Issue that I'm having with small resolution shadow maps and paraboloid mapping look like this:
Photobucket
on the left side is a 2x2 PCF and non PCF is on the right. Both have very ugly shadow acne. Making bigger "epsilon" during depth comparison dosn't help that much, I still have shadow acne.

To my mind it's an issue with how depth values are stored in texture and how they measured in real time. Texture is a R32F, so precision should not be a problem.

During shadow map render, in vertex shader, vector from light's position to vertex is calculated and sent to pixel shader, where length of this light_to_vertex vector is taken and rendered into shadow map.
During shadow term calculation, in a similar way, vertex from fragment's position to light's position is build and it's length compared to one that is fetched from shadow map.
If you consider what you are doing with paraboloid mapping, I think you will understand why there is such surface acne. You are taking the depth information for an entire scene and stuffing it into two texture maps. This is very good for things that need a low resolution (like diffuse environment map lookup for reflections) and not so good for things that need high resolution (like standard shadow maps).

Have you tried to use a regular rectangular shadow map with comparable resolutions to see if the problem is really due to paraboloid mapping or if it is a fundamental shadow mapping limitation with the given resolution? I would venture to guess that the curved nature of the paraboloid, along with some interpolation issues with rasterizing, are exacerbating the resolution requirements for shadow mapping.

Just for testing, try using a super high resolution paraboloid map and see if the situation improves (i.e. is more responsive to the offset).
Quote:Just for testing, try using a super high resolution paraboloid map and see if the situation improves (i.e. is more responsive to the offset).

Using higher resolution does improves it. Basically if I set sm size to at least 1024x1024, for current scene bugs are almost gone. But the issue here is that my shadow maps will have resolution only about 128x128 or 256x256.

One of the reasons for such strong shadow acne can be because during shadow map render, vertices are mapped into parabaloid space, but during shadow term calculation fragments are used and they are mapped much closer to a "perfect" paraboloid than vertices. Maybe, somehow, I can map rasterized fragment to a paraboloid during shadow map render instead of vertices. Other way to solve this is a hardware teselation, but unfortunately I'm limited to dx9.0

Or maybe I just use VSM as I did before, it does hides most of the shadow acne bug.
Trying to output depth manually at the fragment level will only work part of the time, since the triangles are rasterized linearly... there is inevitably some fragments that will be left out, and that won't work well with shadow mapping.

Have you considered doing software tessellation? All you are trying to do is to have a shadow map generation technique, so you only need to interpolate the positions within the triangle, which should be fairly quick. You would only need to create the higher resolution geometry once for static objects, so it could be a realtime solution. What do you think?
Quote:Have you considered doing software tessellation? All you are trying to do is to have a shadow map generation technique, so you only need to interpolate the positions within the triangle, which should be fairly quick. You would only need to create the higher resolution geometry once for static objects, so it could be a realtime solution. What do you think?

Fortunately I'll be using paraboloid imperfect shadow maps, so linear rasterization of triangles won't be an issue. Just wanted to be sure that's indeed because of the rasterization and not the way how I store\measure depth in shadow maps.
Just cheked it with very small resolution (128x128) and exponential shadow maps. Works quite good, shadow acne is mostly gone and adding small prefiltering (fetche 4 texels of depth and divide sum by 4) alredy gives very smooth shadow term. In comparision, 2x2 PCF was looking quite ugly.
Quote:Original post by Viik
during shadow map render, vertices are mapped into parabaloid space, but during shadow term calculation fragments are used and they are mapped much closer to a "perfect" paraboloid than vertices


So why couldn't you just (during shadow term calculation) calculate the paraboloid mapping per vertex and use the interpolated value in your fragment shader for the shadow map lookup and depth comparison?
Quote:Original post by venzon
Quote:Original post by Viik
during shadow map render, vertices are mapped into parabaloid space, but during shadow term calculation fragments are used and they are mapped much closer to a "perfect" paraboloid than vertices


So why couldn't you just (during shadow term calculation) calculate the paraboloid mapping per vertex and use the interpolated value in your fragment shader for the shadow map lookup and depth comparison?

That is an interesting suggestion - I think it would work, and it would most likely be more efficient as well since you are calculating the paraboloid position in the vertex shader instead of the pixel shader.

Have you tried something like this before?
Quote:Original post by Jason Z
That is an interesting suggestion - I think it would work, and it would most likely be more efficient as well since you are calculating the paraboloid position in the vertex shader instead of the pixel shader.

Have you tried something like this before?


No, just a guess -- it seems most similar to the conventional shadow mapping way (i.e. do the matrix multiplication to get into light space in the vertex shader), and also since he was doing his shadow map generation pass that way it seems like matching it as much as possible during the lookup pass would yield fewer artifacts.
Because I'm using kind of a light pre-pass render and fragment position is restored from it's depth, so it's not interpolated from position of vertices.

This topic is closed to new replies.

Advertisement