Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

How to implement soft shadows for omni directional (point) light. We use typical shadow mapping technique. Depth is rendered to texture cube and addresing is pretty simple then. Just using vector from light to fragments world position. It works perfectly. Until you want soft shadows. In our engine we use PCSS technique for spot lights. But for point light there begins troubles.

How to sample in 3D?

I developed technique when orthonormal basis is created from a direction and upvector (0,1,0). And then multiply sampling vector (something like this (1.0,i/depthMapSize,j/depthMapSize) with this basis. But this (of course :)) looks pretty bad for vectors near (0,1,0) and (0,-1,0).

I will appreciate any help on this.

share|improve this question
    
As this is still not solved i wish to let this question opened. Maybe someday i will post my solution because we really have to figure this out. But still i would be really glad for any ideas –  Notabene Dec 9 '10 at 21:53
    
Your question is really not clear to me. It sounds like you have implemented point lights by using a cube shadow map. Soft shadows using this technique are the same as when implementing shadows for directional or spot lights. Have you implemented soft shadows with a spot or directional light before? The principles are the same. –  Olhovsky Jun 5 '11 at 2:10
    
@olhovsky : Sure we have implemented typical PCSS, the problem of shadow cube map is that it is sampled using 3D vector and spot light shadow map is sampled in 2D... the problems is: how to sample in 3D while keeping similar fashion as PCSS in 2D. My orthonormal sampling basis produces artifacts but was proven that it works (but i believe that there is better solution). –  Notabene Jun 5 '11 at 22:20
    
Notabene: PCF filtering only softens shadow edges, and doesn't help you make better use of the shadow map resolution in light space. For that you need to also use a technique like PSSM/CSM. I've added an answer that elborates, where we can continue discussion. –  Olhovsky Jun 5 '11 at 22:58
    
In response to sampling the cube with a 3D vector: You just apply any shadow map technique you like to the 2D sides of the cube, and then sample all 6 sides, and blend between them appropriately. You can think of PSSM as giving you many cubes though, if you prefer to view it that way. –  Olhovsky Jun 5 '11 at 23:01
show 2 more comments

2 Answers 2

Well as a simple hack on your current technique, you could choose between two up-vectors based on whether your view vector is tending towards parallel with one.

It'd just be an abs, compare, and select in shader terms, so not much overhead - especially considering the sampling and blending...

share|improve this answer
    
Thanks for answer. I tried what you suggest before and you are right this helps, but produces some another problems. I think that my technique is dead end and i would love to find some new one –  Notabene Dec 7 '10 at 10:52
add comment

You are using a cube map to represent a point light's shadows.

In this case, it is roughly equivalent to having 6 spot lights joined together.

You need to perform the PCSS blocker search on each of the 6 shadow maps, to find a penumbra value for each shadow map (in the same way that it is done for a single spot light).

Then you simply blend between each penumbra value as you already do for the shadow mapping step that you have already implemented.

This can be optimized because a receiving object can be blocked by an object in at most 3 shadow maps -- so really only three PCSS blocker searches are required. However, get the simpler version working first.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.