I came up with this code at the end (vertex lightning):
Code
#include <transform>
#include <fog>
#include <pos>
#include <normal>
#include <light>
#include <color>

#define DXLIGHTING
#define DXFOG

struct vertexOut
{
	float4 Pos : POSITION;
	float Fog : FOG;
	float4 Color : COLOR0;
	float2 Tex : TEXCOORD0;
	float2 LM : TEXCOORD1;
};

vertexOut solid_VS (
in float4 inPos : POSITION, 
in float3 inNormal : NORMAL,
in float2 inTex : TEXCOORD0,
in float2 inLM : TEXCOORD1
)
{
	vertexOut Out;
	Out.Pos = DoTransform(inPos);
	Out.Pos *= inPos.w / length(mul(inPos, matWorldViewProj));
	Out.Tex = inTex;
	Out.LM = inLM;
	Out.Fog = DoFog(inPos);
	float3 P = DoPos(inPos);
	float3 N = DoNormal(inNormal);

	float3 Color = 0; 
	for (int i = 0; i < 8; i++)  // add 8 dynamic lights
	{
		Color += DoLight(P, N, i);
	}

	Out.Color = 0.5 * DoAmbient() + 0.5 * float4(Color, 1) * vecDiffuse;

	return Out;		
}

technique solid
{
	pass one
	{		
		CullMode = None;
		ZWriteEnable = True;
		AlphaBlendEnable = False;
		AlphaTestEnable = False;
		
		VertexShader = compile vs_2_0 solid_VS();
	}
}

technique fallback { pass one { } }
However for unknown (for me) reasons, this line:
Code
Out.Pos *= inPos.w / length(mul(inPos, matWorldViewProj));
Removes the fog.. Also, I don't know how to add static lightmap to this lightning using default.fx grin
Code
		#ifdef DXFOG
			float DoFog(float4 Pos)
			{
				float3 P = mul(Pos,matWorldView).xyz; // convert vector to view space to get it's depth (.z)
				return saturate((vecFog.y-P.z) * vecFog.z); // apply the linear fog formula
			}
			#else // distance based fog
			float DoFog(float4 Pos)
			{
				float3 P = mul(Pos,matWorld).xyz;
				return 1 - (distance(P,vecViewPos.xyz)-vecFog.x) * vecFog.z;
			}
		#endif


[Linked Image]


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung