しかし、 pow(0, 2.0) は 0 を返します
float 指数は 1 になり、integer 指数は 0 になるようです。
DirectX 9 と hlsl コンパイラ「D3DCompiler_43.dll」を使用しています。Nvidia と Ati カードでそれを確認しました。
私は混乱しています!それはある種の既知の動作またはバグですか?
効果を説明するために、次の簡単なテスト シェーダーを試してください。
// Test shader demonstrating strange pow behaviour
// when brightness becomes 0 resulting color will jump to white
float4x4 WorldViewProjXf : WorldViewProjection < string UIWidget="None";>;
float Brightness
<
string UIName = "Brightness";
float UIMin = 0;
float UIMax = 1;
> = 0;
struct VS_Input
{
float4 position : POSITION0;
};
struct VS_Output
{
float4 position : POSITION0;
};
VS_Output Vertex_Func( VS_Input in_data )
{
VS_Output outData;
outData.position = mul(in_data.position, WorldViewProjXf);
return outData;
}
float4 Fragment_Func( VS_Output in_data ) : COLOR
{
return pow(Brightness, 2.2);
}
technique Main
{
pass p0
{
VertexShader = compile vs_3_0 Vertex_Func();
PixelShader = compile ps_3_0 Fragment_Func();
}
}