wspos_eyePositionW brings panda to crash

hi,
if im catching the eyeposition

uniform in float4    wspos_eyePositionW,

i do get this error
->

AssertionError: Shader input eyePositionW is not present.
 at line 352 of c:\panda3d-1.7.0\panda\src\pgraph\shaderAttrib.cxx

Right, as expected. What is the question?

why is this line ->

uniform in float4    wspos_eyePositionW,

triggering this error ->

AssertionError: Shader input eyePositionW is not present. 
 at line 352 of c:\panda3d-1.7.0\panda\src\pgraph\shaderAttrib.cxx

does it works with 1.6.2?

wspos_eyePositionW whats the right syntax? i cant find anything about extra flags in the manual. btw, the captial about shaders is very leaky.

so i just need to get the eyeposition for doing a reflection.

i would be very proud of you.(i know you be conform with shaders in panda). and i really dont want to watch into the source of panda.

I think that’d be wspos_view.

very cool! would it takes much of time to expand the capitel in manual about shaders? specially the shader inputs should be reworked. just put to possible input flags to the panda translate variables.

but very cool thx alot! i will try that now…

This page explains more about the special “view”, “model”, “clip” keywords etc.

panda3d.org/manual/index.ph … ate_Spaces

I don’t know where you saw eyePositionW, but I don’t think that’s a universal way to pass it to a shader.

i saw that on the cg developers page at nvidia.

oh and sorry again, i just had to turn the page. :wink:

(just reorder that, and please take a look how the peoples at alias wavefront was writing manuals. :wink: )

so here the shader we have now in our game…

//Cg 
// primus illuminis v.001
// markus hötzing and rudolf putz 2011

void vshader(float4 vtx_position : POSITION, 
             float3 vtx_normal    : NORMAL, 
             in uniform float4x4 mat_modelproj, 
             in float2 vtx_texcoord0 : TEXCOORD0, 
             in float2 vtx_texcoord1 : TEXCOORD1,
             uniform in float4   wspos_view, 
             uniform in float4x4 trans_model_to_world , 
             
             out float3 l_texcoord1 : TEXCOORD1,
             out float4 l_position : POSITION, 
             out float3 l_reflectUV: TEXCOORD0 
             ) 
{ 
  l_position=mul(mat_modelproj, vtx_position); 
  float3 positionW = mul(trans_model_to_world,vtx_position).xyz; 
  float3 N = mul((float3x3)trans_model_to_world, vtx_normal); 
  N=normalize(N); 
  float3 I = positionW - wspos_view; 
  l_reflectUV = reflect(I,N); 
  l_texcoord1 = vtx_normal;
} 
void fshader( 
             in  float4 l_reflectUV : TEXCOORD0, 
             in float4 l_texcoord1 : TEXCOORD1,
             in uniform samplerCUBE k_texcube : TEXUNIT0, 
             in uniform sampler2D tex_1,
             out float4 o_color: COLOR0 
             ) 
{ 
	float4 texColor_illum = texCUBEbias(k_texcube, l_texcoord1);
	float4 texColor_refl = texCUBE(k_texcube, l_reflectUV);
	float reflINTENSE = 1;
	float billINTENSE = 0.1;
	float4 texColor = float4((texColor_illum.x*billINTENSE)+(texColor_refl.x*reflINTENSE)/2,(texColor_illum.y*billINTENSE)+(texColor_refl.y*reflINTENSE)/2,(texColor_illum.z*billINTENSE)+(texColor_refl.z*reflINTENSE)/2,1);
    o_color =  texColor;
}