//By EVOLVED
//www.evolved-software.com

//Un-Tweaks
   float4x4 World:World;
   float4x4 WorldVP:WorldViewProjection; 
   float4x4 ViewInv:ViewInverse;

//Textures
   texture SkyTexture <string Name = "";>;	
   sampler SkySampler=sampler_state 
      {
         Texture=<SkyTexture>;
         MipFilter=None;
      };

//Structs 
   struct Input
      {
         float4 Pos:POSITION;
      };
   struct Output
      {
         float4 Pos:POSITION;
         float3 ViewVec:TEXCOORD0; 
      };

//Vertex Shader
   Output VS(Input IN) 
      {
         Output OUT;
         OUT.Pos=mul(IN.Pos,WorldVP); 
         OUT.ViewVec=mul(IN.Pos,World)-ViewInv[3].xyz; 
         return OUT;
      }

//Pixel Shader
   float4 PS(Output IN)  : COLOR
      {
         return float4(texCUBE(SkySampler,normalize(IN.ViewVec)).xyz,1.0);
      }

//Techniques   
    technique CubemapSky
      {
         pass p1
      {
         vertexShader = compile vs_3_0 VS();
         pixelShader  = compile ps_3_0 PS();
      }
      }
