Includes = {
	"constants.fxh"
	"standardfuncsgfx.fxh"
	"shadow.fxh"
	"tiled_pointlights.fxh"
}

PixelShader =
{
	Samplers =
	{
		DiffuseMap =
		{
			Index = 0
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		SpecularMap =
		{
			Index = 1
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		NormalMap =
		{
			Index = 2
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		FlagMap =
		{
			Index = 3
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "None"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		EnvironmentMap =
		{
			Index = 4
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Clamp"
			AddressV = "Clamp"
			Type = "Cube"
		}
		LightIndexMap =
		{
			Index = 5
			MagFilter = "Point"
			MinFilter = "Point"
			MipFilter = "Point"
			AddressU = "Clamp"
			AddressV = "Clamp"
		}
		LightDataMap =
		{
			Index = 6
			MagFilter = "Point"
			MinFilter = "Point"
			MipFilter = "Point"
			AddressU = "Clamp"
			AddressV = "Clamp"
		}
		LavaNoise =
		{
			Index = 7
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Clamp"
			AddressV = "Clamp"
			Type = "Cube"
		}
		LavaDiffuse = 
		{
			Index = 8
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		StoneDiffuse = 
		{
			Index = 9
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		NightLights = 
		{
			Index = 10
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}	
		CustomTexture = 
		{
			Index = 11
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		PortraitCharacter = 
		{
			Index = 12
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		PortraitClothes = 
		{
			Index = 13
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
		PortraitHair = 
		{
			Index = 14
			MagFilter = "Linear"
			MinFilter = "Linear"
			MipFilter = "Linear"
			AddressU = "Wrap"
			AddressV = "Wrap"
		}
	}
}


VertexStruct VS_INPUT_PDXMESHSTANDARD
{
    float3 vPosition		: POSITION;
	float3 vNormal      	: TEXCOORD0;
	float4 vTangent			: TEXCOORD1;
	float2 vUV0				: TEXCOORD2;
	float2 vUV1				: TEXCOORD3;
};

VertexStruct VS_INPUT_PDXMESHSTANDARD_SKINNED
{
    float3 vPosition		: POSITION;
	float3 vNormal      	: TEXCOORD0;
	float4 vTangent			: TEXCOORD1;
	float2 vUV0				: TEXCOORD2;
	float2 vUV1				: TEXCOORD3;
	uint4 vBoneIndex 		: TEXCOORD4;
	float3 vBoneWeight		: TEXCOORD5;
};

VertexStruct VS_OUTPUT_PDXMESHSTANDARD
{
    float4 vPosition	: PDX_POSITION;
	float3 vNormal		: TEXCOORD0;
	float3 vTangent		: TEXCOORD1;
	float3 vBitangent	: TEXCOORD2;
	float2 vUV0			: TEXCOORD3;
	float2 vUV1			: TEXCOORD4;
	float4 vPos			: TEXCOORD5;
	float4 vSphere		: TEXCOORD6;
};

VertexStruct VS_OUTPUT_PDXMESHSHADOW
{
    float4 vPosition	: PDX_POSITION;
	float4 vDepthUV0	: TEXCOORD0;
};

VertexStruct VS_INPUT_DEBUGNORMAL
{
    float3 vPosition		: POSITION;
	float3 vNormal      	: TEXCOORD0;
	float4 vTangent			: TEXCOORD1;
	float2 vUV0				: TEXCOORD2;
	float2 vUV1				: TEXCOORD3;
	float  vOffset      	: TEXCOORD6;
};

VertexStruct VS_INPUT_DEBUGNORMAL_SKINNED
{
    float3 vPosition		: POSITION;
	float3 vNormal      	: TEXCOORD0;
	float4 vTangent			: TEXCOORD1;
	float2 vUV0				: TEXCOORD2;
	float2 vUV1				: TEXCOORD3;
	uint4 vBoneIndex		: TEXCOORD4;
	float3 vBoneWeight		: TEXCOORD5;
	float  vOffset      	: TEXCOORD6;
};

VertexStruct VS_OUTPUT_DEBUGNORMAL
{
    float4 vPosition : PDX_POSITION;
	float2 vUV0		 : TEXCOORD0;
	float  vOffset	 : TEXCOORD1;
};


VertexStruct VS_OUTPUT_PDXMESHNAVIGATIONBUTTON
{
    float4 vPosition	: PDX_POSITION;
	float2 vUV0			: TEXCOORD0;
	float4 vPos			: TEXCOORD1;
};

VertexStruct VS_OUTPUT_PDXMESHSHIELD
{
	float4 vPosition	: PDX_POSITION;
	float2 vUV0			: TEXCOORD0;
	float4 vPos			: TEXCOORD1;
};


ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix;
	#SEntityCustomDataInstance
	float2 vUVAnimationDir;
	float  vUVAnimationTime;
	float  vBloomFactor;
	
	#SGameShipConstants
	float4 PrimaryColor;
	float vSelected;
	float vDamage;
	
	#SShipLightData
	float2		CamLightIntensityNearFar;
	float3		CamLightDir[3];
	float2		CamLightFadeStartStop;
	float2		RimLightStartNearFar; 
	float2		RimLightStopNearFar;
	float2		AmbientIntensityNearFar;
	#MAXED OUT! any more and we will start overlapping with the bone matrices
};

ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix_Duplicate2;
	float Glossiness_;
	float Specular_;
	float Metalness_;
};

ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix_Duplicate3;
	#SEntityCustomDataInstance
	float2 dup1_vUVAnimationDir;
	float  dup1_vUVAnimationTime;
	float  dup1_vBloomFactor
	
	#SPlanetMeshUserData
	float4 AtmosphereColor;
	float AtmosphereIntensity;
	float AtmosphereWidth;
	float Sensor;
	float Colonized;
};

ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix_Duplicate4;
	#SEntityCustomDataInstance
	float2 dup2_vUVAnimationDir;
	float  dup2_vUVAnimationTime;
	float  dup2_vBloomFactor;
	
	#SStarMeshUserData
	float3 LavaBrightColor;
	float Time;	
	float3 LavaHotStoneColor;
	float StarAtmosphereIntensity;
	float3 LavaColdStoneColor;
	float StarAtmosphereWidth;	
	float4 StarAtmosphereColor;
	
	#more lava settings
};

ConstantBuffer( 1,28 )
{
	float4x4 WorldMatrix_Duplicate5;
	float4 BARPrimaryColor;
	float  vProgressBarValue;
};

ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix_Duplicate6;
	float4 ProgressBarPrimaryColor;
	float  vHPBarPadding;
	float  vHealth;
};

ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix_Duplicate7;
	float	vOverValue;
	float	vDownValue;
	float 	vSelectedValue;
	float 	vIntelValue;
};

ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix_Duplicate8;
	float2 dup3_vUVAnimationDir;
	float  dup3_vUVAnimationTime;
	float  dup3_vBloomFactor;
};

ConstantBuffer( 1, 28 )
{
	float4x4 WorldMatrix_Duplicate9;
	float3	ObjectPos;
	float	vNumLoops;
	float3	ObjectDir;
	float	vTimePerLoop;
	float3	ObjectScale;
	float	vObjectTime;
};

ConstantBuffer( 1, 28 )	#construction
{
	float4x4 WorldMatrix_Duplicate10;
	float vConstructionProgress;
}

ConstantBuffer( 1, 28 )	#construction
{
	float4x4 WorldMatrix_Duplicate11;
	float4 	vAuraColor;
	float	vAuraRadius;
}

ConstantBuffer( 0, 0 )
{
	float4x4	ViewProjectionMatrix_Duplicate1;
	float 		PortraitMipLevel;
	float		CustomDiffuseTexture;
}

ConstantBuffer( 2, 41 )
{
	float4x4 matBones[50]; // : Bones :register( c41 ); // 50 * 4 registers 41 - 241 
};

Code
[[

static const int PDXMESH_MAX_INFLUENCE = 4;
	
	
]]

PixelShader = 
{
	Code
	[[
		void CalculateShipCameraLights( LightingProperties aProperties, float aShadowFactor, inout float3 aDiffuseLightOut, inout float3 aSpecularLightOut )
		{
			for( int i = 0; i < 3; ++i )
			{
				float3 vLightDir = CamLightDir[i].x * vCamRightDir + CamLightDir[i].y * vCamUpDir + CamLightDir[i].z * vCamLookAtDir;
				if( dot( vLightDir, vLightDir ) > 0.f )
				{
					normalize( vLightDir );
					
					float vCamDistance = length( aProperties._WorldSpacePos - vCamPos );
					float vFadeValue = saturate( ( vCamDistance - CamLightFadeStartStop.x ) / ( CamLightFadeStartStop.y - CamLightFadeStartStop.x ) );
					float vIntensity = lerp( CamLightIntensityNearFar.x, CamLightIntensityNearFar.y, vFadeValue );
					
					float3 diffLight = vec3(0.0);
					float3 specLight = vec3(0.0);
					#ifdef PDX_IMPROVED_BLINN_PHONG
						ImprovedBlinnPhong( CamLightDiffuse[i], -vLightDir, aProperties, diffLight, specLight );
					#else
						diffLight = CalculateLight( aProperties._Normal, vLightDir, CamLightDiffuse[i] );
						specLight = CalculatePBRSpecularPower( aProperties._WorldSpacePos, aProperties._Normal, aProperties._SpecularColor, aProperties._Glossiness, CamLightDiffuse[i], vLightDir);
					#endif
					aDiffuseLightOut += diffLight * aShadowFactor * vIntensity;
					aSpecularLightOut += specLight * aShadowFactor * vIntensity;
				}
			}
		}
	]]
}

VertexShader =
{
	MainCode VertexPdxMeshBillboard
	[[
		VS_OUTPUT_PDXMESHSTANDARD main( const VS_INPUT_PDXMESHSTANDARD v )
		{
		  	VS_OUTPUT_PDXMESHSTANDARD Out;
					
			float4 vPosition = float4( 0.f, 0.f, 0.f, 1.0f );
			vPosition.xyz = 
				( vCamRightDir * v.vPosition.x )
				+ ( vCamUpDir * v.vPosition.y )
				- ( vCamLookAtDir * v.vPosition.z );
			vPosition.y *= -1;
			Out.vSphere = vPosition;
			Out.vNormal = normalize( mul( CastTo3x3( WorldMatrix ), v.vNormal ) );

			#ifdef IS_STAR
				Out.vTangent = normalize( vPosition.xyz ); //Use tangent for position
			#else
				Out.vTangent = normalize( mul( CastTo3x3( WorldMatrix ), v.vTangent.xyz ) );
			#endif
			Out.vBitangent = normalize( cross( Out.vNormal, Out.vTangent ) * v.vTangent.w );

			Out.vPosition = mul( WorldMatrix, vPosition );
			
			Out.vPos = Out.vPosition;
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );
			
			Out.vUV0 = v.vUV0;
			Out.vUV1 = v.vUV1;
			
			return Out;
		}
	]]
	MainCode VertexPdxMeshStandard
	[[
		VS_OUTPUT_PDXMESHSTANDARD main( const VS_INPUT_PDXMESHSTANDARD v )
		{
		  	VS_OUTPUT_PDXMESHSTANDARD Out;
					
			float4 vPosition = float4( v.vPosition.xyz, 1.0f );
			Out.vSphere = float4( v.vPosition, 1.0f );
			Out.vNormal = normalize( mul( CastTo3x3( WorldMatrix ), v.vNormal ) );
						
			#ifdef IS_STAR
				Out.vTangent = normalize( v.vPosition.xyz ); //Use tangent for position
			#else
				Out.vTangent = normalize( mul( CastTo3x3( WorldMatrix ), v.vTangent.xyz ) );
			#endif
			Out.vBitangent = normalize( cross( Out.vNormal, Out.vTangent ) * v.vTangent.w );

			Out.vPosition = mul( WorldMatrix, vPosition );
			
			Out.vPos = Out.vPosition;
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );
			
			Out.vUV0 = v.vUV0;
			Out.vUV1 = v.vUV1;
			
			return Out;
		}
		
	]]

	MainCode VertexPdxMeshStandardSkinned
	[[
		VS_OUTPUT_PDXMESHSTANDARD main( const VS_INPUT_PDXMESHSTANDARD_SKINNED v )
		{
		  	VS_OUTPUT_PDXMESHSTANDARD Out;
					
			float4 vPosition = float4( v.vPosition.xyz, 1.0 );
			float4 vSkinnedPosition = float4( 0, 0, 0, 0 );
			float3 vSkinnedNormal = float3( 0, 0, 0 );
			float3 vSkinnedTangent = float3( 0, 0, 0 );
			float3 vSkinnedBitangent = float3( 0, 0, 0 );
		
			float4 vWeight = float4( v.vBoneWeight.xyz, 1.0f - v.vBoneWeight.x - v.vBoneWeight.y - v.vBoneWeight.z );
		
			for( int i = 0; i < PDXMESH_MAX_INFLUENCE; ++i )
		    {
				int nIndex = int( v.vBoneIndex[i] );
				float4x4 mat = matBones[nIndex];
				vSkinnedPosition += mul( mat, vPosition ) * vWeight[i];
		
				float3 vNormal = mul( CastTo3x3(mat), v.vNormal );
				float3 vTangent = mul( CastTo3x3(mat), v.vTangent.xyz );
				float3 vBitangent = cross( vNormal, vTangent ) * v.vTangent.w;
		
				vSkinnedNormal += vNormal * vWeight[i];
				vSkinnedTangent += vTangent * vWeight[i];
				vSkinnedBitangent += vBitangent * vWeight[i];
			}
		
			Out.vSphere = float4( v.vPosition, 1.0f );
			
			Out.vPosition = mul( WorldMatrix, vSkinnedPosition );
			Out.vPos = Out.vPosition;
			Out.vPos /= WorldMatrix[3][3];
			
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );
			Out.vNormal = normalize( mul( CastTo3x3(WorldMatrix), normalize( vSkinnedNormal ) ) );
			#ifdef IS_STAR
				Out.vTangent = normalize( v.vPosition.xyz ); //Use tangent for position
			#else
				Out.vTangent = normalize( mul( CastTo3x3(WorldMatrix), normalize( vSkinnedTangent ) ) );
			#endif
			Out.vBitangent = normalize( mul( CastTo3x3(WorldMatrix), normalize( vSkinnedBitangent ) ) );
		
			Out.vUV0 = v.vUV0;
			Out.vUV1 = v.vUV1;
			
			return Out;
		}
		
	]]

	MainCode VertexPdxMeshStandardShadow
	[[
		VS_OUTPUT_PDXMESHSHADOW main( const VS_INPUT_PDXMESHSTANDARD v )
		{
		  	VS_OUTPUT_PDXMESHSHADOW Out;
			float4 vPosition = float4( v.vPosition.xyz, 1.0 );
			Out.vPosition = mul( WorldMatrix, vPosition );
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );
			Out.vDepthUV0 = float4( Out.vPosition.zw, v.vUV0 );
			return Out;
		}
		
	]]

	MainCode VertexPdxMeshStandardSkinnedShadow
	[[
		VS_OUTPUT_PDXMESHSHADOW main( const VS_INPUT_PDXMESHSTANDARD_SKINNED v )
		{
		  	VS_OUTPUT_PDXMESHSHADOW Out;
					
			float4 vPosition = float4( v.vPosition.xyz, 1.0 );
			float4 vSkinnedPosition = float4( 0, 0, 0, 0 );
		
			float4 vWeight = float4( v.vBoneWeight.xyz, 1.0f - v.vBoneWeight.x - v.vBoneWeight.y - v.vBoneWeight.z );
		
			for( int i = 0; i < PDXMESH_MAX_INFLUENCE; ++i )
		    {
				int nIndex = int( v.vBoneIndex[i] );
				float4x4 mat = matBones[nIndex];
				vSkinnedPosition += mul( mat, vPosition ) * vWeight[i];
			}
		
			Out.vPosition = mul( WorldMatrix, vSkinnedPosition );
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );
			Out.vDepthUV0 = float4( Out.vPosition.zw, v.vUV0 );
			return Out;
		}
		
	]]

	MainCode VertexDebugNormal
	[[
		VS_OUTPUT_DEBUGNORMAL main( const VS_INPUT_DEBUGNORMAL v )
		{
		  	VS_OUTPUT_DEBUGNORMAL Out;
		
			Out.vPosition = mul( WorldMatrix, float4( v.vPosition.xyz, 1.0 ) );
			Out.vPosition.xyz += mul( CastTo3x3(WorldMatrix), v.vNormal ) * v.vOffset * 0.3f;
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );	
		
			Out.vUV0 = v.vUV0;
			Out.vOffset = v.vOffset; 
		
			return Out;
		}
		
	]]

	MainCode VertexDebugNormalSkinned
	[[
		VS_OUTPUT_DEBUGNORMAL main( const VS_INPUT_DEBUGNORMAL_SKINNED v )
		{
		  	VS_OUTPUT_DEBUGNORMAL Out;
					
			float4 vPosition = float4( v.vPosition.xyz, 1.0 );
			float4 vSkinnedPosition = float4( 0, 0, 0, 0 );
			float3 vSkinnedNormal = float3( 0, 0, 0 );
		
			float4 vWeight = float4( v.vBoneWeight.xyz, 1.0f - v.vBoneWeight.x - v.vBoneWeight.y - v.vBoneWeight.z );
		
			for( int i = 0; i < PDXMESH_MAX_INFLUENCE; ++i )
		    {
				int nIndex = int( v.vBoneIndex[i] );
				float4x4 mat = matBones[nIndex];
				vSkinnedPosition += mul( mat, vPosition ) * vWeight[i];	
				vSkinnedNormal += mul( CastTo3x3(mat), v.vNormal ) * vWeight[i];
			}
		
			Out.vPosition = mul( WorldMatrix, vSkinnedPosition );
			vSkinnedNormal = normalize( mul( CastTo3x3(WorldMatrix), vSkinnedNormal ) );
			Out.vPosition.xyz += vSkinnedNormal * v.vOffset * 0.3f * WorldMatrix[ 3 ][ 3 ];
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );	
		
			Out.vUV0 = v.vUV0;
			Out.vOffset = v.vOffset; 
			return Out;
		}
		
	]]
	
	MainCode VertexPdxMeshNavigationButton
	[[
		VS_OUTPUT_PDXMESHNAVIGATIONBUTTON main( const VS_INPUT_PDXMESHSTANDARD v )
		{
		  	VS_OUTPUT_PDXMESHNAVIGATIONBUTTON Out;
					
			float4 vPosition = float4( v.vPosition.xyz, 1.0f );
			
			Out.vPosition = mul( WorldMatrix, vPosition );
			Out.vPos = Out.vPosition;
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );
			
			Out.vUV0 = v.vUV0;
			
			return Out;
		}
		
	]]
	
	MainCode VertexPdxMeshShieldHitEffect
	[[
		VS_OUTPUT_PDXMESHSHIELD main( const VS_INPUT_PDXMESHSTANDARD v )
		{
		  	VS_OUTPUT_PDXMESHSHIELD Out;
					
			float4 vPosition = float4( v.vPosition.xyz, 1.0f );
			
			Out.vPosition = mul( WorldMatrix, vPosition );
			
			float3 Up = float3( 0.f, 1.f, 0.f ); 
			float3 Side = cross( Up, ObjectDir );
			
			float3 vDelta = Out.vPosition.xyz - ObjectPos;
			//transform vDelta from ellipsoid-space to sphere-space
			vDelta = ( ObjectDir * ( dot( vDelta, ObjectDir ) / ObjectScale.z ) )
					+( Side		 * ( dot( vDelta, Side ) / ObjectScale.x ) )
					+( Up		 * ( dot( vDelta, Up ) / ObjectScale.y ) );
			vDelta = normalize( vDelta );
			
			//Out.vPosition.xyz = ObjectPos + vDelta * 10.f;
			Out.vPosition.xyz = ObjectPos;
			Out.vPosition.xyz += ObjectDir * ( dot( vDelta, ObjectDir ) * ObjectScale.z );
			Out.vPosition.xyz += Up * ( dot( vDelta, Up ) * ObjectScale.y );
			Out.vPosition.xyz += Side * ( dot( vDelta, Side ) * ObjectScale.x );
			
			Out.vPos = Out.vPosition; 
			Out.vPosition = mul( ViewProjectionMatrix, Out.vPosition );
			
			Out.vUV0 = v.vUV0;
			
			return Out;
		}
	]]
}

PixelShader =
{
	MainCode PixelPdxMeshStandard
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			const float MAX_BUILDINGS_FOR_NIGHT_LIGHTS = 14;
			float4 vDiffuse = tex2D( DiffuseMap, In.vUV0 + vUVAnimationDir * vUVAnimationTime );
		#ifdef GUI_ICON
			#ifndef IS_CLOUDS
				float Grey = dot( vDiffuse.rgb, float3( 0.212671f, 0.715160f, 0.072169f ) + vec3( 0.1f ) );
				vDiffuse.rgb = lerp( vDiffuse.rgb, vec3( Grey ), 0.4f );
			#endif
		#endif
		#ifdef TILING_AO
			vDiffuse.rgb *= tex2D( DiffuseMap, In.vUV1 ).a;
		#endif

		#ifdef ALPHA_TEST
			clip(vDiffuse.a - 1.0);
		#endif
		
			float3 vPos = In.vPos.xyz / In.vPos.w;
		
			float3 vColor = vDiffuse.rgb;
			float3 vInNormal = normalize( In.vNormal );
			float4 vProperties = tex2D( SpecularMap, In.vUV0 );
			
		#ifdef IS_PLANET	
			PointLight systemPointlight = GetPointLight(SystemLightPosRadius, SystemLightColorFalloff);
		#endif

			LightingProperties lightingProperties;
			lightingProperties._WorldSpacePos = vPos;
			lightingProperties._ToCameraDir = normalize(vCamPos - vPos);

		#ifdef IS_CLOUDS
			// Clip clouds at planet limit
			clip( saturate( dot( vInNormal, lightingProperties._ToCameraDir ) ) - 0.27f );
		#endif

		#ifdef IS_CLOUDS
				// Bend normals for clouds to reduce edge
				float3 vSystemLightDir = normalize( systemPointlight._Position - vPos );
				vInNormal = normalize( lerp( vInNormal, vSystemLightDir, 0.01f + 0.10f * vDiffuse.a ) );		
		#endif

		#ifdef PDX_IMPROVED_BLINN_PHONG
			float4 vNormalMap = tex2D( NormalMap, In.vUV0 );
			
			#ifdef EMISSIVE
				float vEmissive = vNormalMap.b;
			#endif
			float3 vNormalSample =  UnpackRRxGNormal(vNormalMap);
			
			lightingProperties._Glossiness = vProperties.a;
		#else
			#ifdef EMISSIVE
				float vEmissive = vProperties.b;
			#endif
			float3 vNormalSample = UnpackNormal( NormalMap, In.vUV0 );
			
			lightingProperties._SpecularColor = vec3(vProperties.a);
			#ifdef GLOSSINESS
				lightingProperties._Glossiness = vProperties.g * 2048.0 * vProperties.g + 0.00001; // Small epsilon to avoid 0^0
			#else
				lightingProperties._Glossiness = SPECULAR_WIDTH;
			#endif
		#endif
		
		#ifdef HACK
			#ifdef EMISSIVE
				vEmissive = vProperties.b;
			#endif
			vNormalSample = UnpackNormal( NormalMap, In.vUV0 );
			
			lightingProperties._Glossiness = Glossiness_;
			vProperties.g = Specular_;
			vProperties.b = Metalness_;
		#endif
			lightingProperties._NonLinearGlossiness = GetNonLinearGlossiness(lightingProperties._Glossiness);
		
		float vCubemapIntensity = CubemapIntensity;
		
		#ifdef ADD_COLOR
			 // Gamma - Linear ping pong
			 // All content is already created for gamma space math, so we do this in gamma space
			vColor = ToGamma(vColor);
			vColor = ToLinear(lerp( vColor, vColor * ( vProperties.r * PrimaryColor.rgb ), vProperties.r ));
		#endif

			float3x3 TBN = Create3x3( normalize( In.vTangent ), normalize( In.vBitangent ), vInNormal );
			float3 vNormal = normalize(mul( vNormalSample, TBN ));
			
			float fShadowTerm = 1.0f;
		
			lightingProperties._Normal = vNormal;
		#ifdef PDX_IMPROVED_BLINN_PHONG
			float SpecRemapped = vProperties.g * vProperties.g * 0.4;
			float MetalnessRemapped = 1.0 - (1.0 - vProperties.b) * (1.0 - vProperties.b);
			lightingProperties._Diffuse = MetalnessToDiffuse(MetalnessRemapped, vColor);
			lightingProperties._SpecularColor = MetalnessToSpec(MetalnessRemapped, vColor, SpecRemapped);
		#else
			lightingProperties._Diffuse = vColor;
		#endif
			
			float3 diffuseLight = vec3(0.0);
			float3 specularLight = vec3(0.0);
		#ifndef IGNORE_POINT_LIGHTS
			//CalculateSunLight(lightingProperties, fShadowTerm, diffuseLight, specularLight);
			CalculateSystemPointLight(lightingProperties, 1.0f, diffuseLight, specularLight);
			CalculatePointLights(lightingProperties, LightDataMap, LightIndexMap, diffuseLight, specularLight);
		#endif
			
		#ifdef EMISSIVE
			#ifndef IS_RING
			#ifndef NO_PLANET_EMISSIVE
				#ifdef IS_PLANET
					// Emissive only on dark side of planets
					float3 vSystemLightDir = normalize( systemPointlight._Position - lightingProperties._WorldSpacePos );
					float NdotL = saturate( saturate( dot( vInNormal, -vSystemLightDir ) - 0.05f ) * 5.0f );

					float vDarksideEmissive = 1.0f - saturate( length( diffuseLight + specularLight ) );
					vEmissive *= vDarksideEmissive * vProperties.r * NdotL;
					
					vCubemapIntensity *= ( 1.0f - vDarksideEmissive ) / 2.0f;
				#endif
			#endif
			#endif
		#endif

		#ifdef PDX_IMPROVED_BLINN_PHONG
			float3 vEyeDir = normalize( vPos - vCamPos.xyz );
			float3 reflection = reflect( vEyeDir, vNormal );
			float MipmapIndex = GetEnvmapMipLevel(lightingProperties._Glossiness); 
			
			#if 0
				float scale = 1.0 - exp2(MipmapIndex) / 256.0; // CubemapSize is the size of the base mipmap
				float M = max(max(abs(reflection.x), abs(reflection.y)), abs(reflection.z));
				if (abs(reflection.x) != M) reflection.x *= scale;
				if (abs(reflection.y) != M) reflection.y *= scale;
				if (abs(reflection.z) != M) reflection.z *= scale;
			#endif
			
			float3 reflectiveColor = texCUBElod( EnvironmentMap, float4(reflection, MipmapIndex) ).rgb * vCubemapIntensity;
			specularLight += reflectiveColor * FresnelGlossy(lightingProperties._SpecularColor, -vEyeDir, lightingProperties._Normal, lightingProperties._Glossiness);
		#endif
			vColor = ComposeLight(lightingProperties, 1.0f, diffuseLight, specularLight);

		#ifdef EMISSIVE
			vColor = lerp( vColor, vDiffuse.rgb, vEmissive );
			
			#ifndef IS_RING
			#ifndef NO_PLANET_EMISSIVE
				#ifdef IS_PLANET
				
					float4 vCityColor = tex2D( NightLights, In.vUV0 );
					//float vLights = saturate( mod( HdrRange_Time_ClipHeight.y*0.5f, 1.2f ) - 0.1f );
					//float vLights = saturate( 3.0f / MAX_BUILDINGS_FOR_NIGHT_LIGHTS );//Colonized / MAX_BUILDINGS_FOR_NIGHT_LIGHTS;
					float vLights = ( Colonized / MAX_BUILDINGS_FOR_NIGHT_LIGHTS );
					
					float vBrightness = vDarksideEmissive * vProperties.r * dot( vCityColor.rgb, vec3( 0.5 ) );	
					const float NUM_STEPS = 4;
					vLights = floor( ( 0.99f / NUM_STEPS + vLights ) * NUM_STEPS ) / (NUM_STEPS-1);
					//return float4( 1.f-vLights, vLights, 0.f, 1.f );
					vBrightness *= saturate( ( vLights - (1.f-vCityColor.a) ) * NUM_STEPS );
					//return vBrightness + vCityColor.a * 0.25f;
					vColor = saturate( vColor + vCityColor.rgb * vBrightness );
					vEmissive = max( vEmissive, vBrightness );
				#endif
			#endif
			#endif
		#endif	

		#ifndef IS_RING
			#ifdef IS_PLANET			
			#ifdef GUI_ICON
				const float vWidth = 2.1f;
				const float vIntensity = 0.85f;
				float vAtmosphere = saturate( dot( vInNormal, -lightingProperties._ToCameraDir ) + AtmosphereWidth * vWidth ) * vIntensity;
			#else
				float vAtmosphere = saturate( dot( vInNormal, -lightingProperties._ToCameraDir ) + AtmosphereWidth);
			#endif
				vColor = lerp( vColor, AtmosphereColor.rgb, vAtmosphere * vAtmosphere * AtmosphereColor.a * AtmosphereIntensity );
			#endif
		#endif

			DebugReturn(vColor, lightingProperties, fShadowTerm);
				
			float alpha = vDiffuse.a;
		#ifdef EMISSIVE
			#ifndef GUI_ICON
			#ifndef NO_ALPHA_MULTIPLIED_EMISSIVE
				alpha *= vEmissive;
			#endif
			#endif
		#endif
		#ifdef IS_PLANET
			#ifdef GUI_ICON
				vColor = vColor * Sensor + float3( 0.3f, 0.3f, 0.3f ) * ( 1.0f - Sensor );
				#ifdef IS_RING
					alpha *= 4.5f;
				#endif
			#else
				vColor = vColor * Sensor + ToLinear( float3( 0.3f, 0.3f, 0.3f ) * ( 1.0f - Sensor ) );
			#endif
		#endif

		#ifdef RIM_LIGHT
			float vRim = smoothstep( RIM_START, RIM_END, 1.0f - dot( vInNormal, lightingProperties._ToCameraDir ) );
			vColor.rgb = lerp( vColor.rgb, RIM_COLOR.rgb, vRim );
		#endif
			alpha *= vBloomFactor;
			return float4(vColor, alpha);
		}
		
	]]

	MainCode PixelPdxMeshShip
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			const float  DMG_START		= 0.5f;
			const float  DMG_END		= 1.0f;
			const float  DMG_TILING		= 3.5f;
			const float  DMG_EDGE		= 0.0f;
			const float3 DMG_EDGE_COLOR	= float3( 10.0f, 6.6f, 0.1f );
			
			float4 vDiffuse = tex2D( DiffuseMap, In.vUV0 + vUVAnimationDir * vUVAnimationTime );
			
			float3 vPos = In.vPos.xyz / In.vPos.w;
		
			float3 vInNormal = normalize( In.vNormal );
			float4 vProperties = tex2D( SpecularMap, In.vUV0 );
			
			//Fade in damage texture
			float4 vDamageTex = tex2D( CustomTexture, In.vUV0 * DMG_TILING );
			//float vDmgTemp = 1.0f;
			float vDmgTemp = vDamage;
			//float vDmgTemp = saturate( mod( HdrRange_Time_ClipHeight.y * 0.25f, 1.25f ) );
			vDmgTemp = 1.0f - saturate( ( vDmgTemp - DMG_START ) / ( DMG_END - DMG_START ) );
			float vDamageValue = ( vDamageTex.a - vDmgTemp ) * 5.0f;
			if( vDamageTex.a <= 0.001f )
			{
				vDamageValue = 0.f;
			}
			float vDamageEdge = DMG_EDGE * saturate( 1.0f - abs( ( vDamageValue - 0.5 ) * 2 ) );
			vDamageValue = saturate( vDamageValue );
			vDiffuse.rgb = lerp( vDiffuse.rgb, vDamageTex.rgb, vDamageValue );
			vProperties = lerp( vProperties, vec4( 0.f ), vDamageValue );
			
			vDiffuse.rgb *= lerp( vec3( 1.f ), DMG_EDGE_COLOR, saturate( vDamageEdge ) );
			
			float3 vColor = vDiffuse.rgb;
			
			LightingProperties lightingProperties;
			lightingProperties._WorldSpacePos = vPos;
			lightingProperties._ToCameraDir = normalize(vCamPos - vPos);

			float4 vNormalMap = tex2D( NormalMap, In.vUV0 );
			
			float vEmissive = vNormalMap.b;
			float3 vNormalSample =  UnpackRRxGNormal(vNormalMap);
			
			vEmissive *= 1.f - vDamageValue;
			vEmissive += vDamageEdge;
			
			lightingProperties._Glossiness = vProperties.a;			
			lightingProperties._NonLinearGlossiness = GetNonLinearGlossiness(lightingProperties._Glossiness);
		
			float vCubemapIntensity = CubemapIntensity;
			
			 // Gamma - Linear ping pong
			 // All content is already created for gamma space math, so we do this in gamma space
			vColor = ToGamma(vColor);
			vColor = ToLinear(lerp( vColor, vColor * ( vProperties.r * PrimaryColor.rgb ), vProperties.r ));
		
			float3x3 TBN = Create3x3( normalize( In.vTangent ), normalize( In.vBitangent ), vInNormal );
			float3 vNormal = normalize(mul( vNormalSample, TBN ));
			
			float fShadowTerm = 1.0f;		
			lightingProperties._Normal = vNormal;
			float SpecRemapped = vProperties.g * vProperties.g * 0.4;
			float MetalnessRemapped = 1.0 - (1.0 - vProperties.b) * (1.0 - vProperties.b);
			
			lightingProperties._Diffuse = MetalnessToDiffuse(MetalnessRemapped, vColor);
			lightingProperties._SpecularColor = MetalnessToSpec(MetalnessRemapped, vColor, SpecRemapped);
			
			float3 diffuseLight = vec3(0.0);
			float3 specularLight = vec3(0.0);
			//CalculateSunLight(lightingProperties, fShadowTerm, diffuseLight, specularLight);
			CalculateSystemPointLight(lightingProperties, 1.0f, diffuseLight, specularLight);
			CalculateShipCameraLights(lightingProperties, 1.0f, diffuseLight, specularLight);
			CalculatePointLights(lightingProperties, LightDataMap, LightIndexMap, diffuseLight, specularLight);
			
			float3 vEyeDir = normalize( vPos - vCamPos.xyz );
			float3 reflection = reflect( vEyeDir, vNormal );
			float MipmapIndex = GetEnvmapMipLevel(lightingProperties._Glossiness); 			
			float3 reflectiveColor = texCUBElod( EnvironmentMap, float4(reflection, MipmapIndex) ).rgb * vCubemapIntensity;
			specularLight += reflectiveColor * FresnelGlossy(lightingProperties._SpecularColor, -vEyeDir, lightingProperties._Normal, lightingProperties._Glossiness);
			
			float vCamDistance = length( vPos - vCamPos );
			float vCamDistFadeValue = saturate( ( vCamDistance - CamLightFadeStartStop.x ) / ( CamLightFadeStartStop.y - CamLightFadeStartStop.x ) );
			float vAmbientIntensity = lerp( AmbientIntensityNearFar.x, AmbientIntensityNearFar.y, vCamDistFadeValue );
			
			vColor = ComposeLight(lightingProperties, vAmbientIntensity, diffuseLight, specularLight);
			vColor = lerp( vColor, vDiffuse.rgb, vEmissive );
			
			DebugReturn(vColor, lightingProperties, fShadowTerm);
				
			float alpha = vDiffuse.a;
			#ifndef GUI_ICON
				alpha *= vEmissive; 
				alpha *= vBloomFactor;
			#endif
			
		#ifdef RIM_LIGHT
			float vRimStart = lerp( RimLightStartNearFar.x, RimLightStartNearFar.y, vCamDistFadeValue );
			float vRimStop = lerp( RimLightStopNearFar.x, RimLightStopNearFar.y, vCamDistFadeValue );		
			
			float vRim = smoothstep( vRimStart, vRimStop, 1.0f - dot( vNormal, lightingProperties._ToCameraDir ) );
			
			vColor.rgb = lerp( vColor.rgb, RimLightDiffuse.rgb, saturate( vRim ) );
		#endif

			return float4(vColor, alpha);
		}
		
	]]
	
	MainCode PixelPdxMeshBlackHole
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{			
			float3 p = vCamRightDir * dot( In.vNormal, vCamRightDir );
			float3 vInvertedNormal = In.vNormal + ( p - In.vNormal ) * 2.f;
			float3 vEyeDir = normalize( In.vPos.xyz - vCamPos.xyz );
			float3 reflection = reflect( vEyeDir, vInvertedNormal );
			
			float3 Color = texCUBElod( EnvironmentMap, float4(reflection, 0) ).rgb;
						
			float vDot = dot( -vEyeDir, In.vNormal );
			Color = saturate( Color * pow( 1.05f - vDot, 7.f ) );
			Color += StarAtmosphereColor.rgb * smoothstep( 0.25f, 0.01f, vDot ) * 0.25f * StarAtmosphereColor.a;

			return float4( Color, 1.f );
		}
	]]
	
	MainCode PixelPdxMeshExtraDimensionalShip
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float3 RimColor = HSVtoRGB( float3( 0.4f, 0.7f, 1.0f ) );
			const float RimAlpha = 0.09f;
			const float vRimStart = 0.5f;
			const float vRimStop = 0.25f;
			
			float vDot = dot( normalize( In.vNormal ), -vCamLookAtDir );
			float vRim = smoothstep( vRimStart, vRimStop, abs( vDot ) );	
			float4 vColor = vRim * float4( RimColor.rgb, RimAlpha );
			if( vDot > 0.f )
			{
				float vTime = ( vUVAnimationTime + HdrRange_Time_ClipHeight.y ) * 0.15f;
				vColor += tex2D( DiffuseMap, In.vUV0 + vUVAnimationDir * vTime );
				vColor += tex2D( DiffuseMap, ( In.vUV0 + float2( 0.20f, -0.13f ) * vTime * 0.27f ) );
			}
			vColor.a *= vBloomFactor;
			return vColor;
		}
	]]
	
	MainCode PixelPdxMeshStar
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD Input ) : PDX_COLOR
		{
			// --------------------------------------------------------------
			// ------------------    LAVA           -------------------------
			// --------------------------------------------------------------
			static const float LAVA_ANIMATION_SPEED = 0.08;
			static const float LAVA_FIELD_SIZE = 10.0;
			static const float LAVA_STONE_HOTTNESS = 0.1;

			static const float LAVA_TEXTURE_TILE = 10.0;
			static const float LAVA_TEXTURE_PARALLAX = 0.1;

			static const float STONE_TEXTURE_TILE = 25.0;
			static const float STONE_TEXTURE_PARALLAX = 0.15;
			// --------------------------------------------------------------
			
			float2 vUV = Input.vUV0 + vUVAnimationDir * vUVAnimationTime;

			float3 vNormal = normalize( Input.vTangent ); // tangent == position

			float noise1 = texCUBE( LavaNoise, vNormal ).r - 0.5;
			float noise2 = texCUBE( LavaNoise, vNormal * 4.0f ).r - 0.5;
			float noise3 = texCUBE( LavaNoise, vNormal * 8.0f ).r - 0.5;

			float noise = noise1 + noise2 + noise3;

			float noiseAnimationTime = Time * LAVA_ANIMATION_SPEED;

			float animatedNoise = sin((noise + noiseAnimationTime) * LAVA_FIELD_SIZE);
			float invertedAnimatedNoise = 1.0 - animatedNoise;
			float invertedAnimatedNoiseRescaled = invertedAnimatedNoise * 0.5;
			float invertedAnimatedNoiseRescaled2 = invertedAnimatedNoiseRescaled * invertedAnimatedNoiseRescaled;
			
			float lavaMask = saturate(-animatedNoise) * saturate(-animatedNoise);

			float3 toCamera = normalize(vCamPos - Input.vPos.rgb);
			float2 parallaxOffset = invertedAnimatedNoiseRescaled * toCamera.xz;
			
			float2 lavaUV = vUV * LAVA_TEXTURE_TILE - (parallaxOffset * LAVA_TEXTURE_PARALLAX);
			float3 lavaTexture = tex2D( LavaDiffuse, lavaUV ).rgb;
			
			float2 stoneUV = vUV * STONE_TEXTURE_TILE - (parallaxOffset * STONE_TEXTURE_PARALLAX);
			float3 stoneTexture = tex2D( StoneDiffuse, stoneUV ).rgb;				
			
			float3 heatedStone = stoneTexture * LavaHotStoneColor * ( pow(invertedAnimatedNoiseRescaled2, 0.5) + LAVA_STONE_HOTTNESS );
			float stoneLerp = (1.0 - saturate(animatedNoise));
			heatedStone = lerp(heatedStone + stoneTexture * LavaColdStoneColor, heatedStone, stoneLerp);
			float3 lava = lavaTexture * LavaBrightColor * pow(lavaMask, 0.7);
			
			float3 vColor = saturate(heatedStone + lava);
			
			// Atmosphere
			float3 vInNormal = normalize( Input.vNormal );
			float vAtmosphere = saturate( dot( vInNormal, -toCamera ) + StarAtmosphereWidth );
			vColor = lerp( vColor, StarAtmosphereColor.rgb, vAtmosphere * vAtmosphere * StarAtmosphereColor.a * StarAtmosphereIntensity );

			float vAlpha = 1.0;

			#ifdef IS_NEUTRON_STAR_SHELL
				float NdotL = saturate( 0.5 - dot( vInNormal, toCamera ) );
				vAlpha *= NdotL;
				vAlpha *= 0.2;
			#else
				vAlpha = 0.1 * vBloomFactor;

				float vRim = smoothstep( 0.5, 1.0, 1.0 - dot( vInNormal, toCamera ) );
				vColor.rgb += vColor.rgb * vRim * 3.5f;
				vColor = saturate( vColor );
			#endif
			
			#ifdef GUI_ICON
				vColor = saturate( vColor + normalize( vColor ) * 0.2f );
			#endif

			return float4(vColor.rgb, vAlpha );
		}
		
	]]

	MainCode PixelPdxMeshAtmosphere
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{	
			float3 vPos = In.vPos.xyz / In.vPos.w;	
			

			
			#ifdef GUI_ICON
			
				float NdotL = saturate( dot( normalize( In.vNormal ), -normalize(vCamPos - vPos) ) );
				#ifdef IS_STAR
					float4 vColor = StarAtmosphereColor;// * StarAtmosphereIntensity;
					NdotL = pow( NdotL, 2.f );
				#else
					clip( Sensor - 0.5f );
					float4 vColor = AtmosphereColor * AtmosphereIntensity;
					//NdotL = pow( NdotL, 1.0f );
				#endif
				
				return float4( vColor.rgb, dot( vec3( NdotL ), vColor.rgb ) );
			#else
				#ifdef IS_STAR
					float3 vColor = StarAtmosphereColor.rgb * HdrRange_Time_ClipHeight.x ;
					clip( StarAtmosphereColor.a - 0.1f );
					
					float NdotL = saturate( dot( normalize( In.vNormal ), -normalize(vCamPos - vPos) ) );
					vColor *= pow( NdotL, 3 );

					return float4( vColor, pow( NdotL, 4 ) );
				#else
				
					clip( Sensor - 0.5f );
					
					float3 vColor = AtmosphereColor.rgb;

					LightingProperties lightingProperties;

					lightingProperties._SpecularColor = AtmosphereColor.rgb * 0.5f;
					lightingProperties._Glossiness = 1.0f;
					lightingProperties._NonLinearGlossiness = GetNonLinearGlossiness(lightingProperties._Glossiness);

					lightingProperties._WorldSpacePos = vPos;
					lightingProperties._ToCameraDir = normalize(vCamPos - vPos);
					lightingProperties._Normal = normalize( In.vNormal );
					lightingProperties._Diffuse = vColor;			

					float3 diffuseLight = vec3(0.0);
					float3 specularLight = vec3(0.0);
					CalculateSystemPointLight(lightingProperties, 0.13f, diffuseLight, specularLight);

					//vColor = ( saturate( float3( 0.1f, 0.1f, 0.1f ) + diffuseLight ) * lightingProperties._Diffuse ) * HdrRange_Time_ClipHeight.x 
					//			+ specularLight;
					
					float NdotL = saturate( dot( lightingProperties._Normal, -lightingProperties._ToCameraDir ) );
					vColor *= pow( NdotL, 4 );
									
					return float4( vColor, 1.4*NdotL );
				#endif
			#endif
		}
		
	]]

	MainCode PixelPdxMeshAdditive
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float2 vUV = In.vUV0;
			vUV += vUVAnimationDir * vUVAnimationTime;

			float4 vDiffuse = tex2D( DiffuseMap, vUV );

		#ifdef ANIMATE_UV
			#ifndef ANIMATE_UV_ALPHA
				vDiffuse.a = tex2D( DiffuseMap, In.vUV0 ).a;
			#endif
		#endif			

		#ifdef ALPHA_TEST
			clip(vDiffuse.a - 1.0);
		#endif
		
			#ifdef ADD_COLOR
				vDiffuse.rgb *= PrimaryColor.rgb;
			#endif
			vDiffuse.rgb *= vDiffuse.a;
			vDiffuse.a *= vBloomFactor;
			#ifdef GUI_ICON
				float vLen = length( vDiffuse.rgb );
				vDiffuse.rgb /= vLen;
				vDiffuse.a = saturate( vLen * 1.5f );
			#endif
			
			#ifdef BLACK_HOLE
				vDiffuse.rgb *= pow( 1.f - abs( dot( vCamLookAtDir, float3( 0.f, 1.f, 0.f ) ) ), 1.5f );
			#endif
			return vDiffuse;
		}
		
	]]

	MainCode PixelPdxMeshSimple
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float4 vDiffuse = tex2D( DiffuseMap, In.vUV0 );
			return vDiffuse;
		}
		
	]]	
	
	MainCode PixelPdxMeshFleetType
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float4 vDiffuse = tex2D( DiffuseMap, In.vUV0 );
		
			float vOutline 	= vSelected * vDiffuse.g;
			float vAlpha 	= vDiffuse.a * saturate( vDiffuse.r + vOutline );

			float3 vColor = PrimaryColor.rgb * (1.0f - vOutline ) + float3( 1.0f, 1.0f, 0.0f ) * vOutline;
			
			return float4( vColor, vAlpha );
		}
		
	]]

	MainCode PixelPdxMeshPortrait
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float4 UVLod = float4( (In.vUV0), 0.0, PortraitMipLevel * 0.35 );
			
			#ifdef FRONTENDBACKGROUND
				float4 vDiffuse = tex2Dlod( DiffuseMap, UVLod );
			#else
				#ifdef CLOTHES
					float4 vDiffuse = tex2Dlod( PortraitClothes, UVLod );
				#else
					#ifdef HAIR
						float4 vDiffuse = tex2Dlod( PortraitHair, UVLod );
					#else
						float4 vDiffuse;
						if( CustomDiffuseTexture > 0.f )
							vDiffuse = tex2Dlod( PortraitCharacter, UVLod );
						else
							vDiffuse = tex2Dlod( DiffuseMap, UVLod );
					#endif
				#endif
			#endif

			return float4( ToGamma( vDiffuse.rgb ), vDiffuse.a );
		}
		
	]]

	MainCode PixelPdxMeshStandardShadow
	[[
		float4 main( VS_OUTPUT_PDXMESHSHADOW In ) : PDX_COLOR
		{
			return float4( In.vDepthUV0.xxx / In.vDepthUV0.y, 1.0f );
		}
		
	]]

	MainCode PixelPdxMeshNoShadow
	[[
		float4 main( VS_OUTPUT_PDXMESHSHADOW In ) : PDX_COLOR
		{
			clip( -1.f );
			return float4( 1,1,1,1 );
		}
		
	]]

	MainCode PixelPdxMeshAlphaTestShadow
	[[
		float4 main( VS_OUTPUT_PDXMESHSHADOW In ) : PDX_COLOR
		{
			float4 vColor = tex2D( DiffuseMap, In.vDepthUV0.zw );
			clip( vColor.a - 0.5f );
			return float4( In.vDepthUV0.xxx / In.vDepthUV0.y, 1.0f );
		}
		
	]]

	MainCode PixelDebugNormal
	[[
		float4 main( VS_OUTPUT_DEBUGNORMAL In ) : PDX_COLOR
		{
			float4 vColor = float4( 1.0f - In.vOffset, In.vOffset, 0.0f,  0.0f );
			return vColor;
		}
		
	]]
	
	MainCode PixelPdxMeshSelection
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float4 vDiffuse = tex2D( DiffuseMap, In.vUV0 );
			vDiffuse *= PrimaryColor;
			return vDiffuse;
		}
		
	]]
	MainCode PixelPdxMeshProgressBar
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float2 vUV = In.vUV0;
			
			#ifdef HEALTH_BAR
				float vValue = vHealth;
			#else
				float vValue = vProgressBarValue;
			#endif
			
			float4 vDiffuse = tex2D( DiffuseMap, vUV );
			vDiffuse.a *= saturate( ( vValue - vUV.y ) * 100.f );
		
			float4 vColor = vDiffuse;
			
			#ifdef COLORED
			vColor *= ProgressBarPrimaryColor;
			#endif
			
			return vColor;
		}
		
	]]
	
	MainCode PixelPdxMeshMapIcon
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float2 vUV = In.vUV0;
			float4 vColor = tex2D( DiffuseMap, vUV );
			
			#ifdef COLORED
			vColor *= ProgressBarPrimaryColor;
			#endif
			
			return vColor;
		}
	]]
	
	MainCode PixelPdxMeshNavigationButton
	[[
		float4 main( VS_OUTPUT_PDXMESHNAVIGATIONBUTTON In ) : PDX_COLOR
		{
			float2 vUV = In.vUV0;
			vUV.x *= 4.f * 0.2f;//Mesh is uv-mapped for a 4-frame texture but we use a 5-frame texture
			float2 vOffset = float2( 0.2f, 0.f );
			float4 vColorUp 		= tex2D( DiffuseMap, vUV + vOffset * 0.f );
			float4 vColorOver 		= tex2D( DiffuseMap, vUV + vOffset * 2.f );
			float4 vColorDown 		= tex2D( DiffuseMap, vUV + vOffset * 1.f );
			float4 vColorSelected 	= tex2D( DiffuseMap, vUV + vOffset * 4.f );
			
			float4 vColor = vColorUp;
			vColor = lerp( vColor, vColorSelected, vSelectedValue );
			vColor = lerp( vColor, vColorOver, vOverValue );
			vColor = lerp( vColor, vColorDown, vDownValue );
	
		    float Grey = dot( vColorUp.rgb, float3( 0.212671f, 0.715160f, 0.072169f ) ); 
		    vColor.rgb = lerp( float3(Grey, Grey, Grey), vColor.rgb, vIntelValue );

			return vColor;
		}
	]]
	
	
	
	MainCode PixelPdxMeshShieldFlipBook
	[[
		float4 main( VS_OUTPUT_PDXMESHSHIELD In ) : PDX_COLOR
		{
		//	float2 v = In.vUV0.xy - float2( 0.5f, 0.5f );
		//return abs( sin( sqrt( dot( v, v ) ) * 30.f ) );
			
			const int nColumns = 4;
			const int nRows = 4;
			const float vTimePerFrame = 1.0f / ( nColumns * nRows );
			float2 vFrameUV  = float2( 1.0f / nColumns, 1.0f / nRows );
			
			//float vTime = HdrRange_Time_ClipHeight.y;//vObjectTime;
			//vTime = mod( vTime * 0.5, 1.0f );
			float vTime = vObjectTime;
			
			float vFrame = min( nColumns * nRows - 1, vTime / vTimePerFrame );
			int nBaseFrame = int( floor( vFrame ) );
			int nNextFrame = int( ceil( vFrame ) );
			
			float2 vUV1 = float2( vFrameUV.x * mod( nBaseFrame, nColumns ), vFrameUV.y * ( nBaseFrame / nColumns ) );
			float2 vUV2 = float2( vFrameUV.x * mod( nNextFrame, nColumns ), vFrameUV.y * ( nNextFrame / nColumns ) );
			
			float4 vColor1 = tex2D( DiffuseMap, vUV1 + In.vUV0 * vFrameUV );
			float4 vColor2 = tex2D( DiffuseMap, vUV2 + In.vUV0 * vFrameUV );
			
			float4 vColor = lerp( vColor1, vColor2, frac( vFrame ) );
			
			vColor.rgb *= vColor.a;
			
			vColor.a = pow( vColor.a * 5.0f, 2 );
			
			return vColor;
		}
	]]
	
	MainCode PixelPdxMeshShieldUVStretch
	[[
		float4 main( VS_OUTPUT_PDXMESHSHIELD In ) : PDX_COLOR
		{
			float2 vHalf = float2( 0.5f, 0.5f );			
			
			float4 vColor = float4( 0.f, 0.f, 0.f, 0.f );
			
			int nNumLoops = int( min( vNumLoops + 1.0f, 16.0f ) ); 
			for( int i = 0; i <nNumLoops; ++i )
			{
				float vTime = vObjectTime;//mod( HdrRange_Time_ClipHeight.y * 1.0f, 0.5f );//
				vTime += vTimePerLoop * i;
				float vUVScale = 1.0f / vTime;
				float2 vUV = saturate( vHalf + ( In.vUV0.xy - vHalf ) * vUVScale );
				
				float4 vDiffuse = tex2D( DiffuseMap, vUV );
				vDiffuse *= saturate( 1.0f - vTime );
				vColor.rgb += vDiffuse.rgb * vDiffuse.a;
				vColor.a += vDiffuse.a;//max( vColor.a, vDiffuse.a );
			}
			
			//return max( vColor, float4( 1.0f, 1.0f, 1.0f, nNumLoops / 20.f ) );
			vColor.rgb *= vColor.a;
			vColor.a = pow( vColor.a * 5.0f, 2.f );
			return vColor;
		}
	]]
	
	MainCode PixelConstruction
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			//Color values in HSVA
			const float4 VALID_COLOR 		= float4( 2.3f, 1.f, 0.6f, 0.5f );
			const float4 INVALID_COLOR 		= float4( 0.0f, 0.95f, 0.3f, 0.5f );
			const float4 QUEUED_COLOR 		= float4( 2.3f, 0.5f, 0.6f, 0.8f );
			const float4 IN_PROGRESS_COLOR 	= float4( 0.5f, 1.f, 0.6f, 0.8f );
			
			float4 vNormalMap = tex2D( NormalMap, In.vUV0 );
			float3 vNormalSample =  UnpackRRxGNormal(vNormalMap);
			float3x3 TBN = Create3x3( normalize( In.vTangent ), normalize( In.vBitangent ), normalize( In.vNormal ) );
			float3 vNormal = normalize(mul( vNormalSample, TBN ));
			
			float4 vNoise4 = tex2D( DiffuseMap, In.vUV0 );
			float vNoise = dot( vNoise4, vNoise4 ) * 1.f;
			//float vNoise = vNoise4.r * 1.3f + vNoise4.g * 2.1f + vNoise4.b * 3.7f + vNoise4.a * 5.11f;
			vNoise += dot( vNoise4.rgb, float3( 0.f, -1.f, 0.f ) ) * 5;
			
			
			float4 vColor;
			if( vConstructionProgress < 0.f )
				vColor = INVALID_COLOR;
			else if( vConstructionProgress >= 1.0f )
				vColor = VALID_COLOR;
			else if( vConstructionProgress == 0.0f )
				vColor = QUEUED_COLOR;
			else
				vColor = IN_PROGRESS_COLOR;
			vColor.rgb = HSVtoRGB( vColor.rgb );
			
			float vTime = HdrRange_Time_ClipHeight.y;
			//float vScanLine = pow( saturate( sin( vTime - In.vPos.y ) ), 500.f );
			float vScanLine = 1.f - pow( saturate( mod( ( vTime + In.vPos.y + vNoise ) * 0.5f, 5.f ) ), 0.05f );
			
			vColor.a *= saturate( smoothstep( -1.0f, 0.0f, dot( vNormal, vCamLookAtDir ) ) );
			vColor.a = saturate( vColor.a + vScanLine );
				
			return vColor;
		}
	]]
	
	MainCode PixelPdxMeshCircleGradient
	[[
		float4 main( VS_OUTPUT_PDXMESHSTANDARD In ) : PDX_COLOR
		{
			float4 vColor = vAuraColor;
			float2 vUV = In.vUV0;
			vUV.y = min( 0.99f, vUV.y * vAuraRadius * 0.02f );
			vColor *= tex2D( DiffuseMap, vUV ).r;
			vColor.a *= saturate( vUV.y * 100.f );	//Smoother edge
			vColor.a *= clamp(saturate( vUV.y * 100.f ), 0.0f, 0.06f);	//Smoother edge
			return vColor;
		}
	]]
}


BlendState BlendState
{
	BlendEnable = no
	WriteMask = "RED|GREEN|BLUE|ALPHA"
}

BlendState BlendStateAlphaBlend
{
	BlendEnable = yes
	SourceBlend = "SRC_ALPHA"
	DestBlend = "INV_SRC_ALPHA"
	WriteMask = "RED|GREEN|BLUE"
}

BlendState BlendStateAdditiveBlend
{
	BlendEnable = yes
	SourceBlend = "SRC_ALPHA"
	DestBlend = "ONE"
	WriteMask = "RED|GREEN|BLUE|ALPHA"
}
BlendState BlendStateAdditiveBlendNoAlpha
{
	BlendEnable = yes
	SourceBlend = "SRC_ALPHA"
	DestBlend = "ONE"
	WriteMask = "RED|GREEN|BLUE"
}

BlendState BlendStateAlphaBlendWriteAlpha
{
	BlendEnable = yes
	SourceBlend = "SRC_ALPHA"
	DestBlend = "INV_SRC_ALPHA"
	DestAlpha = "ONE"
	WriteMask = "RED|GREEN|BLUE|ALPHA"
}

BlendState BlendStateAlphaShadow
{
	BlendEnable = no
	AlphaTest = yes
	WriteMask = "RED|GREEN|BLUE"
}

