:display:gsg:glgsg(error): Could not load Cg fragment program:/p/2aw/shaders/tree7.sha (arbfp1 Fragment program exceeded native resources:
Temporaries - 1
Parameters - 8
Attributes - 6
ALU instructions - 81
Texture instructions - 6
Texture indirections - 0
)
//Cg
//
//Cg profile arbvp1 arbfp1
void vshader(
in uniform float4x4 mat_modelproj,
in uniform float4x4 inv_modelview,
in float4 vtx_position : POSITION,
in float3 vtx_normal : NORMAL,
in float2 vtx_texcoord0 : TEXCOORD0,
in float3 vtx_tangent0 : TANGENT,
in float3 vtx_binormal0 : BINORMAL,
out float4 l_position : POSITION, // needed for the gfx card
out float4 l_vertPos : TEXCOORD6,
out float3 l_normal : TEXCOORD1,
out float2 l_uv : TEXCOORD2,
out float3 l_tangent : TEXCOORD3,
out float3 l_binormal : TEXCOORD4,
out float3 l_eyeVec : TEXCOORD5
)
{
l_position=mul(mat_modelproj, vtx_position);
l_uv=vtx_texcoord0;
l_eyeVec = mul(inv_modelview,float4(0., 0., 0., 1.)) - l_position;
l_vertPos = vtx_position;
l_normal = vtx_normal;
l_uv = vtx_texcoord0;
l_tangent = vtx_tangent0;
l_binormal = vtx_binormal0;
}
#define Delta 500
float4 light(
float4 nodepath,
sampler2D tex_1,
float4 hullColor,
float3 halfVec,
float4 l_vertPos,
float3 l_normal,
float2 l_uv,
float3 l_tangent,
float3 l_binormal)
{
// diffinitons
float3 lightvec;
float distance;
float attenuate;
float3 conv_lightvec;
float slant;
float ndotl;
float ndoth;
float4 out_color;
lightvec = ((float3)nodepath - l_vertPos);
distance = 100/length(lightvec);
attenuate = saturate(30.0 / (15.0 + distance));
lightvec = normalize(lightvec);
conv_lightvec.x = dot(l_tangent, lightvec);
conv_lightvec.y = -dot(l_binormal, lightvec);
conv_lightvec.z = dot(l_normal, lightvec);
slant = tex2D(tex_1, l_uv+float2(conv_lightvec.x,conv_lightvec.y)/Delta ).x - tex2D(tex_1, l_uv).x;
out_color = slant * hullColor + conv_lightvec.z * hullColor * attenuate;
ndotl = max( dot( lightvec, l_normal ), 0.0 );
ndoth = (ndotl > 0.0) ? pow(max( dot( halfVec, l_normal ), 0.0 ), 128.) : 0.0;
return ndotl*out_color + ndoth*out_color;
}
void fshader(
// from vshader
in float4 l_vertPos : TEXCOORD6,
in float3 l_normal : TEXCOORD1,
in float2 l_uv : TEXCOORD2,
in float3 l_tangent : TEXCOORD3,
in float3 l_binormal : TEXCOORD4,
in float3 l_eyeVec : TEXCOORD5,
// texture units
in uniform sampler2D tex_0 : TEXUNIT0,
in uniform sampler2D tex_1 : TEXUNIT1,
// from inputs
in uniform float4 k_glow,
in uniform float4 k_team,
// from lighting
in uniform float4 mspos_sun : c7,
in uniform float4 k_sunDef : c8,
in uniform float4 mspos_light1 : c9,
in uniform float4 k_light1Def : c10,
in uniform float4 mspos_light2 : c11,
in uniform float4 k_light2Def : c12,
in uniform float4 mspos_light3 : c13,
in uniform float4 k_light3Def : c14,
// out put color to the screen
out float4 o_color : COLOR
)
{
// load our texture stages
float4 texRgba=tex2D(tex_0, l_uv);
float4 texBstg=tex2D(tex_1, l_uv);
float4 hullColor = (1-texBstg.g)*texRgba + k_team*texBstg.g ;
float3 halfVec = normalize( l_eyeVec + l_normal );
o_color = float4(0,0,0,0);
// 1st light
o_color = light(mspos_sun,
tex_1,
hullColor,
halfVec,
l_vertPos,
l_normal,
l_uv,
l_tangent,
l_binormal);
o_color += light(mspos_light1,
tex_1,
hullColor,
halfVec,
l_vertPos,
l_normal,
l_uv,
l_tangent,
l_binormal);
o_color += light(mspos_light2,
tex_1,
hullColor,
halfVec,
l_vertPos,
l_normal,
l_uv,
l_tangent,
l_binormal);
o_color += light(mspos_light3,
tex_1,
hullColor,
halfVec,
l_vertPos,
l_normal,
l_uv,
l_tangent,
l_binormal);
// compute correct glow
if ( k_glow.w > 0.1 )
o_color = texBstg.w*hullColor;
else if ( texBstg.w > 0.1 )
o_color = o_color + texBstg.w*hullColor;
}
we need support for less arcane shades… like GLSL / HLSL pair