Parallel-Split Shadow Maps (PSSM): Shadows for large scenes

You’re right, I already figured there was some kind of bug because the shadow-nosupport.sha had the missing parameter. The shadows seem great, the only problem is that I was doing some changes in the alpha channel for my models that seem to have no effect when the shader is active. It seems like a tradeoff, but I wanted to ask if there is any way around this. Also, is there any way to make the shadowed parts of a model a bit more bright, without increasing the light’s overall brightness through the lightcolor parameter? Maybe that k_ambient parameter was in the shader for that reason?

Thanx fabiom, great work

Oh, I forgot that alpha problem, but its fixed now.
The lightColor alpha parameter should be 0 (and not 1 :stuck_out_tongue:)
And on the .sha files, I forgot to comment the line color.a = baseColor.a;

(I have updated the Roaming-Ralph code once again, so if you want, you can just download it again and get the PSSM folder from there…).
homepages.dcc.ufmg.br/~fmiranda/ … h-PSSM.rar

I also tweaked the Roaming-Ralph pssm parameters, so it’s looking better now.

As for the shadow brightness, I don’t see how you can do it without changing the ambient light intensity. The ambient light and the light intensity is applied to the whole scene (and not just to the shadows). If someone has any idea how to do it, feel free to suggest…

Doesn’t work for me. There is no shadow (or, better to say, it is so dark that hardly visible), and console prints this warning every frame: “:linmath(warning): Tried to invert singular LMatrix3.”
ATI X1600, driver 9.3

Looks like there’s something wrong:
pro-rsoft.com/screens/pssm.png

It seems like you have a scale set to 0 somewhere.

Also - see the ralph texture on the back wall? That back wall actually has no texture applied and still you’re reading from a texture. This gives undefined behavior, which make sense.

Also, it might be a good idea to support hardware PCF for the people who have it enabled.

Weird, it looks fine here and with no warnings. I will try to fix that…

I fixed the texture problem, and I will post the updated code later, once I solve all those other bugs.

I will also modify the code to support pcf and ‘try’ to minimize the visual difference between the code running on ATI and NVIDIA cards.

thanks

I get no warnings either and Ralph’s rendering seems to have improved here, except for that Ralph’s texture on the wall. Unfortunately the transparency thing doesn’t seem to work for me. The models seem at least partly transparent and are in fact invisible from some viewpoints but seem to pop up again if the camera moves to another place. Also, no apparent shadows exist even at alpha=1. I am using this code for transparency:

self.model.setTransparency( TransparencyAttrib.MDual  )
self.model.setColor(1,1,1,0)

and change the alpha from 0 to 1 to get a blending effect when changing between different models. Perhaps I’m using the wrong way (used to work without the shader however).

Still great though.
Thanx

I can run the latest one well on my Windows XP + 9500.

I find the shadow is quite hard. Is it possible to change the hardness of the shadow ?

fyi it doesn’t work when I try to run it. I’m guessing however the problem is one I can easily fix by making a few minor modifications to your code (to ensure the file paths are correct for loading the shaders.) For your reference here is the terminal session:

joseph-hockings-macbook-pro:~ jhocking$ python /Users/jhocking/Desktop/Roaming-Ralph-PSSM/Tut-Roaming-Ralph.py
DirectStart: Starting the game.
Known pipe types:
osxGraphicsPipe
(all display modules loaded.)
:gobj(error): Could not read shader file: PSSM/shadow.sha
Traceback (most recent call last):
File “/Users/jhocking/Desktop/Roaming-Ralph-PSSM/Tut-Roaming-Ralph.py”, line 274, in
w = World()
File “/Users/jhocking/Desktop/Roaming-Ralph-PSSM/Tut-Roaming-Ralph.py”, line 58, in init
self.pssm = PSSM.ParallelSplitShadowMap.ParallelSplitShadowMap(Vec3(0, -1, -1), lightsQuality = [2048, 2048, 1024], pssmBias = 0.98, pushBias = 0.03, lightColor = VBase3(0.125, 0.149, 0.160), lightIntensity = 0.8)
File “/Users/jhocking/Desktop/Roaming-Ralph-PSSM/PSSM/ParallelSplitShadowMap.py”, line 48, in init
self.setUpShader()
File “/Users/jhocking/Desktop/Roaming-Ralph-PSSM/PSSM/ParallelSplitShadowMap.py”, line 81, in setUpShader
mci.setShader(Shader.load(SHADER_DIR+‘shadow.sha’))
TypeError: NodePath.setShader() argument 1 must be Shader, not NoneType

Melinos,
Yeah, I noticed that alpha problem only now.
I will fix it soon and post the updated code (together with other bug fixes).

clcheung,
Right now, no. But I will insert pro-rsoft’s soft shadows later on (https://discourse.panda3d.org/viewtopic.php?t=4337).

jhocking,
I think that you have to set the SHADER_DIR variable (which is in the ParallelSplitShadowMap.py file) to something like ‘/Users/jhocking/Desktop/Roaming-Ralph-PSSM/PSSM/’

Actually, rather than hard-coding it I’m planning to do the file path bit from the top of the Advanced Cartoon Rendering demo (this addition is needed for a lot of demos when I try them.) I’m referring to the part that says:

Figure out what directory this program is in.

MYDIR=os.path.abspath(sys.path[0])
MYDIR=Filename.fromOsSpecific(MYDIR).getFullpath()

Or better, just add the path to the model-path, and you can then just load the files as if they were relative to the model-path.

fabiom, any update on your shadow map project? Looking forward to it :slight_smile:

Hi Melinos,

I’m finishing some other college projects right now. :frowning:
But I will get back to the shadow code soon. Maybe next week.

Dear Fabiom,

any update??

Looking very forward to it :laughing: [/img]

Hi martburg,

I almost forgot about the pssm code. It turned out that my game didn’t use it. The schedule was very tight, so we had to cut a few features. I then moved on to other things (cg related, but not game related).

BTW, here it is a trailer for the game: youtube.com/watch?v=uGhyuFQk9Ks
(without shadows, even on the cutscenes :frowning: )

What a pity! But it still has a nice look and feel

but did you finish the code?

cheers

Martin

No, I never got to finish the code.
The version I uploaded is pretty much the lastest version (with the bugs).

I may try to do something with it by the end of the year, but I can’t promise (from what I remember, the bugs were relatively easy to fix).

The files are gone. Anyone has it?

My old website is down, and I can’t find a backup of the files.
I guess the source code is forever lost :frowning:

rapidshare.com/files/401420275/R … M.rar.html :slight_smile: