set_shadow_caster() issues (half the sreen blacked out)

Hi,
I got a serious issue with set_shadow_caster() since a few days. It all started when I was switching my Spotlight to a DirectionalLight, and I wasn’t able to resolve this issue.

Here is the basic environment and light setup:

  // Load the environment model & activate auto-shaders
  window->get_render().set_shader_auto();
  NodePath environ = window->load_model(framework.get_models(), "models/map/map");
  environ.reparent_to(window->get_render());
  environ.set_pos(0, 0, 0);

  //Add a sunlight
  PT(DirectionalLight) d_sun;
  d_sun = new DirectionalLight("Sun");
  d_sun->set_color(LVecBase4f(2, 2, 2, 1));
  NodePath d_sun_np = window->get_render().attach_new_node(d_sun);
  d_sun_np.set_hpr(-50, -60, 0);
  d_sun_np.set_pos(-200,-200,-400);
  d_sun->set_shadow_caster(true, 512, 512);
  d_sun->show_frustum();
  d_sun->get_lens()->set_fov(60);
  d_sun->get_lens()->set_near_far(600, 1000);
  d_sun->get_lens()->set_film_size(500, 500);
  window->get_render().set_light(d_sun_np);
  window->get_render().set_shader_input("sun", d_sun_np);

and this is what I get:

This black upper half of the screen seems not being influenced by my light. But it stays always at the same position in the Panda window. If I move my camera, I can see the parts of the map which were black before (because now they are on the lower half of the Panda window). If I add my ambient light, the upper half will only be influenced by this, the lower half by both. Although it seems to be that on the upper half, with my ambient light, there will be no bump mapping nor spectacular shader effects drawn. (see below)

So my question is: what the hell is this and how do I resolve it? =)

Thank you for your time.

Edit: I just realized, that this is a great way to do before shader effects/after shader effects shots xD

Try calling show_frustum() on the light, zooming out a little bit and making sure that the frustum is adjusted in such a way that it envelops both the object that casts shadows and the surface that it should project the shadow onto.

Well, it was. But for the sake of it, I put it in a little more obvious :wink:

Still no change =/

Wow, that’s gigantic. Have you tried a much smaller frustum, to see if that helps?

For the record, the set_fov line does not do anything (because it’s a directional light). It’s best to remove it.

I tried an a little bit smaller size (where the frustum is still covering the whole map and the panda) and this size: (even though the frustum is not covering the entire map)

d_sun->get_lens()->set_near_far(570, 760);
d_sun->get_lens()->set_film_size(50, 50);

No change.
Thanks for the fov hint :wink:

same issue here.

Hi

Others have this problem to, here’s a couple links:

[url]Shadow Mapping Not Working]

http://www.panda3d.org/forums
/viewtopic.php?t=10707