1
使用舊的網孔,我注意到,在網狀的正在顯示的背面(的DirectX 11),其具有限定的狀態:的DirectX:網格顯示閉塞面
D3D11_RASTERIZER_DESC DrawStyleState;
DrawStyleState.AntialiasedLineEnable=true;
DrawStyleState.CullMode=D3D11_CULL_BACK;
DrawStyleState.DepthBias=0;
DrawStyleState.FillMode=D3D11_FILL_SOLID;
DrawStyleState.DepthClipEnable=true;
DrawStyleState.MultisampleEnable=true;
DrawStyleState.FrontCounterClockwise=false;
DrawStyleState.ScissorEnable=false;
ID3D11RasterizerState *DS_State;
Device->CreateRasterizerState(&DrawStyleState, &DS_State);
DeviceContext->RSSetState(DS_State);
和深度緩衝器:
ID3D11Texture2D *Texture2d;
Swapchain->GetBuffer(0,__uuidof(ID3D11Texture2D),(LPVOID*)&Texture2d);
D3D11_TEXTURE2D_DESC DepthStenDescription;
ZeroMemory(&DepthStenDescription, sizeof(D3D11_TEXTURE2D_DESC));
DepthStenDescription.Width =ScreenWidth;
DepthStenDescription.Height =ScreenHeight;
DepthStenDescription.MipLevels =1;
DepthStenDescription.ArraySize =1;
DepthStenDescription.Format =DXGI_FORMAT_D24_UNORM_S8_UINT;
DepthStenDescription.SampleDesc.Count =0;
DepthStenDescription.SampleDesc.Quality =1;
DepthStenDescription.Usage =D3D11_USAGE_DEFAULT;
DepthStenDescription.BindFlags =D3D11_BIND_DEPTH_STENCIL;
DepthStenDescription.CPUAccessFlags =0;
DepthStenDescription.MiscFlags =0;
D3D11_DEPTH_STENCIL_VIEW_DESC DSVDesc;
ZeroMemory(&DSVDesc, sizeof(D3D11_DEPTH_STENCIL_VIEW_DESC));
DSVDesc.Format=DSVDesc.Format;
DSVDesc.ViewDimension=D3D11_DSV_DIMENSION_TEXTURE2D;
DSVDesc.Texture2D.MipSlice=0;
Device->CreateTexture2D(&DepthStenDescription, NULL, &DepthStenBuffer);
Device->CreateDepthStencilView(DepthStenBuffer, &DSVDesc, &DepthStenView);
//---------------------------------------------------------------
Device->CreateRenderTargetView(Texture2d,NULL,&RenderTargetView);
Texture2d->Release();
有什麼缺失,該模型是這樣的?
紅色和白色是故意的。提前道歉。
編輯:所有的頂點爲1.0
這可能不一致在你的網格數據纏繞順序。 'D3D11_CULL_NONE'的外觀是什麼? –
它看起來是纏繞順序,我將'D3D11_CULL_BACK'改爲'D3D11_CULL_NONE'。以下是一個嘶啞的問題:如何重新排列頂點數組,以便在「正確」方向上連續創建面? (我的索引是從.obj文件中提取的)我應該跳回到Maya並做一些反應嗎?或者是否存在從頂點1開始的算法。 此外,似乎還存在一個透視問題:距離越近的物體越大,物體越靠近。這是我的'XMMatrixPerspectiveFovLH(XM_PIDIV2,1.0,0.0f,1000.0f)'在這裏工作嗎? –
當你有機會時,你可以將此作爲答案?網格上的纏繞順序確實不一致。 –