Sign in to follow this  
TheOrestes

Fx Shader weird Culling Issue

Recommended Posts

[font=courier new,courier,monospace]Hi,[/font]

[font=courier new,courier,monospace]Am facing weird culling issue with My post processing shader. Right now, Post processing shader does nothing but draws the scene as it is on the screen space aligned quad with back buffer surface as a texture. [/font]

[font=courier new,courier,monospace]To my surprise, the real problem is with weird culling issue that is occuring only on the nvidia cards. Everything works fine when demo is run on ati cards. Attached is the screenshots for both the cards. I tried setting cullmode to all 3 modes both inside CPP code & in shader technique as well, but am unable to figure out real cause for the problem.[/font]

[font=courier new,courier,monospace]Attached is the basic shader code for post process setup. [/font][font=courier new,courier,monospace][code]// Global Shader Variables
texture gScreenTexture;[/font]
[font=courier new,courier,monospace]// Samplers
sampler screenSampler = sampler_state
{
Texture = <gScreenTexture>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};[/font]
[font=courier new,courier,monospace]/////////////////////////////////////////////////////////////////////[/font]
[font=courier new,courier,monospace]// The vertex shader does not do any transformation, coordinates
// are allready in clipping space.
VS_OUTPUT VS( float4 Pos:POSITION, float2 Tex:TEXCOORD0 )
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.Pos=Pos;
output.Tex = Tex;
return output;
}[/font]
[font=courier new,courier,monospace]// Default
float4 PS(VS_OUTPUT pIn):COLOR0
{
float4 rgb = tex2D ( screenSampler, pIn.Tex);
return rgb;
}[/font]
[font=courier new,courier,monospace]/////////////////////////////////////////////////////////////////////
// tecnique name needs to correspond to the value passed
// to the GetTechniqueByName method
technique Default
{
pass p0
{
VertexShader = compile vs_3_0 VS();
PixelShader = compile ps_3_0 PS();
}
}
[/code][/font]

[font=courier new,courier,monospace]I can be rest assured that setup required for the Post processing is done in the correct way using DirectX. Screenshots for all post processing effects achieved so far on ATI cards can be seen on this blog of mine : [url="http://rupeshmandke.blogspot.in/"]http://rupeshmandke.blogspot.in/[/url][/font]

[font=courier new,courier,monospace]Any guidance will be much appreciated. [/font]

[font=courier new,courier,monospace]Thanks,[/font]
[font=courier new,courier,monospace]rmandke. [/font]

Share this post


Link to post
Share on other sites
[quote name='MJP' timestamp='1333960734' post='4929487']
Do you have the debug runtimes enabled? You can turn it on from the DirectX control panel.
[/quote]

[font=courier new,courier,monospace]Hi,[/font]

[font=courier new,courier,monospace]Yes, I do have debug runtimes enabled. It gives me warning about "[/font][font=courier new,courier,monospace]Ignoring redundant SetSamplerState", something like :[/font]

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 16

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 17

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 18

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30

Direct3D9: (WARN) :Ignoring redundant SetRenderState - 8

Direct3D9: (WARN) :Ignoring redundant SetRenderState 8

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 14

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 25

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 15

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 16

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 17

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 18

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 19

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 20

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 21

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 29

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 30

Direct3D9: (WARN) :Ignoring redundant SetRenderState - 8

Direct3D9: (WARN) :Ignoring redundant SetRenderState 8

Direct3D9: (WARN) :Ignoring redundant SetSamplerState Sampler: 0, State: 13

[font=courier new,courier,monospace]Thanks for the quick reply though .. Please guide me in how i can debug this issue. The problem is somehow specific only on nvidia cards [img]http://public.gamedev.net//public/style_emoticons/default/sad.png[/img][/font][font=courier new,courier,monospace] [/font]

Share this post


Link to post
Share on other sites
[font=courier new,courier,monospace]Hi,[/font]

[font=courier new,courier,monospace]Anyone has any information on this issue? Has anyone ever faced such weird culling issues?[/font]
[font=courier new,courier,monospace]Any help would be appreciable [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img][/font][font=courier new,courier,monospace] [/font]

Share this post


Link to post
Share on other sites
This shader looks fine. I want to see the shader that draws the dwarf and the code that calls this shader.

Or better yet, upload the example and I can execute it in my machine (I have an NVIDIA car, a GeForce 560Ti). This could help to find driver problems or something similar.

Bye.

Ps: I don’t have antivirus (never had), so no virus please.

Share this post


Link to post
Share on other sites
Hi Guys,

First of all thanks a lot for giving attention to my problem. I was not able to look at the problem till today, when i decided to give PIX a final shot! And guess what! I have solved the mystery ...hmm.. maybe partially, I mean am getting the desired output right now, no weird culling issue anymore on nvidia card :)
Solution? Well, I had this in the device creation code :
[CODE]
d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;
[/CODE]
I changed it to [b]D3DMULTISAMPLE_NONE[/b] & the problem was resolved! how i got this idea? So, i started debugging using PIX for single frame capture, to my surprise whenever i tried debugging the frame I used to get warning saying multisampling is [b]ON[/b], would you like to turn it [b]OFF [/b]in order to match the output to rendertarget? I was constantly saying yes / no randomly without actually reading the warning completely.

Later on, to my suprise, I noticed that everytime i turned [b]OFF [/b]multisampling output in rendertarget used to be correct i.e. without weird culling issues, when i discarded the warning I used to get renderbuffer with problematic output.
So, I just went back & did the changes! & whoila!!! But still not able to really understand as how the problem has been mitigated though. DirectX doc says, multisampling to be used only when
[i]d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD[/i]; not otherwise.

I had this in my code & still have it. But the problem is gone with disabling multisampling only.
Any idea on this one? It will make me happier if i know the complete reason :)

Cheers,
TheOrestes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this