windows 8 - DirectX 11.1 Disable the depth buffer -
this question relates previous question have asked.
i have series of 48 textures on flat square meshes rendering , combine form 1 "scene." each have big percentage of of transparency 1 or 2 smaller images, , when line up, should able see total scene. expected work without much issue, when when went test it, see top-most texture, , anywhere have transparency, clear color.
at first, thought issue how loading image , somehow disabling alpha, after playing around clear color, realized there transparency.
second, tried enable blending - works if textures combined on single z plane.
i have posted image loading , blending code on question linked above.
now starting think may issue depth buffer, added next code window dependent resources:
microsoft::wrl::comptr<id3d11depthstencilstate> depthdefault; d3d11_depth_stencil_desc depthstencildesc; zeromemory(&depthstencildesc, sizeof(depthstencildesc)); depthstencildesc.depthenable = false; depthstencildesc.depthwritemask = d3d11_depth_write_mask_all; depthstencildesc.depthfunc = d3d11_comparison_always; depthstencildesc.stencilenable = false; depthstencildesc.backface.stencildepthfailop = d3d11_stencil_op_keep; depthstencildesc.backface.stencilfailop = d3d11_stencil_op_keep; depthstencildesc.backface.stencilfunc = d3d11_comparison_always; depthstencildesc.backface.stencilpassop = d3d11_stencil_op_keep; depthstencildesc.frontface.stencildepthfailop = d3d11_stencil_op_keep; depthstencildesc.frontface.stencilfailop = d3d11_stencil_op_keep; depthstencildesc.frontface.stencilfunc = d3d11_comparison_always; depthstencildesc.frontface.stencilpassop = d3d11_stencil_op_keep; dx::throwiffailed( direct3d.device->createdepthstencilstate(&depthstencildesc, depthdefault.getaddressof() ) ); direct3d.context->omsetdepthstencilstate(depthdefault.get(), 0); even code, seeing topmost layer. missing something, or setting incorrectly?
edit: visualize problem, it's if had 48 panes of glass same size , in row. each piece of glass has 1 image somewhere on it. when through glass panes, 1 awesome image of smaller images combined. me, directx or pixel shader drawing first glass pane , filling transparency of first pane clear/background color.
edit: code i'm using create depthstencilview:
cd3d11_texture2d_desc depthstencildesc( dxgi_format_d24_unorm_s8_uint, backbufferdesc.width, backbufferdesc.height, 1, 1, d3d11_bind_depth_stencil ); comptr<id3d11texture2d> depthstencil; dx::throwiffailed( direct3d.device->createtexture2d( &depthstencildesc, nullptr, &depthstencil ) ); auto viewdesc = cd3d11_depth_stencil_view_desc(d3d11_dsv_dimension_texture2d); dx::throwiffailed( direct3d.device->createdepthstencilview( depthstencil.get(), &viewdesc, &direct3d.depthstencil ) ); that code literally right above depth test/ d3d11_depth_stencil_desc code. i'm presuming creates depth code.
i think might need sort order in render vertices if want render semi-transparencies depth buffer. if don't want utilize depth buffer - perhaps don't define/create/set it?
windows-8 directx-11 c++-cx
No comments:
Post a Comment