Hi
Please see at first attached image.
I set near clip plane to 1 and far clip plane to 10 - that is why there is black color on half of the print screen.
I marked with red color some artifacts. My net are horizontal and vertical black lines. When I look at my object from outside there are artifacts.
When I looking at object from inside (2nd image) none problem.
Is it issue with Z fighting despite I even did the test with clip planes 1,10? Or this is another kind of issue? Some horizontal and vertical net lines are sometimes missing.
My texture with net is on image3. This blue color it is alpha=0 as this is print screen from some graphic tool when dds is edited. This texture is repeated many times on my geometry.
void Goalnet::draw()
{
d3d::pDev->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE);
d3d::pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
//with alpha test blendable the same artifacts occur
//d3d::pDev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
//d3d::pDev->SetRenderState(D3DRS_ALPHAREF, 1);
//d3d::pDev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL);
d3d::pDev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
d3d::pDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
d3d::pDev->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
d3d::pDev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
//Set MatWorld
D3DXMATRIX origMatWorld;
d3d::pDev->GetTransform(D3DTS_WORLD, &origMatWorld);
d3d::setMatWorld(d3d::pDev, &mMatOrientation);
//Make sure that Alfa is disabled for net
D3DCOLORVALUE lackAlfa;
lackAlfa.r = 0;
lackAlfa.g = 0;
lackAlfa.b = 0;
lackAlfa.a = 0;
mGoalnet.mat.at(1).Specular = lackAlfa;
mGoalnet.mat.at(1).Emissive = lackAlfa;
mGoalnet.mat.at(1).Diffuse = lackAlfa;
mGoalnet.mat.at(1).Ambient = lackAlfa;
for(u32 i=0; i<mGoalnet.subsets; ++i) //i=1 - net, i=0 - crossbar, posts
{
d3d::pDev->SetMaterial(&mGoalnet.mat.at(i));
d3d::pDev->SetTexture(0, mGoalnet.texture.at(i));
mGoalnet.mesh->DrawSubset(i);
}
//Restore MatWorld
d3d::pDev->SetTransform(D3DTS_WORLD, &origMatWorld);
//Restore states
d3d::pDev->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW);
d3d::pDev->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
d3d::pDev->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
}
I don't know how to solve this issue with best solution. One my idea is not to draw net in one call "drawSubset". I think I should my net divided into 4 separate subsets (back, top, right, left side of goal box). Then I should set order of draw from the far to close and in such way draw net geometry. Is it right solution? Or the problem can be solved easier?