Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,758 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
uv shifting with a simple shader #177834
01/14/08 12:27
01/14/08 12:27
Joined: Sep 2003
Posts: 648
Switzerland
snake67 Offline OP
User
snake67  Offline OP
User

Joined: Sep 2003
Posts: 648
Switzerland
Hi

I am very bad in shader programming so i have a question. I want to make an uv shifting effect including alpha channel (it should be shifted too). It is for a moving train level. I tried out the example from wiki, but it does not shift the alpha channel. could someone help mee (excpecially HeelX, who wrote the example).

Thanks a lot.

Re: uv shifting with a simple shader [Re: snake67] #177835
01/14/08 18:37
01/14/08 18:37
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
I did that once, its a very nice effect, they only issue with it is it makes the seams on any model very visible, too bad I don't still have the shader.... If I have time I'll try and rewrite it for you, but I'm pretty busy this week.

Re: uv shifting with a simple shader [Re: lostclimate] #177836
01/15/08 05:58
01/15/08 05:58
Joined: Sep 2003
Posts: 648
Switzerland
snake67 Offline OP
User
snake67  Offline OP
User

Joined: Sep 2003
Posts: 648
Switzerland
Would be great!

Here is the shader i use until now. It should shift alpha channel too:

function mtl_UV_alphaClamp_event ();
material mtl_UV_alphaClamp {

event = mtl_UV_alphaClamp_event;
effect = "
matrix matMtl;
extern texture entSkin1;

technique uvspeed
{
pass p0
{
Texture[0] = <entSkin1>;
ColorOp[0] = Subtract;

Texture[1] = <entSkin1>;
ColorOp[1] = SelectArg1;
TextureTransform[1] = <matMtl>;
TextureTransformFlags[1] = Count2;
}
}";
}

function mtl_UV_alphaClamp_event ()
{
mat_identity(mtl.matrix);
mtl.ENABLE_RENDER = on;
mtl.matrix31 = floatd(my.skill1, 256);
mtl.matrix32 = floatd(my.skill2, 256);
}

action bla ()
{
my.material = mtl_UV_alphaClamp;

while (1) {
my.skill1 += 5 * time_step;
my.skill2 += 2 * time_step;
wait(1);
}
}

Re: uv shifting with a simple shader [Re: snake67] #177837
01/15/08 20:59
01/15/08 20:59
Joined: Aug 2005
Posts: 1,012
germany, dresden
ulf Offline
Serious User
ulf  Offline
Serious User

Joined: Aug 2005
Posts: 1,012
germany, dresden
i think your shader does shift the base texture and uses the alpha information to clamp it.

Re: uv shifting with a simple shader [Re: ulf] #177838
01/16/08 03:24
01/16/08 03:24
Joined: Sep 2003
Posts: 648
Switzerland
snake67 Offline OP
User
snake67  Offline OP
User

Joined: Sep 2003
Posts: 648
Switzerland
Yes, i know. But how to shift the alpha channel too? Please help!

Re: uv shifting with a simple shader [Re: snake67] #177839
01/16/08 13:39
01/16/08 13:39
Joined: Jan 2004
Posts: 2,013
The Netherlands
E
Excessus Offline
Expert
Excessus  Offline
Expert
E

Joined: Jan 2004
Posts: 2,013
The Netherlands
There is such a material in the mtlFX.c / uvspeed.fx.

Re: uv shifting with a simple shader [Re: Excessus] #177840
01/16/08 14:00
01/16/08 14:00
Joined: Mar 2005
Posts: 969
ch
Loopix Offline
User
Loopix  Offline
User

Joined: Mar 2005
Posts: 969
ch
Hey...co-patriote! This is not tested but I woulden't know why it shoulden't work...


Code:

...
technique uvspeed
{
pass p0
{
Texture[0] = <entSkin1>;
ColorOp[0] = Subtract;
TextureTransform[0] = <matMtl>;
TextureTransformFlags[0] = Count2;

Texture[1] = <entSkin1>;
ColorOp[1] = SelectArg1;
TextureTransform[1] = <matMtl>;
TextureTransformFlags[1] = Count2;
}
}";
}
...



Re: uv shifting with a simple shader [Re: Loopix] #177841
01/17/08 09:19
01/17/08 09:19
Joined: Sep 2003
Posts: 648
Switzerland
snake67 Offline OP
User
snake67  Offline OP
User

Joined: Sep 2003
Posts: 648
Switzerland
Thanks a lot, really nice. I will try it soon and post the result here!

Re: uv shifting with a simple shader [Re: Loopix] #177842
01/17/08 09:23
01/17/08 09:23
Joined: Sep 2003
Posts: 648
Switzerland
snake67 Offline OP
User
snake67  Offline OP
User

Joined: Sep 2003
Posts: 648
Switzerland
Woooow, great, it works purrrfekt!!!!!!!!!!!!!

Again, thanks a lot!

Re: uv shifting with a simple shader [Re: snake67] #232926
10/25/08 02:25
10/25/08 02:25
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Has anybody got this to run under A7.5? My texture flickers but does not move.

I changed the render event to

function mtl_UV_alphaClamp_event ()
{
mat_identity(mtl.matrix);
mtl->flags |= ENABLE_RENDER;
(mtl->matrix)[7] = my.skill1 / 256;
(mtl->matrix)[8] = my.skill2 / 256;
}


Always learn from history, to be sure you make the same mistakes again...
Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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