Note that there are some explanatory texts on larger screens.

plurals
  1. PODirectX 11 Shader Error. Pixel Shader receiving only NaN
    primarykey
    data
    text
    <p>Hy everyone. I started re-coding my engine to convert it to directx 11. I'm now trying to get the basics working, but this error is really stoping me. I created a basic shader, a simple dot product of the normal and the view. I got it to compile without errors, but it dosnt works. It just totaly deforms the input mesh. I started debugging in vs2012, and found out that the pixel shader was getting as input all NaNs. I attached two screens and the shader code, if someone can provide any ideas, it would be really apriciated.</p> <p><a href="https://i.stack.imgur.com/5oFMI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5oFMI.png" alt="VS2012 Debugging info 1"></a> <a href="https://i.stack.imgur.com/GdfvU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GdfvU.png" alt="VS2012 Debugging info 2"></a></p> <p>Vertex Shader</p> <pre><code>//---------------------------------------------------------------------------- // Constant Buffer Variables //---------------------------------------------------------------------------- cbuffer ConstantBuffer : register( b0 ) { matrix World; matrix View; matrix Projection; //float3 CameraPos; float Power; } //--------------------------------------------------------------------------- struct VS_INPUT { float4 Pos : POSITION; float3 Normal : NORMAL; }; struct VS_OUTPUT { float4 Pos : SV_POSITION; float3 Normal : TEXCOORD0; }; //-------------------------------------------------------------------------- // Vertex Shader //------------------------------------------------------------------------------- VS_OUTPUT VS( VS_INPUT input) { VS_OUTPUT output = (VS_OUTPUT)0; output.Pos = mul( input.Pos, World ); output.Pos = mul( output.Pos, View ); output.Pos = mul( output.Pos, Projection ); output.Normal = mul( float4( input.Normal, 1 ), World ).xyz; //output.wNormal = input.Normal; return output; } </code></pre> <p>And here the Pixel Shader</p> <pre><code>//------------------------------------------------------------------------------ // Constant Buffer Variables //------------------------------------------------------------------------------ cbuffer ConstantBuffer : register( b0 ) { matrix World; matrix View; matrix Projection; float Power; } //------------------------------------------------------------------------------ struct VS_OUTPUT { float4 Pos : SV_POSITION; float3 wNormal : TEXCOORD0; }; //----------------------------------------------------------------------------- // Pixel Shader //----------------------------------------------------------------------------- float4 PS( VS_OUTPUT input) : SV_Target { //return pow(dot(input.wNormal,float3(0,0,0)),Power); // fixed camera, just for now return float4(0.1,0.6,0.1,1); } </code></pre> <p>And at last, i created a xml file structure for my shaders, that i then parse, dont know if it relevant, but</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;vs path = "D:\\Documentos\\Visual Studio 2012\\Projects\\Fusion Engine\\Tests\\ConstantLighting_VS.hlsl" name ="VS" target = "vs_4_0"&gt; &lt;/vs&gt; &lt;ps path = "D:\\Documentos\\Visual Studio 2012\\Projects\\Fusion Engine\\Tests\\ConstantLighting_PS.hlsl" name ="PS" target = "ps_4_0"&gt; &lt;val1 type = "scalar" value = "0.456645" name = "Power"/&gt; &lt;/ps&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload