|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Outline-Shader + Alpha-Skin at Models????
#258710
04/01/09 17:05
04/01/09 17:05
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
OP
Expert
|
OP
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
ok.. after bumping, i try my luck here... I use this shadercode ( thx to cowabanga ):
float4x4 matWorldViewProj;
struct VS_IN
{
float4 pos : POSITION;
float4 nrm : NORMAL;
};
struct VS_OUT
{
float4 oPos : POSITION;
float4 oC0 : COLOR0;
float4 oC1 : COLOR1;
};
VS_OUT OutlineVS (VS_IN In, uniform float scale, uniform float3 rgb)
{
VS_OUT Out;
In.pos.xyz += In.nrm.xyz*scale;
Out.oPos = mul(In.pos,matWorldViewProj);
Out.oC0 = Out.oC1 = float4(rgb,1.0);
return Out;
}
technique test
{
pass p1
{
CullMode = CCW;
}
pass p0
{
CullMode = CW;
VertexShader = compile vs_2_0 OutlineVS(0.5,float3(0.0,0,0)); // thickness , rgb
}
}
Now i recognized: If i use a model, with an alpha-TGA File as Skin.. the complete model is Transparent like the alpha.. but completely black... Any idea how to add the Alpha-TGA Support to that shader???
Last edited by Espér; 04/01/09 17:07. Reason: changed the outline thickness to 0.5
|
|
|
Re: Outline-Shader + Alpha-Skin at Models????
[Re: Espér]
#258737
04/01/09 19:45
04/01/09 19:45
|
Joined: Oct 2007
Posts: 5,209 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
|
im not very good at shaders but:
float4x4 matWorldViewProj;
struct VS_IN
{
float4 pos : POSITION;
float4 nrm : NORMAL;
float4 iC0 : COLOR0;
float4 iC1 : COLOR1;
};
struct VS_OUT
{
float4 oPos : POSITION;
float4 oC0 : COLOR0;
float4 oC1 : COLOR1;
};
VS_OUT OutlineVS (VS_IN In, uniform float scale, uniform float3 rgb)
{
VS_OUT Out;
In.pos.xyz += In.nrm.xyz*scale;
Out.oPos = mul(In.pos,matWorldViewProj);
Out.oC0 = float4(rgb,1.0);
Out.oC1 = In.iC1;
return Out;
}
float4 OutlinePS(VS_OUT In) : COLOR
{
return In.oC1;
}
technique test
{
pass p1
{
CullMode = CCW;
}
pass p0
{
CullMode = CW;
VertexShader = compile vs_2_0 OutlineVS(0.2,float3(0.0,0,0)); // thickness , rgb
PixelShader = compile ps_2_0 OutlinePS();
}
}
edit: 1 made the thickness 0.2, change with your value.
Last edited by Quadraxas; 04/01/09 19:46.
3333333333
|
|
|
Re: Outline-Shader + Alpha-Skin at Models????
[Re: Espér]
#258825
04/02/09 10:27
04/02/09 10:27
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
Here: technique test
{
pass p1
{
zWriteEnable = true;
CullMode = CCW;
}
pass p0
{
zWriteEnable = true;
CullMode = CW;
VertexShader = compile vs_2_0 OutlineVS(0.5,float3(0.0,0,0)); // thickness , rgb
}
}
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: Outline-Shader + Alpha-Skin at Models????
[Re: Espér]
#261916
04/21/09 01:20
04/21/09 01:20
|
Joined: Oct 2004
Posts: 897 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 897
Lgh
|
Hi, Check this 022_Kristallspinnenbaby2.mdl converted model by me, maybe work it now. I´ve just converted the normals on your model.
|
|
|
|