I'm at the stage I would like to implement some simple per-pixel lighting into my scene. I noticed there was already an existing snippet on the Wiki's shaders page so I decided to give that a try. It works well on DirectX 11 (with some simple changes - SV_Target output, using a Texture2D object, etc.) however it fails to compile in DirectX 9. The error? Well..
Code: Select all
12:43:28: OGRE EXCEPTION(3:RenderingAPIException): Cannot assemble D3D9 high-level shader Simple_PerPixel_Frag_DX9 Errors:
error X4541: vertex shader must minimally write all four components of POSITION
Code: Select all
void main_vp(
// in
in float4 iPosition : POSITION,
in float3 iNorm : NORMAL,
// out
out float4 oPosition : POSITION,
out float4 oPositionPS : TEXCOORD0,
out float3 oNorm : TEXCOORD1,
out float4 oLightPos : TEXCOORD2,
out float3 oEyePos : TEXCOORD3,
// uniform
uniform float4 lightPosition,
uniform float3 eyePosition,
uniform float4x4 uWorldViewProj)
{
oPosition = mul(uWorldViewProj, iPosition);
oPositionPS = iPosition.xyz;
oLightPos = lightPosition;
oEyePos = eyePosition;
oNorm = iNorm;
}
I'm either overlooking something stupidly simple or something is wrong here. For reference I'm running Ogre 1.10.