vertex shader must minimally write all four components of POSITION
Though the POSITION semantic must be written out by the vertex shader, it cannot be read in by the pixel shader in ps_2_0. So, the fix is to write out the position twice, but one of those is not labeled as POSITION, it is instead labeled as a TEXCOORD0. Then, the pixel shader does not use the POSITION semantic variable, but uses the TEXCOORD0 instead. To the compiler it effectively means that the POSITION input to the pixel shader can be ignored.
right code:
float4x4 ViewProjection;
struct VS_INPUT
{
float4 Position : POSITION0;
float3 Normal : NORMAL0;
float2 tcBase:TEXCOORD0;
};
struct VS_OUTPUT
{
float4 Position : POSITION0;
float3 Normal : TEXCOORD1;
float2 tcBase:TEXCOORD2;
};
}
VS_OUTPUT vs_main( VS_INPUT Input )
{
VS_OUTPUT Output;
Output.Position = mul( Input.Position, ViewProjection );
Output.Normal = Input.Normal;
Output.tcBase = Input.tcBase;
return( Output );
}
sampler AmbOcclusion;
sampler DiffuseEnvironment;
struct PS_OUTPUT
{
float4 Position : TEXCOORD0;
float3 Normal : TEXCOORD1;
float2 tcBase:TEXCOORD2;
};
float4 ps_main(PS_OUTPUT Input) : COLOR0
{
// Sample the filtered environment map
float4 ambient = texCUBE(DiffuseEnvironment, Input.Normal);
// Sample the ambient occlusion map
float ambientOcclusion = tex2D(AmbOcclusion, Input.tcBase).r;
return ambient * ambientOcclusion;
}
相关文章
- probably another instance of uWSGI is running on the same address
- 溢出OF和进位CF标志位的判定
- ORA-00323: Current log of thread string not useable and all others need archiving ORACLE 报错 故障修复 远程处理
- ORA-27370: job slave failed to launch a job of type EXECUTABLE ORACLE 报错 故障修复 远程处理
- ORA-29383: all leaves of top-plan string must be consumer groups ORACLE 报错 故障修复 远程处理
- ORA-31612: Allocation of process descriptor failed. ORACLE 报错 故障修复 远程处理
- ORA-32042: recursive WITH clause must reference itself directly in one of the UNION ALL branches ORACLE 报错 故障修复 远程处理
- ORA-01862: the numeric value does not match the length of the format item ORACLE 报错 故障修复 远程处理
- ORA-10260: limit size (string) of the PGA heap set by event 10261 exceeded ORACLE 报错 故障修复 远程处理
- for all entiries of bseg详解编程语言
- Dave Unravels the Mysteries of Oracle(daveoracle)
- Unlock the Power of Real MySQL in Your Database(realmysql)
- all灵活运用Oracle中的Union All(oracle中union)
- data miningUnlocking the Power of Oracle Data Mining(roracle)
- Exploring the Power of Linux .la Libraries: A Comprehensive Guide(linux.la)
- Exploring the Benefits of ThirdParty Software on Linux(第三方软件linux)