hi,

this shader works on 6.22 fine, but not on 6.31
error error error error
need help

look at my projekt " LoetEd " leveleditor it works on 6.22 fine.

der shader läuft auf 6.22 super, aber nicht auf 6.31.
brauche hilfe.

der shader macht das was in meinem programm zu sehen ist.
3 texturen mit jeweils eigener detail-map im alphakanal.
alles wird über die erste skin der hmp die als blendmap benutzt und damit dargestellt.




Code:


bmap textur_cursor=<textur_cursor.tga>;
bmap stone = <stone.tga>;
bmap grass = <grass.tga>;
bmap sand = <sand.tga>;

material mat_terrain_multitexture
{
skin1=textur_cursor;
Skin2=sand;
skin3=stone;
skin4=grass;

effect=
"
texture entSkin1;
texture entSkin2;
texture entSkin3;
texture entSkin4;
texture mtlSkin1;
texture mtlSkin2;
texture mtlSkin3;
texture mtlSkin4;

matrix matWorldViewProj;
//----------
matrix matWorld;
matrix matWorldView;

vector vecSpecular;
vector vecSunDir;
vector vecDiffuse;
vector vecAmbient;
vector vecLight;
vector vecFog;

technique multitextureps11
{
// pass texture
pass p0
{
texture[0]=<mtlSkin3>;
texture[1]=<mtlSkin2>;
texture[2]=<mtlSkin4>;
texture[3]=<entSkin1>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

magFilter[2]=linear;
minFilter[2]=linear;
mipFilter[2]=linear;

magFilter[3]=linear;
minFilter[3]=linear;
mipFilter[3]=linear;

zWriteEnable=true;

vertexShaderConstant[0]=<matWorldViewProj>;
//------------------
vertexShaderConstant[4]=<matWorld>;
vertexShaderConstant[8]=<matWorldView>;

vertexShaderConstant[15]=<vecSpecular>;
vertexShaderConstant[16]=<vecSunDir>;
vertexShaderConstant[17]=<vecDiffuse>;
vertexShaderConstant[18]=<vecAmbient>;
vertexShaderConstant[19]=<vecLight>;
vertexShaderConstant[20]=<vecFog>;

//------------------

vertexShaderConstant[64]=(48.0f,48.0f);//texture scale
vertexShaderConstant[65]=(1024.0f,1024.0f);//detail scale

//-----------------
vertexShaderConstant[95]=(0.0f,0.0f,0.0f,0.0f);
//-----------------
vertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[2]; //uv
}
asm
{
vs.1.0
m4x4 oPos,v0,c0 // transform position to clip space

mul oT0.xy,v7.xy,c64.xy // texture
mul oT1.xy,v7.xy,c64.xy // texture
mul oT2.xy,v7.xy,c64.xy // texture
mov oT3.xy,v7.xy // blend map
//-----------------
m3x3 r0,v3,c4 // transform normal to world space
dp3 r0.w,r0,r0 // renormalize it
rsq r0.w,r0.w
mul r0,r0,r0.w

dp3 r0,r0,-c16 // normal.light -> lighting constant
mul r0.xyz,r0,c17 // modulate against material diffuse color
add oD0.xyz,r0,c19 // add environment light



mov r1.w,c20.w // r1.w=1
dp4 r0,v0,c10 // distance to camera position
add r0,r0,-c20.x // distance-fog_start
mad r0.x,-r0.x,c20.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog.x,r0.x,c95.w // clamp with custom max value
//---------------------

};

pixelShader=
asm
{
ps.1.1
def c0,1,1,1,1
tex t0 //sand mit mud textur
tex t1 //stein mit detail textur
tex t2 //grass mit dreck textur
tex t3 //blendmap

mov r1,t0
lrp r0.rgb,t3.a,r1,t1 // blend t0 with t1 depending on t3 alpha
+mov r0.a,c0

mov r1.a,t3.b
lrp r0.rgb,r1.a,r0,t2 // blend the result with t2 depending on t3 blue
+mov r0.a,c0

mul r0.rgb,r0,v0 // modulate with diffuse vertex lighting
};

}
//neuer pass textur detail
pass p1
{
texture[0]=<mtlSkin3>;
texture[1]=<mtlSkin2>;
texture[2]=<mtlSkin4>;
texture[3]=<entSkin1>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

magFilter[2]=linear;
minFilter[2]=linear;
mipFilter[2]=linear;

magFilter[3]=linear;
minFilter[3]=linear;
mipFilter[3]=linear;

vertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[2]; //uv
}
asm
{
vs.1.0
m4x4 oPos,v0,c0 // transform position to clip space

mul oT0.xy,v7.xy,c65.xy
mul oT1.xy,v7.xy,c65.xy
mul oT2.xy,v7.xy,c65.xy
mov oT3.xy,v7.xy

//-----------------
m3x3 r0,v3,c4 // transform normal to world space
dp3 r0.w,r0,r0 // renormalize it
rsq r0.w,r0.w
mul r0,r0,r0.w

dp3 r0,r0,-c16 // normal.light -> lighting constant
mul r0.xyz,r0,c17 // modulate against material diffuse color
add oD0.xyz,r0,c19 // add environment light

mov r1.w,c20.w // r1.w=1
dp4 r0,v0,c10 // distance to camera position
add r0,r0,-c20.x // distance-fog_start
mad r0.x,-r0.x,c20.z,r1.w // 1-(distance-fog_start)*(1/(fog_end-fog_start))
max oFog.x,r0.x,c95.w // clamp with custom max value
//---------------------

};

pixelShader=
asm
{
ps.1.1
def c0,0,0,0,0.2 // texture alpha
tex t0
tex t1
tex t2
tex t3

mov r1,t0.a
lrp r0.rgb,t3.a,r1,t1.a // blend t0 with t1 depending on t3 alpha
+mov r0.a,c0

mov r1.a,t3.b
lrp r0.rgb,r1.a,r0,t2.a // blend the result with t2 depending on t3 blue
+mov r0.a,c0

mul r0.rgb,r0,v0 // modulate with diffuse vertex lighting
};
}

//new pass cursor
pass p2
{
texture[0]=<entSkin2>;
texture[1]=<mtlSkin1>;

magFilter[0]=linear;
minFilter[0]=linear;
mipFilter[0]=linear;

magFilter[1]=linear;
minFilter[1]=linear;
mipFilter[1]=linear;

vertexShader=
decl
{
stream 0;
float v0[3]; //position
float v3[3]; //normal
float v7[2]; //uv
}
asm
{
vs.1.0
m4x4 oPos,v0,c0 // transform position to clip space

mov oT0.xy,v7.xy
mul oT1.xy,v7.xy,c64.xy
};

pixelShader=
asm
{
ps.1.1
def c0,0,0,0,1
tex t0
tex t1

mul r0,t0,c0
lrp r0.rgb,t0,t1,t1
};
}



}
";
}


starter mat_terrain_multitexture_init
{
bmap_to_mipmap(mat_terrain_multitexture.skin1);
bmap_to_mipmap(mat_terrain_multitexture.skin2);
bmap_to_mipmap(mat_terrain_multitexture.skin3);
bmap_to_mipmap(mat_terrain_multitexture.skin4);
}