Original Post
Hi, I've been working on a HLSL water shader for my engine, everything is working fine except when it comes to reflecting the skybox.... I am using render to textures and user clip planes to generate the reflection and refraction textures. Landscape and meshes are reflected perfectly but the skybox doesn't appear on the reflection texture. I think the problem is rendering the skybox with the reflection view matrix... This is how I render the skybox : For reflection the view matrix is replaced by the reflection view matrix. These are the render states for the shader : If someone has an idea.... Thanks
D3DXMatrixTranslation(&mWorld,CDXObjects::Instance().getCameraPosition()->x,CDXObjects::Instance().getCameraPosition()->y,CDXObjects::Instance().getCameraPosition()->z);
CDXObjects::Instance().setWorldMatrix(mWorld);
CDXObjects::Instance().getDevice()->SetFVF(SBVertex::FVF);
CDXObjects::Instance().getDevice()->SetStreamSource(0,vBuffer,0,sizeof(SBVertex)); TLfx2->SetMatrix(hWorldViewProj,CDXObjects::Instance().getWorldViewProj());
TLfx2->Begin(NULL,0);
for (unsigned int i=0;i<6;++i)
{
TLfx2->BeginPass(0);
CDXObjects::Instance().getDevice()->SetTexture(0,SBTex);
CDXObjects::Instance().getDevice()->DrawPrimitive(D3DPT_TRIANGLESTRIP,i*4,2);
TLfx2->EndPass();
}
TLfx2->End();
technique main
{
pass p0
{
vertexshader = compile vs_1_1 VShader();
pixelshader = compile ps_2_0 PShader();
LIGHTING = FALSE;
ZENABLE = FALSE;
ZWRITEENABLE = FALSE;
CULLMODE = NONE;
}
}