attr_material in a shader


I’m trying to make a normalmap shader.

I want to use the material specified in the mesh.
But the parameter that i found in the panda manuel doesn’t seem to work.
“uniform float4x4 attr_material,”

void fshader( float2 l_texcoord : TEXCOORD0,

              uniform sampler2D tex_0    : TEXUNIT0,
              uniform sampler2D tex_1    : TEXUNIT1,
              //uniform sampler2D tex_2 : TEXUNIT2, 

              uniform float4x4 attr_material,

                out float4 o_color : COLOR )


 xxx.sha: unrecognized parameter name (uniform in float4x4 attr_material) 

how can i access the material from inside the shader if not by this line ?

The material is specified in the .egg and not by a setMaterial() does that change something ?

Is there a way to have a default values for attr_material if the material is not set, so that my shader still work ?


attr_material is a new addition as of panda3d 1.5.0.

  • Josh


how about:

uniform float4x4 dlight_x
 	X must be an DirectionalLight specified via a shaderInput. Row 0 is color, row 1 is specular, row 2 is model-space direction, row 3 is model-space pseudo half-angle.

does that work in panda 1.4 ? how the setShaderInput() must be done ?

why not just get 1.5.0 ?

No, that’s 1.5.0 too. Also, there’s a plight_x, and an slight_x, but I haven’t gotten around to documenting them yet.

Also - if you really do want to use the obsolete version of Panda3D, then you can download the manual snapshot from back then. It’s on the download page.

But don’t do that for reasons of stability. Panda3D is a very mature software system — there’s hardly ever any real instability. Some of the newest features might contain bugs, but I certainly wouldn’t expect anything serious.

I have download this 1.42 manual.
Thank for all the infos.

I’m in discussion with my boss to upgrade to 1.5. ( one of the problem is that we’re still in python 2.4 )