Fx Shader weird Culling Issue

Started by
6 comments, last by TheOrestes 11 years, 7 months ago
[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]// 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();
}
}
[/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 : http://rupeshmandke.blogspot.in/[/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]
Advertisement
Do you have the debug runtimes enabled? You can turn it on from the DirectX control panel.

Do you have the debug runtimes enabled? You can turn it on from the DirectX control panel.


[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 sad.png[/font][font=courier new,courier,monospace] [/font]
[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 smile.png[/font][font=courier new,courier,monospace] [/font]
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.

[size=1]Project page: [size=1]<

[size=1] XNA FINAL Engine[size=1] [size=1]>
Hi jischeider,

I just lost this thread. Can you mail me your personal mail id so that i can mail you the code?
Please message me your mail id :)

Regards.
Ok. I removed my mail from here. I don't want too much spam.

[size=1]Project page: [size=1]<

[size=1] XNA FINAL Engine[size=1] [size=1]>
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 :

d3dpp.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES;

I changed it to D3DMULTISAMPLE_NONE & 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 ON, would you like to turn it OFF 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 OFF 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
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; 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.

This topic is closed to new replies.

Advertisement