1

使用旧网格,我注意到网格背面的面正在显示(DirectX 11)定义了一个状态:

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();

模型看起来像这样有什么遗漏吗?在此处输入图像描述

红色和白色是故意的。提前道歉。

编辑:所有顶点的 alpha 值为 1.0

4

1 回答 1

1

听起来您的网格数据中的缠绕顺序不一致。

您可以通过比较获得的结果来检查这一点D3D11_CULL_NONE,因此您将看到所有三角形,并可以评估是否有任何缺失或不正确的位置信息。

于 2014-01-29T08:31:56.437 回答