65 lines
2.3 KiB
Plaintext
65 lines
2.3 KiB
Plaintext
{
|
|
parms {
|
|
stageSort sortCoverage
|
|
newDiffuseScale exposure.x * newDiffuseScale
|
|
}
|
|
state {
|
|
depthfunc GL_LEQUAL
|
|
}
|
|
hlsl_vp {
|
|
// Convert back from 16 bit vertex elements.
|
|
float4 position = vertex.position * $vertexXYZScale + $vertexXYZBias;
|
|
|
|
result.position.x = dot( position, $mvpMatrixX );
|
|
result.position.y = dot( position, $mvpMatrixY );
|
|
result.position.z = dot( position, $mvpMatrixZ );
|
|
result.position.w = dot( position, $mvpMatrixW );
|
|
|
|
float4 normal = vertex.normal * 2.0 - 1.0;
|
|
float4 tangent = vertex.tangent * 2.0 - 1.0;
|
|
float3 bitangent = cross( normal.xyz, tangent.xyz ) * tangent.w;
|
|
|
|
// texture 0 takes the base coordinates modified by stScaleBias
|
|
// for 16 bit vertex elements
|
|
result.texcoord0 = ( vertex.texcoord0.xy * $vertexStScaleBias.xy + $vertexStScaleBias.zw ).xyxy;
|
|
|
|
// transform the local space vectors to world space
|
|
result.texcoord1.x = dot3( tangent, $modelMatrixX );
|
|
result.texcoord1.y = dot3( bitangent, $modelMatrixX );
|
|
result.texcoord1.z = dot3( normal, $modelMatrixX );
|
|
result.texcoord1.w = 0.0;
|
|
|
|
result.texcoord2.x = dot3( tangent, $modelMatrixY );
|
|
result.texcoord2.y = dot3( bitangent, $modelMatrixY );
|
|
result.texcoord2.z = dot3( normal, $modelMatrixY );
|
|
result.texcoord2.w = 0.0;
|
|
|
|
result.texcoord3.x = dot3( tangent, $modelMatrixZ );
|
|
result.texcoord3.y = dot3( bitangent, $modelMatrixZ );
|
|
result.texcoord3.z = dot3( normal, $modelMatrixZ );
|
|
result.texcoord3.w = 0.0;
|
|
|
|
// dir from the viewer to the vertex
|
|
result.texcoord4.x = dot4( position, $modelMatrixX );
|
|
result.texcoord4.y = dot4( position, $modelMatrixY );
|
|
result.texcoord4.z = dot4( position, $modelMatrixZ );
|
|
result.texcoord4.xyz -= $globalViewOrigin.xyz;
|
|
result.texcoord4.w = 0.0;
|
|
}
|
|
hlsl_fp {
|
|
#include "includes/unique.inc"
|
|
|
|
result.color1 = PackFeedback( CalculateFeedback( fragment.texcoord0.xy, $virtualTextureFeedbackFloat, $physicalUniqueFilterParms ) );
|
|
|
|
half4 sampleSpecular;
|
|
half4 sampleYCoCg;
|
|
half4 sampleNormal;
|
|
half4 color;
|
|
|
|
FETCH_UNIQUE( sampleSpecular, sampleYCoCg, sampleNormal );
|
|
CALC_DIFFUSE_RGB( color, sampleYCoCg );
|
|
APPLY_SPECULAR( color, sampleSpecular, sampleNormal, fragment.htexcoord1.xyz, fragment.htexcoord2.xyz, fragment.htexcoord3.xyz, fragment.htexcoord4.xyz );
|
|
|
|
result.color0 = color;
|
|
}
|
|
} |