DepthStencilState DepthStencilNoZWrite
{
	DepthEnable = yes
	DepthWriteMask = "DEPTH_WRITE_ZERO"
}

DepthStencilState DepthStencilNoZ
{
	DepthEnable = no
	DepthWriteMask = "DEPTH_WRITE_ZERO"
}

RasterizerState RasterizerStateBack
{
	FillMode = "FILL_SOLID"
	CullMode = "CULL_BACK"
	FrontCCW = yes
}

RasterizerState RasterizerStateNoCulling
{
	CullMode = "CULL_NONE"
}

Effect PdxMeshStandard
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
}

Effect PdxMeshStandardSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
}

Effect PdxMeshStandardShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshStandardSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshSelection
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshSelection"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshSelectionSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshSelection"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshSelectionShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshSelectionSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditive
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}

Effect PdxMeshAlphaAdditiveSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}


Effect PdxMeshAlphaAdditiveAnimateUV
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "ANIMATE_UV" }
}

Effect PdxMeshAlphaAdditiveAnimateUVSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "ANIMATE_UV" }	
}

Effect PdxMeshAlphaAdditiveAnimateUVAlpha
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "ANIMATE_UV" "ANIMATE_UV_ALPHA" }
}

Effect PdxMeshAlphaAdditiveAnimateUVAlphaSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "ANIMATE_UV" "ANIMATE_UV_ALPHA" }	
}

Effect PdxMeshAlphaAdditiveShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditiveSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditiveAnimateUVShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditiveAnimateUVSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditiveAnimateUVAlphaShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditiveAnimateUVAlphaSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditiveNoZ
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZ"		
}

Effect PdxMeshAlphaAdditiveNoZSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZ"
}

Effect PdxMeshAlphaAdditiveNoZShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaAdditiveNoZSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAdvanced
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "EMISSIVE" "GLOSSINESS" }
}

Effect PdxMeshAdvancedSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "EMISSIVE" "GLOSSINESS" }
}

Effect PdxMeshAdvancedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAdvancedSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshTilingAO
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "EMISSIVE" "GLOSSINESS" "TILING_AO" }
}

Effect PdxMeshTilingAOSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "EMISSIVE" "GLOSSINESS" "TILING_AO" }
}

Effect PdxMeshTilingAOShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshTilingAOSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshColor
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ADD_COLOR" }
}

Effect PdxMeshColorSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ADD_COLOR"  }
}

Effect PdxMeshColorShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshColorSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaBlend
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ALPHA_TEST" }
}

Effect PdxMeshAlphaBlendSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ALPHA_TEST" }
}

Effect PdxMeshAlphaBlendShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshAlphaTestShadow"
	BlendState = "BlendStateAlphaShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAlphaBlendSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshAlphaTestShadow"
	BlendState = "BlendStateAlphaShadow"
	Defines = { "IS_SHADOW" }
}

Effect MaterialTest
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "PDX_IMPROVED_BLINN_PHONG" "HACK" }
}

Effect MaterialTestShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect DebugNormal
{
	VertexShader = "VertexDebugNormal"
	PixelShader = "PixelDebugNormal"
}

Effect DebugNormalSkinned
{
	VertexShader = "VertexDebugNormalSkinned"
	PixelShader = "PixelDebugNormal"
}

Effect PdxMeshTerra
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshTerraSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshTerraAlphaBlend
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshTerraAlphaBlendSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect AlphaBlend_00
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" "NO_ALPHA_MULTIPLIED_EMISSIVE" }
}

Effect AlphaBlend_00Skinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" "NO_ALPHA_MULTIPLIED_EMISSIVE" }
}

Effect PdxMeshTerraAlphaTest
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" "ALPHA_TEST" }
}

Effect PdxMeshTerraAlphaTestSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" "ALPHA_TEST"  }
}

Effect PdxMeshPlanet
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "IS_PLANET" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshPlanetSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "IS_PLANET" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshAsteroid
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshAsteroidSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshPlanetEmissive
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "IS_PLANET" "NO_PLANET_EMISSIVE" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshPlanetEmissiveSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	Defines = { "IS_PLANET" "NO_PLANET_EMISSIVE" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshPlanetRings
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	RasterizerState = "RasterizerStateNoCulling"
	BlendState = "BlendStateAlphaBlendWriteAlpha"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "IS_PLANET" "IS_RING" }
}

Effect PdxMeshPlanetRingsSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	RasterizerState = "RasterizerStateNoCulling"
	BlendState = "BlendStateAlphaBlend";	
	Defines = { "IS_PLANET" "IS_RING" }
}

Effect PdxMeshAtmosphere
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshAtmosphere"
	RasterizerState = "RasterizerStateBack"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "IS_PLANET" }
}

Effect PdxMeshAtmosphereSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshAtmosphere"
	RasterizerState = "RasterizerStateBack"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"		
	Defines = { "IS_PLANET" }
}

Effect PdxMeshAtmosphereStar
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshAtmosphere"
	RasterizerState = "RasterizerStateBack"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "IS_PLANET" "IS_STAR" }
}

Effect PdxMeshAtmosphereStarSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshAtmosphere"
	RasterizerState = "RasterizerStateBack"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"		
	Defines = { "IS_PLANET "IS_STAR"" }
}

Effect PdxMeshFleetTypeIndicator
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshFleetType"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
} 

Effect PdxMeshStar
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStar"
	Defines = { "IS_STAR" }
}

Effect PdxMeshStarSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStar"
	Defines = { "IS_STAR" }
}

Effect PdxMeshNeutronStarShell
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStar"
	#RasterizerState = "RasterizerStateBack"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "IS_STAR" "IS_NEUTRON_STAR_SHELL" }
}

Effect PdxMeshNeutronStarShellSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStar"
	#RasterizerState = "RasterizerStateBack"
	BlendState = "BlendStateAdditiveBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "IS_STAR" "IS_NEUTRON_STAR_SHELL" }
}
 

Effect PdxMeshClouds
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "IS_PLANET" "IS_CLOUDS" "PDX_IMPROVED_BLINN_PHONG" } 
}

Effect PdxMeshCloudsSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "IS_PLANET" "IS_CLOUDS" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshRings
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "IS_PLANET" "IS_RING" "PDX_IMPROVED_BLINN_PHONG" } 
}

Effect PdxMeshRingsSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "IS_PLANET" "IS_RING" "PDX_IMPROVED_BLINN_PHONG" }
}

Effect PdxMeshAlphaBlendPlanet
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "IS_PLANET" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG"  }
}

Effect PdxMeshAlphaBlendPlanetSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAlphaBlend";
	Defines = { "IS_PLANET" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG"  }
}

Effect PdxMeshAlphaBlendNoZWriteSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend";
}

Effect PdxMeshPortrait
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshPortraitSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshPortraitClothes
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "CLOTHES" }
}

Effect PdxMeshPortraitClothesSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "CLOTHES" }
}

Effect PdxMeshPortraitHair
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "HAIR" }
}

Effect PdxMeshPortraitHairSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "HAIR" }
}

Effect PdxMeshFrontendBackground
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "FRONTENDBACKGROUND" }
}

Effect PdxMeshFrontendBackgroundSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshPortrait"
	BlendState = "BlendStateAlphaBlendWriteAlpha";
	DepthStencilState = "DepthStencilNoZ"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "FRONTENDBACKGROUND" }
}

Effect PdxMeshSimple
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshSimple"
}

