When I run my game, I get the following error in the output:
I’ve set “basic-shaders-only #f” in my config file, but I’m still getting the same error. Is it possible to access an interpolated position in a fragment shader?
the “out float4 l_position : POSITION” is consumed by the graphics card, so you cant access it your fshader. So just return it twice, once graphics card and once for your needs. Another note you can’t do much with a mul(mat_modelproj, vtx_position) position any ways because it has that stupid matrix applied unless its a screen space shader.
in my shaders i do:
void vshader(
...
out float4 l_vertPos : TEXCOORD6,
...
l_position=mul(mat_modelproj, vtx_position);
l_vertPos = vtx_position;
...
void fshader(
in float4 l_vertPos : TEXCOORD6,
...
lightvec = normalize((float3)mspos_sun - l_vertPos); // use it in like light stuff
...