Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 10:32
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, alibaba, fairtrader, ozgur, TipmyPip, Quad), 604 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
toonshader alpha problem #120207
03/30/07 09:31
03/30/07 09:31
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
and here i am again, with a new problem:
I wrote an easy toon-shader, i got that i can set the transparent of the entity, my problem is, that all parts of entitis behind the shaded one were clipped...its something with that zwrite i guess.
So is there a flag that i can set, so that it dont behave so?

Scorpion

Re: toonshader alpha problem [Re: Scorpion] #120208
03/30/07 15:17
03/30/07 15:17
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
Code?!


Follow me on twitter
Re: toonshader alpha problem [Re: mk_1] #120209
03/30/07 15:25
03/30/07 15:25
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
Code:
float4x4 matWorldViewProj; 
float4x4 matWorld;

float4 vecSunDir;
float4 vecSkill41;

texture mtlSkin1;//the shade map
texture entSkin1;//the model texture

sampler shademap = sampler_state
{
Texture = <mtlSkin1>;
};

sampler2D skin = sampler_state
{
Texture = <entSkin1>;
};

void shadedVS( in float4 pos :POSITION,
in float3 N :NORMAL,
in float2 Tex :TEXCOORD0,
out float4 opos :POSITION,
out float2 oTex :TEXCOORD0,
out float shadecrd :TEXCOORD1)
{
opos=mul(pos,matWorldViewProj);
oTex=Tex;
float3 normal = normalize(mul(N,matWorld));
shadecrd = 0.5* (dot(normal,-vecSunDir))+0.5;
}

float4 shadedPS( in float2 Tex :TEXCOORD0,
in float shadecrd :TEXCOORD1):COLOR
{
float4 skin = tex2D(skin,Tex);
float4 shaded = tex1D(shademap,shadecrd);
shaded.w=vecSkill41.w;
return skin*shaded;
}

void outlineVS( in float4 pos :POSITION,
in float3 N :NORMAL,
out float4 oPos :POSITION)
{
pos.xyz+=N.xyz;
oPos=mul(pos,matWorldViewProj);
}

float4 outlinePS():COLOR
{
float4 black = 0;
black.w = vecSkill41.w;
return black;
}

technique toon
{
pass shade
{
alphablendenable=true;
VertexShader = compile vs_1_1 shadedVS();
PixelShader = compile ps_1_4 shadedPS();
}
pass outline
{
alphablendenable=true;
VertexShader = compile vs_2_0 outlineVS();
PixelShader = compile ps_1_4 outlinePS();
cullmode=cw;
}
}



Last edited by Scorpion; 03/30/07 15:30.
Re: toonshader alpha problem [Re: Scorpion] #120210
03/30/07 15:51
03/30/07 15:51
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
Maybe you don't mean "clipped" but black? That happens because of your second pass...


Follow me on twitter
Re: toonshader alpha problem [Re: mk_1] #120211
03/30/07 18:36
03/30/07 18:36
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
no, i mean clipped. The parts of models behind the model with toonshader arent visible.
And because the outline i have the nice cullmode=cw;

Re: toonshader alpha problem [Re: Scorpion] #120212
03/31/07 04:14
03/31/07 04:14
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
I see what your saying, this happened too a while ago with a glow shader. There problem had something to do with setting (or not setting) the transparent flag on their entity.


xXxGuitar511
- Programmer
Re: toonshader alpha problem [Re: xXxGuitar511] #120213
03/31/07 10:14
03/31/07 10:14
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
yes, that it will be...i turned the transparent flag off...but as far as i know u can set every value manual in the shader, so that gs just set a "default" of it by the flags.

Re: toonshader alpha problem [Re: Scorpion] #120214
03/31/07 10:23
03/31/07 10:23
Joined: Dec 2000
Posts: 4,608
mk_1 Offline

Expert
mk_1  Offline

Expert

Joined: Dec 2000
Posts: 4,608
AlphaBlendEnable = true;
To set in the pass.


Follow me on twitter
Re: toonshader alpha problem [Re: mk_1] #120215
03/31/07 10:33
03/31/07 10:33
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline OP
Serious User
Scorpion  Offline OP
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
if you had looked at my shader u would have seen that i did that already


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