Effect PdxMeshSimpleSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshSimple"
}

## ------------- SHADOWS UNUSED ------------------

Effect PdxMeshTerraShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshTerraSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshTerraAlphaBlendShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshTerraAlphaBlendSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect AlphaBlend_00Shadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect AlphaBlend_00SkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshTerraAlphaTestShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshTerraAlphaTestSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshPlanetShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" }
}

Effect PdxMeshPlanetSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" }
}

Effect PdxMeshAsteroidShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshAsteroidSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshPlanetEmissiveShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" }
}

Effect PdxMeshPlanetEmissiveSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" }
}

Effect PdxMeshPlanetRingsShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_RING" }
}

Effect PdxMeshPlanetRingsSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_RING" }
}

Effect PdxMeshAtmosphereShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	RasterizerState = "RasterizerStateBack"	
	Defines = { "IS_SHADOW" "IS_PLANET" }
}

Effect PPxMeshAtmosphereSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	RasterizerState = "RasterizerStateBack"	
	Defines = { "IS_SHADOW" "IS_PLANET" "" }
}

Effect PdxMeshAtmosphereStarShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	RasterizerState = "RasterizerStateBack"	
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_STAR" }
}

Effect PdxMeshAtmosphereStarSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	RasterizerState = "RasterizerStateBack"	
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_STAR" }
}

Effect PdxMeshFleetTypeIndicatorShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
}

Effect PdxMeshStarShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_STAR" }
}

Effect PdxMeshStarSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_STAR" }
}

Effect PdxMeshNeutronStarShellShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_STAR" "IS_NEUTRON_STAR_SHELL" }
}

Effect PdxMeshNeutronStarShellSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_STAR" "IS_NEUTRON_STAR_SHELL" }
}


Effect PdxMeshCloudsShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_CLOUDS" }
}

Effect PdxMeshCloudsSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_CLOUDS" }
}

Effect PdxMeshRingsShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_RING" }
}

Effect PdxMeshRingsSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" "IS_RING" }
}

Effect PdxMeshAlphaBlendPlanetShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshAlphaTestShadow"
	BlendState = "BlendStateAlphaShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" }
}

Effect PdxMeshAlphaBlendPlanetSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshAlphaTestShadow"
	BlendState = "BlendStateAlphaShadow"
	Defines = { "IS_SHADOW" "IS_PLANET" }
}

Effect PdxMeshAlphaBlendNoZWriteSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshAlphaTestShadow"
	BlendState = "BlendStateAlphaShadow"
	Defines = { "IS_SHADOW" }
	DepthStencilState = "DepthStencilNoZWrite"
}

Effect PdxMeshHealthbar
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshProgressBar"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "HEALTH_BAR" "COLORED"}
}

Effect PdxMeshHealthbarSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshProgressBar"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
	Defines = { "HEALTH_BAR" "COLORED" }
}

Effect PdxMeshHealthbarShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshHealthbarSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshPortraitShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshPortraitSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshPortraitClothesShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshPortraitClothesSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshPortraitHairShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshPortraitHairSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshFrontendBackgroundShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshFrontendBackgroundSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshSimpleShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshSimpleSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshProgressBar
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshProgressBar"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}

Effect PdxMeshProgressBarSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshProgressBar"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}

Effect PdxMeshProgressBarShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshProgressBarSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshProgressBarColored
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshProgressBar"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "PROGRESS_BAR" "COLORED" }
}

Effect PdxMeshProgressBarColoredSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshProgressBar"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "PROGRESS_BAR" "COLORED" }
}

Effect PdxMeshProgressBarColoredShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshProgressBarColoredSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshMapIcon
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshMapIcon"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}
Effect PdxMeshMapIconSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshMapIcon"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}
Effect PdxMeshMapIconShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}
Effect PdxMeshMapIconSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshMapIconColor
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshMapIcon"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "COLORED" }
}
Effect PdxMeshMapIconColorSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshMapIcon"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "COLORED" }
}
Effect PdxMeshMapIconColorShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}
Effect PdxMeshMapIconColorSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}


Effect PdxMeshNavigationButton
{
	VertexShader = "VertexPdxMeshNavigationButton"
	PixelShader = "PixelPdxMeshNavigationButton"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}
Effect PdxMeshNavigationButtonSkinned
{
	VertexShader = "VertexPdxMeshNavigationButton"
	PixelShader = "PixelPdxMeshNavigationButton"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}
Effect PdxMeshNavigationButtonShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}
Effect PdxMeshNavigationButtonSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
}

Effect PdxMeshShieldFlipBook
{
	VertexShader = "VertexPdxMeshShieldHitEffect"
	PixelShader = "PixelPdxMeshShieldFlipBook"
	BlendState = "BlendStateAdditiveBlendNoAlpha"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshShieldFlipBookSkinned
{
	VertexShader = "VertexPdxMeshShieldHitEffectSkinned"
	PixelShader = "PixelPdxMeshShieldFlipBook"
	BlendState = "BlendStateAdditiveBlendNoAlpha"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshShieldFlipBookShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshShieldFlipBookShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}


Effect PdxMeshShieldUVStrech
{
	VertexShader = "VertexPdxMeshShieldHitEffect"
	PixelShader = "PixelPdxMeshShieldUVStretch"
	BlendState = "BlendStateAdditiveBlendNoAlpha"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshShieldUVStrechSkinned
{
	VertexShader = "VertexPdxMeshShieldHitEffectSkinned"
	PixelShader = "PixelPdxMeshStandard"
	BlendState = "BlendStateAdditiveBlendNoAlpha"
	DepthStencilState = "DepthStencilNoZWrite"
	RasterizerState = "RasterizerStateNoCulling"
}

Effect PdxMeshShieldUVStrechShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshShieldUVStrechShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshNoShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshShip
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshShip"
	Defines = { 
		"PDX_IMPROVED_BLINN_PHONG" 
		"RIM_LIGHT" 
	}
}

Effect PdxMeshShipSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshShip"
	Defines = { 
		"PDX_IMPROVED_BLINN_PHONG" 
		"RIM_LIGHT" 
	}
}

Effect PdxMeshShipShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshShipSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshExtraDimensionalShip
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshExtraDimensionalShip"
	BlendState = "BlendStateAlphaBlend"
	RasterizerState = "RasterizerStateNoCulling"
	DepthStencilState = "DepthStencilNoZWrite"
}

Effect PdxMeshExtraDimensionalShipSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshExtraDimensionalShip"
	BlendState = "BlendStateAlphaBlend"
	RasterizerState = "RasterizerStateNoCulling"
	DepthStencilState = "DepthStencilNoZWrite"
}

Effect PdxMeshExtraDimensionalShipShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshExtraDimensionalShipSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}

Effect PdxMeshStandardConstruction
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}

Effect PdxMeshStandardConstructionSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}

Effect PdxMeshShipConstruction
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}

Effect PdxMeshShipConstructionSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}

Effect PdxMeshTerraConstruction
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}

Effect PdxMeshTerraConstructionSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}
Effect PdxMeshTerraAlphaBlendConstruction
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}

Effect PdxMeshTerraAlphaBlendConstructionSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelConstruction"
	DepthStencilState = "DepthStencilNoZWrite"
	BlendState = "BlendStateAlphaBlend"
}

Effect PdxMeshCircleGradient
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshCircleGradient"
	BlendState = "BlendStateAlphaBlend"
	DepthStencilState = "DepthStencilNoZWrite"
}
Effect PdxMeshCircleGradientShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "IS_SHADOW" }
}
Effect PdxMeshBlackHole
{
	VertexShader = "VertexPdxMeshStandard"
	PixelShader = "PixelPdxMeshBlackHole"
	#BlendState = "BlendStateAlphaBlend"
	#DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "BLACK_HOLE" }
}

Effect PdxMeshBlackHoleSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	#BlendState = "BlendStateAlphaBlend"
	#DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" "IGNORE_POINT_LIGHTS" "BLACK_HOLE" }
}
Effect PdxMeshBlackHoleShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "ADD_COLOR" "PDX_IMPROVED_BLINN_PHONG" "IGNORE_POINT_LIGHTS" }
}

Effect PdxMeshBlackHoleSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "ADD_COLOR" "EMISSIVE" "PDX_IMPROVED_BLINN_PHONG" "IGNORE_POINT_LIGHTS" }
}
Effect PdxMeshBlackHoleBillboard
{
	VertexShader = "VertexPdxMeshBillboard"
	PixelShader = "PixelPdxMeshAdditive"
	BlendState = "BlendStateAdditiveBlend"
	RasterizerState = "RasterizerStateNoCulling"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "BLACK_HOLE" "ANIMATE_UV" }
}

Effect PdxMeshBlackHoleBillboardSkinned
{
	VertexShader = "VertexPdxMeshStandardSkinned"
	PixelShader = "PixelPdxMeshStandard"
	RasterizerState = "RasterizerStateNoCulling"
	DepthStencilState = "DepthStencilNoZWrite"
	Defines = { "BLACK_HOLE" "ANIMATE_UV" }
}
Effect PdxMeshBlackHoleBillboardShadow
{
	VertexShader = "VertexPdxMeshStandardShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "BLACK_HOLE" }
}

Effect PdxMeshBlackHoleBillboardSkinnedShadow
{
	VertexShader = "VertexPdxMeshStandardSkinnedShadow"
	PixelShader = "PixelPdxMeshStandardShadow"
	Defines = { "BLACK_HOLE" }
}