Soft Particles

Started by
16 comments, last by Scoob Droolins 10 years, 8 months ago

device->Clear() is not failing, removing the flag D3DCLEAR_STENCIL doesn't make any difference.

I think that the depth buffer is being MOVED to the depth texture, so the scene is getting rendered without depth? Have you tried to check my code in your own program?

The problem is only getting fixed when I remove the line:

device->SetDepthStencilSurface(pINTZDSTSurface);

Advertisement

Yes, i have tried your code in my program and it works fine, look at above screenshot.

I will repeat my question:


Do you have some sates set in RenderScene(), probably in effect technique block?

This problem is really disturbing, I tried removing the render states, same problem!

I also tried to make changes to your terrain project (terrain2.rar), I don't get this problem with your project sample.

BTW, I'm using texture splatting pixel shader for the terrain, tried to use just one texture and render the terrain only (no other meshes), same problem too.

Effect technique:


technique tech
{
    pass
    {
         AlphaBlendEnable = FALSE;
         ZEnable = TRUE;
         VertexShader = compile vs_3_0 VS();
         PixelShader  = compile ps_3_0 PS();
    }
}

@belfegor: After searching and trying to resolve the problem for the whole day, I figured out that the problem only occur when I have antianalysing turned on, I don't know why.

I tried adding the following line to your old project, and I got the same problem:

d3dpp.MultiSampleType = D3DMULTISAMPLE_4_SAMPLES;

When I remove the above line, the problem get fixed, though I need antianalysing turned on, I attached your old project after modifying it, you can notice the problem:

[attachment=17346:Problem.rar]

I think INTZ depth buffer can't be used with anti aliasing, this check fails for me:


DWORD ql;
    hr = d3d9->CheckDeviceMultiSampleType( adapter, deviceType, FOURCC_INTZ, TRUE, D3DMULTISAMPLE_4_SAMPLES, &ql);
    if(FAILED(hr))
    {
        MessageBox(0, "CheckDeviceMultiSampleType() failed!", 0, 0);
        return false;
    }

Result is not available:

x862013-08-1311-33-13.jpg

@belfegor: hmm... what to do now? I want to create depth texture for soft particles and at the same time have antialiasing enabled like in most modern FPS games.

Here is the reason you can't use anti-aliasing for render targets, it isn't supported for DX 9...

http://msdn.microsoft.com/en-us/library/windows/desktop/bb147221(v=vs.85).aspx

This link says you can use anti-aliasing but unfortunately on my card it didn't work (GTX 250)

http://msdn.microsoft.com/en-us/library/windows/desktop/bb174361(v=vs.85).aspx

******************************************************************************************
Youtube Channel

In D3D9, you can indeed create a multisample render target, but it is not a texture, and cannot be used in a shader. Your only option would be to resolve this target to a non-multisample texture of the same size, and use that in your shader. Use StretchRect for the resolve.

This topic is closed to new replies.

Advertisement