Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, degenerate_762), 1,213 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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 Offline OP
Developer
xoNoid  Offline 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 . 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
T
Thomas_Nitschke Offline
Senior Developer
Thomas_Nitschke  Offline
Senior Developer
T

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

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: Thomas_Nitschke] #40546
02/04/05 02:51
02/04/05 02:51
Joined: Sep 2002
Posts: 758
Sunny Scotland
xoNoid Offline OP
Developer
xoNoid  Offline OP
Developer

Joined: Sep 2002
Posts: 758
Sunny Scotland
I already tried that but I did dword mtlskill1 instead of dword mtlSkill1. I didnt realise that it was case sensitive. Unfortunatly the texture is not shifting so Im obviously still doing something wrong.

Re: Shader newbe trying to do FFP u/v shifting [Re: xoNoid] #40547
02/04/05 19:34
02/04/05 19:34
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
If your using DX9, look at JCL's last post to achieve texture shifting via the material matrix(FFP) -

Texture Shifting Topic

Just apply the "auge_mdl" material to your entity. "mtl.matrix13" shifts the U and "mtl.matrix23" shifts the V.


Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: Shader newbe trying to do FFP u/v shifting [Re: William] #40548
02/04/05 21:00
02/04/05 21:00
Joined: Sep 2002
Posts: 758
Sunny Scotland
xoNoid Offline OP
Developer
xoNoid  Offline OP
Developer

Joined: Sep 2002
Posts: 758
Sunny Scotland
I've got an error:
nonexistant action mtl_copy;
When I comment out the calling of the function all I get is a black texture

Re: Shader newbe trying to do FFP u/v shifting [Re: xoNoid] #40549
02/05/05 09:50
02/05/05 09:50
Joined: Aug 2001
Posts: 2,320
Alberta, Canada
William Offline
Expert
William  Offline
Expert

Joined: Aug 2001
Posts: 2,320
Alberta, Canada
Just put this on the top of everything else. All mtl_copy does is call a function which gives the models the same material settings as mat_model. Here:

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;
}




Check out Silas. www.kartsilas.com

Hear my band Finding Fire - www.myspace.com/findingfire

Daily dev updates - http://kartsilas.blogspot.com/
Re: Shader newbe trying to do FFP u/v shifting [Re: William] #40550
02/05/05 20:33
02/05/05 20:33
Joined: Sep 2002
Posts: 758
Sunny Scotland
xoNoid Offline OP
Developer
xoNoid  Offline OP
Developer

Joined: Sep 2002
Posts: 758
Sunny Scotland
Hmm I still get a black texture. However when I comment out the line:
TextureTransformFlags[0] = Count2;
The texture is displayed but with no texture shifting. For some reason does my Geforce 2 not support this shader? I thought it was all fixed-function? That cannot be the case otherwise the fallback would have run.

Re: Shader newbe trying to do FFP u/v shifting [Re: xoNoid] #40551
02/05/05 21:10
02/05/05 21:10
Joined: Dec 2003
Posts: 1,097
Maryland, USA
Steempipe Offline
Serious User
Steempipe  Offline
Serious User

Joined: Dec 2003
Posts: 1,097
Maryland, USA
Please post your complete code up to this point.

Re: Shader newbe trying to do FFP u/v shifting [Re: Steempipe] #40552
02/07/05 00:29
02/07/05 00:29
Joined: Sep 2002
Posts: 758
Sunny Scotland
xoNoid Offline OP
Developer
xoNoid  Offline OP
Developer

Joined: Sep 2002
Posts: 758
Sunny Scotland
Ok:

Code:

//function to copy material states
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;}


action enviro_map
{
my.ambient+=40;
my.shadow=on;
my.material=auge_mdl;
while(1)
{
my.pan+=5*time;
wait(1);
}

}

}

function mtl_rolleye_1();
function mtl_rolleye_2();
function mtl_eye_init();

//
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.skill2 = 100; // initial texture scale in percent
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;
texture entSkin1;
technique scale
{
// use material transformation matrix, leave everything else at default values
pass p0
{
Texture[0] = <entSkin1>;
ColorArg1[0] = Texture;
ColorArg2[0] = Current;
TextureTransformFlags[0] = Count2;
TextureTransform[0] = <matMtl>;
}
}

technique fallback { pass p0 { } }
";
}




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 Offline
Serious User
Steempipe  Offline
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;

}








Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1