Gamestudio Links
Zorro Links
Newest Posts
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 (TipmyPip, AndrewAMD), 1,151 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 2
Page 2 of 5 1 2 3 4 5
Re: Working texture projectors :) [Re: EX Citer] #32647
09/02/04 14:06
09/02/04 14:06
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline OP
Expert
Matt_Aufderheide  Offline OP
Expert
M

Joined: Oct 2003
Posts: 4,131
yes its most common use would be lights shining through a grating or some such.. also good for tree leaf shadows.

Re: Working texture projectors :) [Re: Matt_Aufderheide] #32648
09/02/04 15:25
09/02/04 15:25
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
cool.. this is for sure extreeem usefull. lets see:)

in pass p0 there is a typo: shouldnt it be mtlSkin4 for the projection?

Last edited by ello; 09/02/04 15:46.
Re: Working texture projectors :) [Re: ello] #32649
09/02/04 21:26
09/02/04 21:26
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
i had to change mtlskin4 to mtlskin1..
and add mtlworldprojection matrix
And how do you did the shadow on the screen shot!?
I casn't make it to chow on the ground, but player is affected and it shows the shadow, but now on the floor.. HOw do i di that?

Thx in advance


The code is this.. i don't know if i follow the order of intructions.. maybe thats the problem...

here is it.. i won't use code tag, cause it doesn't work in script editor when pasting..

var matTexProj[16];
var tempmatrix[16];
function mat_projection_init()

{



mtl.enable_render=on;



//set up the texture projection matrix



matTexProj[0]=my.skill80;

matTexProj[1]=my.skill81;

matTexProj[2]=my.skill82;

matTexProj[3]=my.skill83;



matTexProj[4]=my.skill84;

matTexProj[5]=my.skill85;

matTexProj[6]=my.skill86;

matTexProj[7]=my.skill87;



matTexProj[8]=my.skill88;

matTexProj[9]=my.skill89;

matTexProj[10]=my.skill90;

matTexProj[11]=my.skill91;



matTexProj[12]=my.skill92;

matTexProj[13]=my.skill93;

matTexProj[14]=my.skill94;

matTexProj[15]=my.skill95;



mat_set(mtl.matrix,matWorld);

mat_multiply(mtl.matrix,matTexProj);



}






bmap projectiontex = <light_alpha_1.tga>;
material mat_projection

{



skin1 = projectiontex;



event = mat_projection_init;



flags = tangent;

effect =

"



texture mtlSkin1; //projector// skill4

texture entSkin1; //colormap



matrix matWorld;

matrix matMtl;

matrix matWorldViewProj;



technique projector

{



pass p0 //projector

{



//load matrices

VertexShaderConstant[0] = <matWorld>; //World Matrix

VertexShaderConstant[8] = <matWorldViewProj>; //World*View*Proj Matrix

VertexShaderConstant[95] = <matMtl>;





//range constant

VertexShaderConstant[33] = (0.01f, 0.5f, 0.05f, 0.0f);



Texture[0] = <mtlSkin1>; //projection tex

Texture[1] = <entSkin1>; //projection tex



AddressU[0] = Clamp; // don't wrap around edges

AddressV[0] = Clamp;

AddressU[1] = Clamp; // don't wrap around edges

AddressV[1] = Clamp;



zWriteEnable=true; // enables writing to the z-buffer

//AlphaBlendEnable=true; // disables alpha blending

//srcblend=destcolor;

//destblend=one;





VertexShader=

decl

{

stream 0;

float v0[3]; //position

float v3[3]; //normal

float v7[3]; //uv

float v8[3]; //tangent

}

asm

{

vs.1.1



; position in clip space

m4x4 oPos, v0, c8



; position in texture projection space

m4x4 r10,v0,c95



; Divide each component by the range value

mul r10, r10, c33.x



; multiply with 0.5 and add 0.5

mad r10, r10, c33.yyyy, c33.yyyy



; map the x and y components into the first texture

mov oT0.xy, r10.xy



mov oT1.xy, v7.xy; color



};



PixelShader=

asm

{



ps.1.1



tex t0

tex t1



mov r0,t0

mul r0,r0,t1



};

}



}

";

}




var scan_radius=210;
var lighttimer=0;





function light_data()

{



if event_type==event_detect && my.skill4 == 6666 //projector

{



your.material=mat_projection;

//you.skill100=6666;

//texture projection matrix

you.skill80=my.skill80;

you.skill81=my.skill81;

you.skill82=my.skill82;

you.skill83=my.skill83;



you.skill84=my.skill84;

you.skill85=my.skill85;

you.skill86=my.skill86;

you.skill87=my.skill87;



you.skill88=my.skill88;

you.skill89=my.skill89;

you.skill90=my.skill90;

you.skill91=my.skill91;



you.skill92=my.skill92;

you.skill93=my.skill93;

you.skill94=my.skill94;

you.skill95=my.skill95;



// return;

}



}






function light_view_matrix()

{



//temporary matrix to store view matrix

vec_set(camera.x,my.x);

vec_set(camera.pan,my.pan);



wait(1);



mat_set(tempmatrix,matView);



my.skill80=tempmatrix[0];

my.skill81=tempmatrix[1];

my.skill82=tempmatrix[2];

my.skill83=tempmatrix[3];



my.skill84=tempmatrix[4];

my.skill85=tempmatrix[5];

my.skill86=tempmatrix[6];

my.skill87=tempmatrix[7];



my.skill88=tempmatrix[8];

my.skill89=tempmatrix[9];

my.skill90=tempmatrix[10];

my.skill91=tempmatrix[11];



my.skill92=tempmatrix[12];

my.skill93=tempmatrix[13];

my.skill94=tempmatrix[14];

my.skill95=tempmatrix[15];



}

ACTION lightobject

{

MY.passable=ON;

MY.shadow=OFF;

my.flare=off;

my.transparent=off;

my.invisible=on;

my.enable_detect=on;

my.event=light_data;



my.skill100=lighttimer;

lighttimer+=1;



if my.skill4==6666 //is a projector

{

wait(my.skill100);



light_view_matrix();



while(1)

{



temp.pan = 360;

temp.tilt = 360;

temp.z = 220;

indicator=NULL;

scan_entity(my.x,temp);

wait(1);

}

}

}



Last edited by Unknot; 09/02/04 21:40.
Re: Working texture projectors :) [Re: MMike] #32650
09/02/04 21:53
09/02/04 21:53
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 screenshot is from my shader, Matt's may look different.

Re: Working texture projectors :) [Re: Alexander Esslinger] #32651
09/02/04 21:55
09/02/04 21:55
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
ah.ok..heh

Re: Working texture projectors :) [Re: MMike] #32652
09/03/04 00:10
09/03/04 00:10
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline OP
Expert
Matt_Aufderheide  Offline OP
Expert
M

Joined: Oct 2003
Posts: 4,131
you are right.. i have edited those mistakes.. i had to clean it up to post here and forgot to change a few things.. everything should work now.

as it is now the shader wont project on world geometry.. however this is can be done easily enough.. just use material skills instead of entity skills to pass the matrix values.


Sphere Engine--the premier A6 graphics plugin.
Re: Working texture projectors :) [Re: Matt_Aufderheide] #32653
09/03/04 01:38
09/03/04 01:38
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
Well but then update the code , to project geometry too...

Other thing i noticed it that , the player is affected by the light mask, but not all of them, and if you get out of range .. then the player is all black..

ehhe.. is that a bug or ..
<.<
>.>

:P

Re: Working texture projectors :) [Re: MMike] #32654
09/03/04 01:51
09/03/04 01:51
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline OP
Expert
Matt_Aufderheide  Offline OP
Expert
M

Joined: Oct 2003
Posts: 4,131
make sure player has enable_scan=on
it should work.. if not theres something wrong with your implementation.

im not going to update to project on world geometry because i dont need it. Maybe someone else can modify this. In any case there needs a lot more work on the engine before world geometry can use most lighting shaders correctly.

Re: Working texture projectors :) [Re: Matt_Aufderheide] #32655
10/23/04 03:03
10/23/04 03:03
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
matt,
could you help me implement it in my game??
please mail me, or add me on msn/icq..
i am having lots of trouble implementing it, i am being busy on it for 3 hours now, but i cant seem to let it work.
my video card does support it tho, could you please help me out??

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Working texture projectors :) [Re: Matt_Aufderheide] #32656
10/24/04 04:09
10/24/04 04:09
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
no-one else who is able to help me out on this shader??


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Page 2 of 5 1 2 3 4 5

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