XNA Creators Club Online
Page 1 of 1 (8 items)
Sort Posts: Previous Next

Differing Graphics Performance

Last post 1/27/2009 12:17 PM by Tw1sted Demon. 7 replies.
  • 1/26/2009 11:16 PM

    Differing Graphics Performance

    Hi,

    I'm working on an XNA game and have run into some problems with the graphics.

    Basically, the majority of the development so far has been done on my PC. On there the graphics looks nice, smooth etc. Now, I've started working on my laptop and the graphics look and the texture colours go crazy sometimes. I've attached a screenshot...

    http://img145.imageshack.us/my.php?image=gfxegon8.png

    As you can see, the shadowing on the ball is all wrong and the platform in the background randomly flashes black (should be yellow like the one the ball is on).

    I also tried it on the 360 and had similar problems. It's almost like my bump-mapping HLSL only works properly on my PC, but not on the laptop/360. Is this a possible problem? If so, anyone got any tips how to fix it?

    Thanks,


  • 1/26/2009 11:47 PM In reply to

    Re: Differing Graphics Performance

    Try your program with the debug DirectX runtime, and see if it can spot any coding mistakes.
    XNA Framework Developer - blog - homepage
  • 1/27/2009 8:48 AM In reply to

    Re: Differing Graphics Performance

    Hi,

    I did as you suggested.

    There are a lot of 'Info' Messages but I'm assuming they are meaningless. It seems every draw call though I get..

    [3076] Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_TANGENT, 0) does not have corresponding usage in the current vertex declaration

    Could that be what's the problem? It seems strange it working on one computer and not the other though. The HLSL was automatically generated by RenderMonkey by the way.

    Thanks for the help.

  • 1/27/2009 10:37 AM In reply to

    Re: Differing Graphics Performance

    Looking again it appears to also have this error every time...

    [2636] Direct3D9: (WARN) :Vertex shader function usage (D3DDECLUSAGE_BINORMAL, 0) does not have corresponding usage in the current vertex declaration

  • 1/27/2009 11:45 AM In reply to

    Re: Differing Graphics Performance

    What that means, is that the vertex shader is accessing tangent / binormals values, but the vertex data (according to the vertex declaration) doesn't contain them, and in such a case, the values used in the vertex shader will be undefined.

    Xen: Graphics API for XNA
    www.codeplex.com/xen
  • 1/27/2009 12:04 PM In reply to

    Re: Differing Graphics Performance

    So, how could I provide the tangent/binormal values? The current VertexShader code is this...

    struct VS_INPUT  
       float4 Position : POSITION0; 
       float2 Texcoord : TEXCOORD0; 
       float3 Normal :   NORMAL0; 
       float3 Binormal : BINORMAL0; 
       float3 Tangent :  TANGENT0; 
        
    }; 
     
    struct VS_OUTPUT  
       float4 Position :        POSITION0; 
       float2 Texcoord :        TEXCOORD0; 
       float3 ViewDirection :   TEXCOORD1; 
       float3 LightDirection:   TEXCOORD2; 
        
    }; 
     
    VS_OUTPUT Textured_Bump_Pass_0_Vertex_Shader_vs_main( VS_INPUT Input ) 
       VS_OUTPUT Output; 
     
       Output.Position         = mul( Input.Position, matViewProjection ); 
       Output.Texcoord         = Input.Texcoord; 
        
       float3 fvObjectPosition = mul( Input.Position, matView ); 
        
       float3 fvViewDirection  = fvEyePosition - fvObjectPosition; 
       float3 fvLightDirection = fvLightPosition - fvObjectPosition; 
          
       float3 fvNormal         = mul( Input.Normal, matView ); 
       float3 fvBinormal       = mul( Input.Binormal, matView ); 
       float3 fvTangent        = mul( Input.Tangent, matView ); 
           
       Output.ViewDirection.x  = dot( fvTangent, fvViewDirection ); 
       Output.ViewDirection.y  = dot( fvBinormal, fvViewDirection ); 
       Output.ViewDirection.z  = dot( fvNormal, fvViewDirection ); 
        
       Output.LightDirection.x  = dot( fvTangent, fvLightDirection ); 
       Output.LightDirection.y  = dot( fvBinormal, fvLightDirection ); 
       Output.LightDirection.z  = dot( fvNormal, fvLightDirection ); 
        
       return( Output ); 
        


    I don't really know HLSL but it looks to me like Binormal and Tangent should be defined in Input (but obviously aren't being). Can I force XNA or do something to make that data be sent?

    Thanks for the help :)
  • 1/27/2009 12:10 PM In reply to

    Re: Differing Graphics Performance

    The Binormal and Tangent are defined in your shader ok. You have to make sure they are also defined in your vertex stream that you are passing to the shader, which is in your C# code.
    Game hobbyist hell-bent on coding a diabolical Matrix
  • 1/27/2009 12:17 PM In reply to

    Re: Differing Graphics Performance

    Solved :)

    Thanks for the help. I just changed the settings on the content processor to Generate Tangents to true and it all looks good again.

    Thanks.
Page 1 of 1 (8 items) Previous Next