Soft Shadows

Hi pro-rsoft,

the dowload link is no longer valid;

“The server could not be found”

with kind regards

Seems so indeed. I’m calling my hosting company to see what’s wrong. Should be up in a few days, I hope.

Hi pro-rsoft

pls could you re-collect al those softshadow resources. and put them online again. I’m quite desperate there seems that there are some different versions flying around the forum but what can not be found is
the final shadowManager.py these is a shadowManager.pyc around wich differs from the shadowManager.py

then the usage of the different .sha’s is also unclear

thx for your bearing with this me

hi pro-rsoft

I find that you have used base.cam as:

    base.cam.reparentTo(camPivot)
    base.camLens.setNearFar(1,1000)
    base.camLens.setFov(75)
    base.cam.setPos(-10,-10,15)
    base.cam.lookAt(self.teapot)

In panda’s manual, it mentions that base.camera is the plain node above base.cam, and usually can control base.camera instead. I am a bit confused here. Because if I change your code to

    base.camera.reparentTo(camPivot)
    base.camLens.setNearFar(1,1000)
    base.camLens.setFov(75)
    base.camera.setPos(-10,-10,15)
    base.camera.lookAt(self.teapot)

It does not work as expected. Is it because Shadow Manager has created some camera ? What is really going on ?

If I want to clean up the Shadow Manager, what is the code required to do so ?

I try this but it seems the camera is not restored properly:

      base.cam.node().setInitialState(render.getState())
      base.cam.reparentTo(base.camera)
      self.light.node().setInitialState(RenderState.makeEmpty())
      self.light.removeNode()
      base.graphicsEngine.removeWindow(buffer)

Yeah, it’s a very long time since I’ve touched that code. It’s indeed supposed to be base.camera.
I don’t really understand my own code anymore and I would have done it differently if I wrote it now, so I don’t know what’s going on.

After reading your reply, I feel a bit of frustration. The frustration comes from the fact that Panda seems capable to do a lot of good things, but how to achieve it can be a very long story.

Anyway, thank your very much for your help and sharings.

Ok, I find out a way to fix my questions.

If ever base.makeCamera is called, the new camera is automatically attached to base.camera. Reparent it to somewhere ever can avoid sharing the same base.camera with base.cam:
self.light = base.makeCamera(self.buffer)
self.light.reparentTo(scene)
The above is not required if base.cam is reparent to somewhere else already.

To clean up, I have the code looks like:

      base.cam.node().setInitialState(RenderState.makeEmpty())
      base.cam.reparentTo(base.camera)

      self.light.node().setInitialState(RenderState.makeEmpty())
      self.light.removeNode()
      base.graphicsEngine.removeWindow(self.buffer)

      if self.blur: ## to make an option to use blurX and blurY
          base.graphicsEngine.removeWindow(blurXBuffer)
          base.graphicsEngine.removeWindow(blurYBuffer)
          # and the corresponding cameras ...
          ...

oh no this download is broken too? First I can’t download the nature demo, now this one too!

Problems with my domain. It will be up again soon.

The site is back up, for a long time already.

I must say I’m highly annoyed by how often I see that the license of my code gets violated. I’m not someone to complain about this, but I must point out that if you choose to modify or use code with a big license notice at the top, you should at least read the license.

I’m in the progress of integrating shadows into Panda3D, and I also want to add support for soft shadows. ynjh_jo, am I allowed to use your soft shadow code, after modifying it here and there? (I also want to take advantage of shadow samplers, etc.)

Certainly the dot product should be cut off. Where the light can’t go, there’s no shading. Only the ambient color should be visible.
In reality, all the shading you will see in a shadowed area comes from a different light source, subsurface/ambient/atmospheric scattering, ambient occlusion or so.

Do whatever you want. Cutting it off is only matter of personal preference.

Sorry to take you all back to the beginning of this post, but I, like Birukoff, am making a game where I need normal maps and shadows. I know all about the limitations of using the autoshader so I would like to try the merging the two shaders together route somehow(pro-rsoft mentioned the posibility with just a little knowledge of CG). Has anybody succesfully made a shader that will do both? Or do I have to use multiple shaders simultaneously? I have looked at the tutorials and I feel comfortable enough tackling something bigger.

The future Panda3D 1.7.0 release will have support for shadows in the Shader Generator.

It’s still possible to use both these soft shadows and the shader generator, even though it’s slower than truly integrated shadows. Just render the scene twice, once with the shadow shader, and once with the auto-shader. Then, you can multiply both results screen-space which you render into a fullscreen quad.
Search the forums - I believe someone has posted a snipplet somewhere how to do that.

Cheers pro-rsoft,

I think I get what your saying. Basically you render the scene with auto shader so you can get normal mapping, then you render the scene with the shadow shaders and then somehow mix the two together? That’s where I wouldn’t have a clue. Is it kind of like rendering both to an off-screen buffer and then mixing the two? Any pointers?

Any idea when the next release of Panda3d is coming out?

May be you can check:
discourse.panda3d.org/viewtopic.php?t=5442

Yeah, I saw this too, but I was unsuccessful when I tried both rollingt70’s or sundaycoder’s codes to work. I am using version 1.6.0. I saw your examples too. Do any of them have shadows and normal maps working in the same scene? I am trying to make a 3rd person game with multiple lights and diffuse, specular and normal mapping. I don’t need anything else for the time being. Thanks for your help clcheung.

First you render both the main camera’s window and the buffer into a texture (base.win.addRenderTexture and buffer.addRenderTexture). Then you create a fullscreen quad in render2d. To that quad you apply both textures (two texture stages with MModulate mode).

1.6.2 is coming out soon, but 1.7.0 is still a long way from here.

The FilterManager is no longer set the auto shader by default in 1.6.0. If you set auto shader by yourself, the shader on the castercam will not work. So the shadow manager is broken in ver 1.6.0 or later.

Can’t help you too much as I am not able to fix it yet.

Just call setShaderAuto with a lower override value. Or, in the shadow manager, increase the override value of the setShader call.

I do not realize there is such a priority parameter there !

It is working well now !