Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Ayumi, 1 invisible), 584 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
passing values to Effects. #21414
12/21/03 17:16
12/21/03 17:16
Joined: Aug 2003
Posts: 145
Beorn Offline OP
Member
Beorn  Offline OP
Member

Joined: Aug 2003
Posts: 145
I have troubles passing values to an fixed function effect.

I have several entities of the same model. They all have the same material assigned. I want them to use the same Mtl.skin but with different texturecoordinates. I can only achieve this through setting .U and .V in the entity action.

i have tried this in the entitys action:

mtl.skill1=entity.skill1 // where entity skill1 is different for each entity.

and this in the material event:

mtl.matrix41 = floatd(mtl.skill1,500); // u offset

But they all get the same displacement. I guess i have to access the entitys skill from within the material event function. But this i simply cant understand how this would be possible.

Any ideas are appreciated.



Re: passing values to Effects. [Re: Beorn] #21415
12/22/03 04:40
12/22/03 04:40
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
you can pass a vector by using skill 41,42,43,44. So you can assign those to the entity individually. So entity one has skill41=255 (for U) and skill42=120 (for V) and so on...


Sphere Engine--the premier A6 graphics plugin.
Re: passing values to Effects. [Re: Matt_Aufderheide] #21416
12/22/03 06:00
12/22/03 06:00
Joined: Aug 2003
Posts: 145
Beorn Offline OP
Member
Beorn  Offline OP
Member

Joined: Aug 2003
Posts: 145
Thanks, this is great info.

Are these entity skill automatically read as mtl.matrix41 etc or do i have to assign them in the material event function?


Re: passing values to Effects. [Re: Beorn] #21417
12/22/03 07:36
12/22/03 07:36
Joined: Aug 2003
Posts: 145
Beorn Offline OP
Member
Beorn  Offline OP
Member

Joined: Aug 2003
Posts: 145
It didnt work. Which i am pretty sure i due to me. Bear with me, i got a mixed bag of questions and thoughts.

1. In the documentation it says that SHADERS can use skill41-44 as vectors, but since i am only using the fixed function i suspect it wont work the same way. Correct?

2. I can pass values from th entitys action to the effect but it displaces them the same way although i have assigned different values to each entity.
I suspect that a6 handles all normal stuff (entity, and others) and then goes to render, thus it uses the same value (the last one assigned) for each time it goes through the effect. But i am guessing here.

3. I supect that i need to assign the unique value from within the mtl event function. I have tried a lot of stuff with no luck.

Please feel free to point out any mistakes in my logic. Im guessing a lot here.



Re: passing values to Effects. [Re: Beorn] #21418
12/22/03 07:59
12/22/03 07:59
Joined: Oct 2000
Posts: 1,543
Germany
A
Alexander Esslinger Offline
Senior Developer
Alexander Esslinger  Offline
Senior Developer
A

Joined: Oct 2000
Posts: 1,543
Germany
1) Yes.
2) That's not correct, it handles the values per entity.
3) Normally, it doesn't matter where you set the values, but your effect need to use these later. For UV shifting, you need to use a texture transformation matrix.

Re: passing values to Effects. [Re: Alexander Esslinger] #21419
12/22/03 08:10
12/22/03 08:10
Joined: Aug 2003
Posts: 145
Beorn Offline OP
Member
Beorn  Offline OP
Member

Joined: Aug 2003
Posts: 145
Thank you Alexander,

Im using a transformation matrix - I think - mtlMat. And i try to set values 41 and 42 to different values for each entity.

And a correction, when i said "Normal stuff" i actually meant ordinary. I was not talking about the entitys normals. Still the same?

Im extremely grateful for all help i can get here.

Re: passing values to Effects. [Re: Beorn] #21420
12/22/03 11:12
12/22/03 11:12
Joined: Oct 2000
Posts: 1,543
Germany
A
Alexander Esslinger Offline
Senior Developer
Alexander Esslinger  Offline
Senior Developer
A

Joined: Oct 2000
Posts: 1,543
Germany
Yes, it uses the last one assigned.

You need to set up your transformation matrix, pass it to the effect and use it inside (eg. set TextureTransform).

Re: passing values to Effects. [Re: Alexander Esslinger] #21421
12/22/03 11:58
12/22/03 11:58
Joined: Aug 2003
Posts: 145
Beorn Offline OP
Member
Beorn  Offline OP
Member

Joined: Aug 2003
Posts: 145
Yes.. i think i have got it like that. This is basically what happens in the effect:

Code:
   

function mtl_terr_view()
{
//SCALING THE TEXTURE
mtl.matrix11 = float(1.3);
mtl.matrix22 = float(1.3);
/// dISPLACE U (OR V);
mtl.matrix41 = mtl.skill1;
}




Code:

function mtl_terrer_init()
{
mtl.event = mtl_terr_view;
mtl.enable_render=on;

}



Code:

material terrer // environment cube
{
event=mtl_terrer_init();
skin1 = testsquares;

effect ="

texture entSkin1;
texture mtlSkin1;

matrix matMtl;
technique scalex {

pass p0
{

Texture[0]=<mtlSkin1>;
ColorArg1[0]=Texture;
ColorOp[0]=selectarg1;//addsmooth;//selectarg1;//add;
ColorArg2[0]=Diffuse;

AddressU[0]=wrap;
AddressV[0]=wrap;

TextureTransformFlags[0] = Count2; // use u,v values
TextureTransform[0] = <matMtl>;
}
}
";
}




And i have this line in the entities action:

terrer.skill1=my.skill3;

also tried this:

mtl.skill1=my.skill3;

Skill3 is different for all entities, but they still get the identical displacement of the texture. I can move it but it moves the same for every texture that uses it even though they all have different skill3 values.

I am stumped. I know i can use entity.u and .v to reach what im tryinmg to achieve but it gives me other problems.


Re: passing values to Effects. [Re: Beorn] #21422
12/23/03 00:40
12/23/03 00:40
Joined: Oct 2000
Posts: 1,543
Germany
A
Alexander Esslinger Offline
Senior Developer
Alexander Esslinger  Offline
Senior Developer
A

Joined: Oct 2000
Posts: 1,543
Germany
The last to lines are wrong. If you set the values inside the entitys action, you set it globally for the material, which is then used for all entitys with this material.

The rendering takes place, after all entity actions have been executed.

Re: passing values to Effects. [Re: Alexander Esslinger] #21423
12/23/03 05:40
12/23/03 05:40
Joined: Aug 2003
Posts: 145
Beorn Offline OP
Member
Beorn  Offline OP
Member

Joined: Aug 2003
Posts: 145
Thank you-
That was actually what i meant in the above mentioned "no.2." statement. So i know why it doesnt work, but not how to fix it...

Can access an entity skill inside an Material event function?

How do i know that i get the right entity?

..slowly getting there:)

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