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?
Oh, I forgot that alpha problem, but its fixed now.
The lightColor alpha parameter should be 0 (and not 1 )
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
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.
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:
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).
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.
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
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:
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).