ARTICLE AD BOX
I'm trying to optimise my skybox to only use one draw call. But unfortunately I have this output:
Disabling the depth buffer (by unbinding it) solves the issue, but objects drawn before the cubemap aren't visible anymore.
Skybox shader is written as:
cbuffer Data : register(b0) { row_major matrix matWorldViewProj; // MVP transformation } TextureCube CubeMapTexture : register(t0); SamplerState CubeMapSampler { Texture = <CubeMapTexture>; AddressU = CLAMP; AddressV = CLAMP; AddressW = CLAMP; BorderColor = float4(1, 1, 1, 1); Filter = LINEAR; }; struct VertexIn { float3 Position : POSITION; }; struct VertexOut { float4 Position : SV_POSITION; float3 UVW : TEXCOORD0; }; VertexOut VS_Main(VertexIn v) { VertexOut output; output.Position = mul(float4(v.Position, 1.0f), matWorldViewProj); output.Position.z = output.Position.w; output.UVW = v.Position; return output; } float4 PS_Main(VertexOut v) : SV_TARGET { return CubeMapTexture.Sample(CubeMapSampler, normalize(v.UVW)); }Using RenderDoc, these are the states when the cubemap is being drawn:
Descriptor D3D11_RASTERIZER_DESC()
FillMode D3D11_FILL_SOLID CullMode D3D11_CULL_BACK FrontCounterClockwise False DepthBias 0 DepthBiasClamp 0.00 SlopeScaledDepthBias 0.00 DepthClipEnable False ScissorEnable False MultisampleEnable False AntialiasedLineEnable FalseStencil state:
Face: Front Func: Always Fail op: Keep Depth Fail op: Keep Pass op: Keep Back: Front Func: Always Fail op: Keep Depth Fail op: Keep Pass op: KeepCulling mode is back.
This is not related to the winding of the vertices, as flickering is present when moving the camera around.
