Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Expert
Espér  Offline 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 ):
Code:
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

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
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 Offline
Senior Expert
Quad  Offline
Senior Expert

Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
im not very good at shaders but:
Code:
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: Quad] #258742
04/01/09 20:40
04/01/09 20:40
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
try adding zWriteEnable = true; to both passes.


xXxGuitar511
- Programmer
Re: Outline-Shader + Alpha-Skin at Models???? [Re: xXxGuitar511] #258743
04/01/09 20:44
04/01/09 20:44
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
where????
I´m absolute Noob in Shader Coding..


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
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 Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Here:
Code:
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: WretchedSid] #258843
04/02/09 12:56
04/02/09 12:56
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Hmm.. isn´t working right:


That crystal spider has to be Semi-transparent ( and not black >.< )..

Here´s the model file (tga textures included ):
>> Gegner.rar <<

Last edited by Espér; 04/03/09 00:05.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Outline-Shader + Alpha-Skin at Models???? [Re: Espér] #261901
04/20/09 22:44
04/20/09 22:44
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
ok.. the problem still exists...

any idea how to fix that?


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
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 Offline
User
rojart  Offline
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.


Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P

Moderated by  adoado, checkbutton, mk_1, Perro 

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