Hi,

I've started playing around with some basic HLSL shaders, however I got a few questions laugh

1. How do I scale a mesh from the vertex shader?
I've tried this:
Code:
struct VS_OUTPUT1
{
	float4 Pos :	POSITION;
};

VS_OUTPUT1 vs_main1(float4 inPos: POSITION,float3 inNormal: NORMAL)
{
	VS_OUTPUT1 Out;
	
	inPos.x += inNormal.x;
	inPos.y += inNormal.y;
	inPos.z += inNormal.z;
	
	Out.Pos = mul(inPos,matWorldViewProj);
	
	return Out;
}


It doesn't seem to be the best way of doing it though - look at the screenshot below, as the black outline is scaled using this code (the outline got a few flaws).

2. How do I render pass2 in my technique atop pass1?
I tried using "zenable = false" for my outline in pass1 - it worked fine in RenderMonkey, but when I tried it inside an actual game world, the outline was - of course - drawn atop other objects as well.

Here's a screenshot and my full code:


Code:
MATERIAL* mat_outline =
{
	effect = "
	
	texture entSkin1;
	
	sampler tSkin = sampler_state {Texture = <entSkin1>;};
	
	float4x4 matWorldViewProj;
	
	////////////////////// - PASS ONE CODE - //////////////////////
	struct VS_OUTPUT1
	{
		float4 Pos :	POSITION;
	};
	
	VS_OUTPUT1 vs_main1(float4 inPos: POSITION,float3 inNormal: NORMAL)
	{
		VS_OUTPUT1 Out;
		
		inPos.x += inNormal.x;
		inPos.y += inNormal.y;
		inPos.z += inNormal.z;
		
		Out.Pos = mul(inPos,matWorldViewProj);
		
		return Out;
	}
	
	float4 ps_main1() :	COLOR0
	{
		float4 color;
		
		color[0] = 0;
		color[1] = 0;
		color[2] = 0;
		color[3] = 1;
		
		return color;
	}
	
	////////////////////// - PASS TWO CODE - //////////////////////
	struct VS_OUTPUT2
	{
		float4 Pos :	POSITION;
		float2 Tex :	TEXCOORD0;
	};
	
	VS_OUTPUT2 vs_main2(float4 inPos: POSITION,float2 inTex: TEXCOORD0)
	{
		VS_OUTPUT2 Out;
		
		Out.Pos = mul(inPos,matWorldViewProj);
		Out.Tex = inTex;
		
		return Out;
	}
	
	float4 ps_main2(float2 inTex: TEXCOORD0) :	COLOR0
	{
		float4 color;
		
		color = tex2D(tSkin,inTex);
		
		return color;
	}
	
	////////////////////// - TECHNIQUE CODE - /////////////////////
	technique outline_technique
	{
		pass p1
		{
			zenable = false;
			VertexShader = compile vs_1_1 vs_main1();
			PixelShader = compile ps_2_0 ps_main1();
		}
		
		pass p2
		{
			zenable = true;
			VertexShader = compile vs_1_1 vs_main2();
			PixelShader = compile ps_2_0 ps_main2();
		}
	}
	
	";
}