2017-12-24 11 views
0

結果を変更しない行を除き、ほぼすべてのコードを共有する2つのシェーダを作成しました。 それは、コードの共有部分です:HLSLシェーダが機能しない

struct VOut 
{ 
    float4 position : SV_POSITION; 
    float4 color : COLOR; 
    float4 ld1 : LD; 
}; 

cbuffer LIGHT : register (cb0) 
{ 
    float4 light_direction; 
    float4 light_color; 

}; 

cbuffer TRANSFORMATION_MATRIX : register (cb1) 
{ 
    float4x4 transformationMatrix; 
}; 

cbuffer CAM_PROJ_MATRIX : register (cb2) 
{ 
    float4x4 cameraProjectionMatrix; 
}; 

float4 PShader(float4 position : SV_POSITION, float4 color : COLOR) : SV_TARGET 
{ 
return color; 
} 

頂点シェーダは変更部分:

VOut VShader(float3 position : POSITION, float4 color : COLOR) 
{ 
    VOut output; 

    float4 rpos = mul(transformationMatrix,float4(position, 1.0)); 

    output.position = mul(cameraProjectionMatrix, rpos); 

    *output.ld1 = light_direction;* 

    output.color = color; 

    return output; 
} 

この1つは正常に動作しますが、私はアスタリスクの間に線を変更した場合(明らかにアスタリスクではありません実際のコードで)

私は画面上に何も表示されません。このことはどのように可能ですか?

+0

'' LD''は標準的な意味ではありませんので意味がありません。有効な段間補間器を得るために '' TEXCOORD0''を使ってみてください。 –

答えて

0
struct VOut 
    { 
     float4 position : SV_POSITION; 
     float4 color : COLOR; 
     float4 ld1 : TEXCOORD0; 
    }; 
+1

このコードスニペットは解決策になるかもしれませんが、説明を含めて本当にあなたの投稿の質を向上させるのに役立ちます。将来読者の質問に答えていることを覚えておいてください。そうした人々はあなたのコード提案の理由を知らないかもしれません。 – Alexander

関連する問題