Hi
When I use near plane as 1
D3DXMatrixPerspectiveFovLH(&d3d::MatProj, D3DXToRadian(90), 4.0f/3.0f, 1, 1000);
then I don't have artifacts (z buffer works OK at least in current stage of project) but I have issue when moving camera. When I am closing to the object then object is clipped and the result is as in the attached picture.
When I change near plane to 0 then there are some artifacts.
When I change near plane to 0.01 then there is none any issue visible (none artifacts, none clipping object before camera). I would use this solution however there is opinion in website society that near plane shouldn't be less than 1. So what is another fix to my camera issue or I shouldn't search any other soluation just use this one if I don't observe any problem?
FYI:
What I might say more is that when I draw triangle on another triangle (for example some indicator on the grass surface) then I use below code (my graphic card support depth bias), near plane isn't set to 0.01 - I am writing this additional information just to exclude from the above concerns this particular case.
D3DXMatrixPerspectiveFovLH(&d3d::MatProjZFight, D3DXToRadian(90), 4.0f/3.0f, 1, 1001); //for Z-Fighting based on projection matrix solution
if(d3d::depthBias)
{
DWORD x = d3d::FtoDw(d3d::DEPTHBIAS);
// Used to determine how much bias can be applied
// to co-planar primitives to reduce z fighting
// bias = (max * D3DRS_SLOPESCALEDEPTHBIAS) + D3DRS_DEPTHBIAS,
//where max is the maximum depth slope of the triangle being rendered.
pDev->SetRenderState(D3DRS_SLOPESCALEDEPTHBIAS, d3d::FtoDw(d3d::SLOPESCALEDEPTHBIAS));
pDev->SetRenderState(D3DRS_DEPTHBIAS, d3d::FtoDw(d3d::DEPTHBIAS));
}
else
pDev->SetTransform(D3DTS_PROJECTION, &d3d::MatProjZFight);