void PixelShaderFunction(in float2 texCoord:TEXCOORD0, out float4 color:COLOR0, out float depth:DEPTH){ color=float4(0,0,0,0); depth=tex2D(DepthSampler, texCoord).r; }
Tato část provádí ono kouzlo, protože zapisuje námi uloženou hloubku ale barvu ne (před vykreslením jsem povolil alfa blending). A to je kupodivu všechno. Jak prosté že ano? :-)
I am back! Here is another english post this time with XNA theme. Problem how to restore Depth Buffer was with me almost half of a year. I post THIS question, but without any good answer. Finally tomorrow I found it! In this article I have found everything that I need to know. First you need to have depth stored in texture (I already have this from Light Pre-Pass) and use special shader described in article.
void PixelShaderFunction(in float2 texCoord:TEXCOORD0, out float4 color:COLOR0, out float depth:DEPTH){ color=float4(0,0,0,0); depth=tex2D(DepthSampler, texCoord).r; }
This part of code wites only depth and don't affect color (before drawing enable alpha blending). That's it!
Žádné komentáře:
Okomentovat