28 lines
882 B
Plaintext
28 lines
882 B
Plaintext
{
|
|
parms {
|
|
stageSort sortCoverage
|
|
}
|
|
hlsl_vp {
|
|
// Convert back from 16 bit vertex elements.
|
|
float4 position = vertex.position * $vertexXYZScale + $vertexXYZBias;
|
|
|
|
result.position.x = dot4( position, $mvpMatrixX );
|
|
result.position.y = dot4( position, $mvpMatrixY );
|
|
result.position.z = dot4( position, $mvpMatrixZ );
|
|
result.position.w = dot4( position, $mvpMatrixW );
|
|
}
|
|
hlsl_fp {
|
|
// calculations in eye space
|
|
float3 pos;
|
|
pos.z = 1.0 / fragment.position.w;
|
|
pos.xy = pos.z * ( 2.0 * screenPosToTexcoord( fragment.position.xy, $positionToViewTexture ) - 1.0 );
|
|
float3 normal = -normalize( cross( ddx( pos ), ddy( pos ) ) );
|
|
|
|
// light is above and to the right in the eye plane
|
|
float3 L = normalize( float3( 1.0, 1.0, 0.0 ) - pos );
|
|
|
|
result.color0.xyz = _float3( dot3( normal, L ) * 0.75 );
|
|
result.color0.w = 1.0;
|
|
result.color1 = _float4( 0.0 );
|
|
}
|
|
} |