Hi !
I’m currently trying to make a little displacement mapping shader.
it goes like this:
void vshader( in float4 vtx_position : POSITION,
in float3 vtx_normal : NORMAL,
in float2 vtx_texcoord : TEXCOORD0,
in uniform sampler2D tex_0 : TEXUNIT0,
in uniform float4x4 mat_modelproj,
out float4 l_position : POSITION,
out float2 l_texcoord : TEXCOORD0,
)
{
float tex_pos = tex2D( tex_0, vtx_texcoord ) ;
float3 displacement = vtx_normal * tex_pos ;
float4 true_pos = vtx_position + float4(displacement,0.0) ;
l_position = mul( mat_modelproj, true_pos );
l_texcoord = vtx_texcoord ;
[...]
but I have an error:
:gobj(error): Cg program too complex for driver:/home//shader/displacement_map.sha
Investigating, I found that was the was “tex2D” command that crash ( the shader works without it).
According to the cg reference manual, “tex2D” command can be used in vertex shader since profile vp4.0
It seams that the one I’m using: ( with notify-level-glgsg debug )
:display:gsg:glgsg(debug):
Cg vertex profile = vp40 id = 7001
Cg pixel profile = fp40 id = 6151
shader model = 4
so,… why there was this error ?
I’m on ubuntu hardy heron with nvidia drivers 169.12 on a 8800GT
thank