2 registered members (bigsmack, vicknick),
923
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Shader newbe trying to do FFP u/v shifting
#40544
02/04/05 02:33
02/04/05 02:33
|
Joined: Sep 2002
Posts: 758 Sunny Scotland
xoNoid
OP
Developer
|
OP
Developer
Joined: Sep 2002
Posts: 758
Sunny Scotland
|
I am very new to shaders and am currently experementing with the FFP, well thats all I can do as I have a Geforce 2 ![](/ubbthreads/images/graemlins/grin.gif) . I was trying to shift the u/v with this code:
Code:
material test_mat
{
skin2 = mip_bmp;
effect = "
texture entSkin1;
texture mtlSkin2;
technique do_thing
{
pass P0
{
Texture[0]=<entSkin1>;
AddressU[0] = <mtlSkill1>;
AddressV[0] = <mtlSkill2>;
}
}
";
}
action shader_action
{
my.material=test_mat;
while(1)
{
test_mat.skill1+=2*time;
test_mat.skill2+=2*time;
wait(1);
}
}
However I get the error message
error in effect test_mat(11):error X3004: undeclared identifier 'mtlskill1'
Any help would be appreciated. Also does know of any good FFP tutorials for GS?
|
|
|
Re: Shader newbe trying to do FFP u/v shifting
[Re: xoNoid]
#40545
02/04/05 02:46
02/04/05 02:46
|
Joined: Jun 2003
Posts: 1,017 Germany
Thomas_Nitschke
Senior Developer
|
Senior Developer
Joined: Jun 2003
Posts: 1,017
Germany
|
I'm a shader n00Ob myself, but as far as I know, you have to define "mtlskill1" and "mtlskill2" before, just the way you defined the textures "entSkin1" and "mtlSkin1":
Code:
//goes in the line underneath "texture mtlSkin1"
dword mtlSkill1;
dword mtlSkill2;
Hope that helped you out a bit ![](/ubbthreads/images/graemlins/smile.gif)
Last edited by The Matrix; 02/04/05 02:51.
Formerly known as The Matrix - ICQ 170408644
I've been here for much longer than most people think. So where's my "Expert" status?
|
|
|
Re: Shader newbe trying to do FFP u/v shifting
[Re: xoNoid]
#40553
02/07/05 06:15
02/07/05 06:15
|
Joined: Dec 2003
Posts: 1,097 Maryland, USA
Steempipe
Serious User
|
Serious User
Joined: Dec 2003
Posts: 1,097
Maryland, USA
|
Try this: Code:
material* mtl1;
function mtl_copy(mtl_source) { mtl1 = mtl_source; vec_set(mtl.ambient_blue,mtl1.ambient_blue); vec_set(mtl.specular_blue,mtl1.specular_blue); vec_set(mtl.diffuse_blue,mtl1.diffuse_blue); vec_set(mtl.emissive_blue,mtl1.emissive_blue); mtl.power = mtl1.power; }
// 5-state machine for texture shifting and scaling function mtl_rolleye_1();
function mtl_rolleye_2() { mtl.skill1 -= time; // shift eyeball right if (mtl.skill1 < 0) { mtl.event = mtl_rolleye_1; } mtl.matrix13 = floatd(mtl.skill1,500); // u offset } function mtl_rolleye_1() { mtl.skill1 += time; // shift eyeball left if (mtl.skill1 > 50) { mtl.event = mtl_rolleye_2; } mtl.matrix13 = floatd(mtl.skill1,500); // u offset }
function mtl_eye_init() { // copy standard model material properties mtl_copy(mat_model); mtl.matrix11 = float(1); // default u scale mtl.matrix22 = float(1); // default v scale mtl.event = mtl_rolleye_1; mtl.enable_view = on; }
material auge_mdl { event = mtl_eye_init; effect = " matrix matMtl;
technique scale { // use material transformation matrix, leave everything else at default values pass p0 { TextureTransformFlags[0] = Count2; TextureTransform[0] = <matMtl>; } }
technique fallback { pass p0 { } } "; }
action eye { my.material = auge_mdl; }
|
|
|
|