Shadows/Primary Visibility Question

Hi all,

I’m really just getting started with Panda3D (and loving it) but was wondering if it’s possible to cast a shadow onto an invisible object?

In Maya, you’d do this by turning off the primary visibility of an object, but still enabling it’s ability to receive shadows.

Is there anything in Panda which would allow me to do this? I’m thinking along the lines of a rotatable object demo which has a shadow but no visible floor plane.

Cheers guys.

Of course, with shader, but not the shader generator.

In the shadow sample, I replaced the original floor with this :

        cm=CardMaker('')
        cm.setFrame(-20,20,-20,20)
        floor = render.attachNewNode(cm.generate())
        floor.setP(-90)
        img = PNMImage(1,1)
        img.fill(1,1,1)
        tex = Texture()
        tex.load(img)
        floor.setTexture(tex)
        floor.setShaderInput('vis',0,0,0,0)
        floor.setTransparency(1)

and added :

        render.setShaderInput('vis',1,0,0,0)

Next, in the fragment shader, I replaced o_color line with :
A. if you want to use if statement :

  if(k_vis.x==1) {
     o_color = baseColor * (  shade * l_smooth + k_ambient.x );
  }
  else {
     o_color = float4( baseColor.xyz * (  shade * l_smooth + k_ambient.x ), 1-(shade + k_ambient.x));
  }

B. if you don’t :

  o_color = float4( baseColor.xyz * (  shade * l_smooth + k_ambient.x ),
                    k_vis.x*baseColor.a + (1-k_vis.x)*(1-(shade + k_ambient.x)));

and added :

             uniform float4 k_vis,

Thank you very much mate, I’ll have a play with that.

Looks like fun.

Cheers.