Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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 (AndrewAMD, dr_panther), 730 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
lorikob361, LucasJoshua, Baklazhan, Hanky27, firatv
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how to add a shader to my game step by step? #283935
08/10/09 19:31
08/10/09 19:31
Joined: Jul 2009
Posts: 39
Chile!
Renard Offline OP
Newbie
Renard  Offline OP
Newbie

Joined: Jul 2009
Posts: 39
Chile!
that`s all.
i have this toon.fx file but i don`t have a clue on how to use it.

help please?


WRYYYYYYYYYYYYYYYYYY!!!1!!ONE!!11
Re: how to add a shader to my game step by step? [Re: Renard] #283939
08/10/09 19:41
08/10/09 19:41
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Do you have Commercial or Pro??

Re: how to add a shader to my game step by step? [Re: Cowabanga] #283969
08/10/09 22:27
08/10/09 22:27
Joined: Aug 2005
Posts: 512
Bayern
Schmerzmittel Offline
User
Schmerzmittel  Offline
User

Joined: Aug 2005
Posts: 512
Bayern
@ Cowabanga

Hes not asking to fix a bug. He wants to know how he can add a shader to a model.


Thats simple:
Include in your mainscript with #include <mtlfx.c>
Then in the WED open Menu and under map properties select your mainscript. You can right click on a model (i.e. your player) and choose properties. In the propertis window you can now choose the toon shader or another shader that comes with GS.

Just a hint:
download the lite-c workshop. After that you know many more.

Last edited by Schmerzmittel; 08/10/09 22:28.

