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

Expert
|

Expert
Joined: Dec 2000
Posts: 4,608
|
|
|
|
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
OP
Serious User
|
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]
#120212
03/31/07 04:14
03/31/07 04:14
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
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
|
|
|
|