Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Alpha透明分层XNA_C#_3d_Xna_Layer_Alphablending - Fatal编程技术网

C# Alpha透明分层XNA

C# Alpha透明分层XNA,c#,3d,xna,layer,alphablending,C#,3d,Xna,Layer,Alphablending,我目前在XNA中的alpha透明性方面遇到了一些问题,对于任何有框架经验的人,我都希望能得到一些帮助。代码如下,但在此代码示例中,请注意: ReadStencil = new DepthStencilState() { DepthBufferEnable = true, DepthBufferWriteEnable = false }; 而且 WriteStencil = ne

我目前在XNA中的alpha透明性方面遇到了一些问题,对于任何有框架经验的人,我都希望能得到一些帮助。代码如下,但在此代码示例中,请注意:

ReadStencil = new DepthStencilState() 
             { 
               DepthBufferEnable = true,
               DepthBufferWriteEnable = false 
             };
而且

WriteStencil = new DepthStencilState() 
              {
                DepthBufferEnable = true,
                DepthBufferWriteEnable = true 
              };    
下面是实际代码:

SB.Begin();
GraphicsDevice.DepthStencilState = WriteStencil;
if (Scene != null) Scene.Draw();
Map.Draw();
SB.End();
SB.Begin();
GraphicsDevice.DepthStencilState = ReadStencil;
for (int i = 0; i < Players.Length; i++) if (Players[i] != null && Players[i].Active && Players[i].Respawn <= 0) Players[i].Draw();
if (Effects.Count > 0) for (int i = 0; i < Effects.Count; i++) Effects[i].Draw();
SB.Begin();
GraphicsDevice.DepthStencilState=WriteSencil;
如果(Scene!=null)Scene.Draw();
Map.Draw();
(某人结束);
某人开始做某事;
GraphicsDevice.DepthStencilState=ReadStencil;
对于(int i=0;i
在此图像中,深度设置为DepthStencilState.Default。当然,本例中的深度是正确的,但它似乎是在透明背后绘制舞台,而不是在“WriteSencil”状态下写入的对象/其他对象的部分。还要注意,在狐狸角色上,它在尾巴和头/脸上的头发轮廓周围做同样的事情

在此图像中,深度再次被扭曲,但初始问题已修复。头发网格周围没有不可见的边界

我可以想象有某种方法可以解决这个问题,因为这是一个问题可以解决另一个问题,但如果可能的话,我将非常感谢您的帮助


非常感谢。

绘制这些蓝色东西的代码是什么?它们是特效吗?是的,它们是特效。它们是在其他一切之后绘制的,代码是:if(Effects.Count>0)for(inti=0;i