A7 Com V7.80
Re: how to add a shader to my game step by step? [Re: Schmerzmittel] #284019
08/11/09 09:42
08/11/09 09:42
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Quote:
Hes not asking to fix a bug. He wants to know how he can add a shader to a model.
Yes, i know. But as you know (Or maybe you don't) shaders doesn't work with editions lower than Commercial.

Re: how to add a shader to my game step by step? [Re: Cowabanga] #284085
08/11/09 16:16
08/11/09 16:16
Joined: Aug 2005
Posts: 512
Bayern
Schmerzmittel Offline
User
Schmerzmittel  Offline
User

Joined: Aug 2005
Posts: 512
Bayern
Ok. Youre right. I forgott that^^


A7 Com V7.80
Re: how to add a shader to my game step by step? [Re: Schmerzmittel] #284106
08/11/09 18:46
08/11/09 18:46
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Originally Posted By: Schmerzmittel
Ok. Youre right. I forgott that^^
Ah, alright. laugh

Re: how to add a shader to my game step by step? [Re: Cowabanga] #284129
08/11/09 20:29
08/11/09 20:29
Joined: Jul 2009
Posts: 39
Chile!
Renard Offline OP
Newbie
Renard  Offline OP
Newbie

Joined: Jul 2009
Posts: 39
Chile!
I have A7 Pro, does that mean that i can`t use shaders? frown
i`ll give it a try.
thnxs anyway.


WRYYYYYYYYYYYYYYYYYY!!!1!!ONE!!11
Re: how to add a shader to my game step by step? [Re: Renard] #284150
08/11/09 22:42
08/11/09 22:42
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline
Serious User
DLively  Offline
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
Yes you can use shaders with A7 Pro.

First.

Have your game ready, so you can run it.
Run your game.

--------------
At this point any errors that occur, are from this..
----------------

Now.

Somewhere under the Vars, Defines, String, Panels place this:

Code:
material mtl_toon
{
	skin1=bmp_toonlookup;
	effect =
	"
	matrix matWorldViewProj;
	matrix matWorld;vector vecSunDir;
	texture entSkin1;texture mtlSkin1;
	technique t0{
		pass p0 // shade it
		{
			zwriteenable= true;
			zenable = true;
			Texture[0]=<mtlSkin1>;
			ColorOp[0]=Modulate;
			ColorArg1[0]=Texture;
			ColorArg2[0]=Texture;
			AddressU[0]=Clamp;
			AddressV[0]=Clamp;
			AddressW[0]=Clamp;
			TexCoordIndex[0]=0;
			Texture[1]=<entSkin1>;
			ColorOp[1]=Modulate;
			ColorArg1[1]=Texture;
			ColorArg2[1]=Current;
			TexCoordIndex[1]=1;
			VertexShaderConstant[0] = <matWorldViewProj>;
			VertexShaderConstant[4] = <matWorld>;
			VertexShaderConstant[7] = <vecSunDir>; 

			VertexShader =		asm
			{
				vs_1_0
				dcl_position  v0
				dcl_normal    v3
				dcl_texcoord0 v7
				dcl_texcoord1 v8
				mov oT2.xy, v7
				dp4 oPos.x, c0, v0
				dp4 oPos.y, c1, v0
				dp4 oPos.z, c2, v0
				dp4 oPos.w, c3, v0
				dp3 r0.x, c4.xyz, v3.xyz
				dp3 r0.y, c5.xyz, v3.xyz
				dp3 r0.z, c6.xyz, v3.xyz
				dp3 oT0.x, r0.xyz, -c7.xyz
				mov oT1.xyz, v8
			};
		}
		pass p1 // ink it
		{
			CULLMODE=CW;
			vertexShaderConstant[0]=<matWorldViewProj>;
//---------------------HERE IT IS!!!!
			vertexShaderConstant[16]=0.5; // outline thickness
//-------------RIGHT HERE!
			vertexShader =		asm
			{
				vs_1_0
				dcl_position v0
				dcl_normal v3
				dcl_texcoord v7
				mov r0,v0
				mul r1,c16.x,v3
				// Scale the normal
				add r0.xyz,r0.xyz,r1.xyz
				m4x4 oPos,r0,c0
				// Transorm position to clip space
				mov oD0, c0
				mov r0,c0
			};
		}
	}
	";
}



I assume thats the shader code that you are using.
I also use this one.


In the Wiki, you see this first.

Quote:

vertexShaderConstant[16]=0.5; // outline thickness


Its very missleading... since I always thought that I was to put it in the script too...


But you DONT! wink

Its inside the mtl_toon material action above(that I posted), Take a look.
Thats what will change the outline thickness.

After that, all you do is add my.material = to the action like this:


Code:
action ent_player{
	
	player = me;
	my.shadow= on;
	my.fat = off;
	my.narrow = off;
	my.polygon = off;
	
//////-----CHECK IT OUT
	my.material = mtl_toon;

}




Thats all.


I bet thats why it wasn't working for you.

EDIT:

You also need this with your bmaps

Code:
bmap bmp_toonlookup=<toonlookup.tga>;



and you also need the small black to white image called toonlookup7yrs.

Rename it to toonlookup

And using photoshop (or some other program like it since paint cant do it) and change the file type from either BMP or PNG Whatever you saved it as from the wiki.
It must be in your project folder.

Now, thats all.

Last edited by DevoN; 08/11/09 22:48.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Re: how to add a shader to my game step by step? [Re: DLively] #284557
08/13/09 21:38
08/13/09 21:38
Joined: Jul 2009
Posts: 39
Chile!
Renard Offline OP
Newbie
Renard  Offline OP
Newbie

Joined: Jul 2009
Posts: 39
Chile!
oK i`ll give it a try, thxs a lot!
i had that same problem with the line thickness!
i also had a problem with the lines, they had all the colors of the rainbow! laugh
so i`ll try as you said.
laugh

___________________________________

OK, It worked! but i`m getting a shadow over the whole model, not only the lines around, i tried changing line`s thickness but didn`t work.
any advice please?

Last edited by Renard; 08/15/09 20:45.

WRYYYYYYYYYYYYYYYYYY!!!1!!ONE!!11

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