Here's the DGDK code:
dbLoadImage("Media/Islands.dds",1,0,2); //Also tried ...dds",1,2)
dbLoadEffect("FX/Skybox.fx",1);
dbLoadObject(1,"SkyBox.x");
dbPositionObject(1,0,0,0);
dbTextureObject(1,0,1);
dbSetObjectEffect(1,1);
Here's the shader:
float4x4 WVP : WorldViewProjection;
float4x4 World : World;
float3 CameraPosition;
Texture SkyBoxTexture;
samplerCUBE SkyBoxSampler = sampler_state
{
texture = <SkyBoxTexture>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = Mirror;
AddressV = Mirror;
};
struct VS_Input
{
float4 Position : POSITION;
};
struct VS_Output
{
float4 Position : POSITION;
float3 TextureCoordinate : TEXCOORD;
};
VS_Output VS(VS_Input input)
{
VS_Output output;
output.Position = mul(input.Position,WVP);
float4 VertexPosition = mul(input.Position, World);
output.TextureCoordinate = VertexPosition - CameraPosition;
return output;
}
float4 PS(VS_Output input) : COLOR0
{
return texCUBE(SkyBoxSampler, normalize(input.TextureCoordinate));
}
technique Skybox
{
pass Pass1
{
VertexShader = compile vs_1_1 VS();
PixelShader = compile ps_2_0 PS();
}
}
and the DDS image, Islands.dds is attached.
Thanks again dark coder!