21.7 C
New York
Monday, April 28, 2025

2D – The right way to create a Pencil2D depth matrix of Texture2Darray


I’ve already performed one thing like that for Texturecube, however right here I don’t perceive what I’m doing mistaken. I’ve the error message of exception of the primary alternative. Subsequent, how I proceed:

  1. Create a texture for the deep board as texture2dary (arrayize = 3). It really works nicely
  2. Create a depth stadium from this texture. It really works nicely

Now I need to create a wide range of depth weapons to have the ability to render them individually with out a geometry shador

Then substitute 2)

2)

ID3D11DepthStencilView* CreateDepthStencilView2DFromArray(ID3D11Texture2D* pText2D, DXGI_FORMAT Format, DWORD Slice)//slice is the index to make use of within the array
{
ID3D11DepthStencilView* pDSV = NULL;
    D3D11_DEPTH_STENCIL_VIEW_DESC descDSV;
    ZeroMemory(&descDSV, sizeof(descDSV));
    descDSV.Format = Format;
    descDSV.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2DARRAY;
    descDSV.Texture2DArray.FirstArraySlice = Slice;
    descDSV.Texture2DArray.ArraySize = 1;
    descDSV.Texture2DArray.MipSlice = 0;
    HRESULT hr = gpD11->CreateDepthStencilView(pText2D, &descDSV, &pDSV);
    if (FAILED(hr)) return NULL;
    return pDSV;
}

So I do not use mipmaps, so I configured mipsix in 0.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles