Damage is now included; and I changed shininess representation to logarithmic.
Code: Select all
//NEW SHADER (high end)
uniform int light_enabled[gl_MaxLights];
uniform int max_light_enabled;
//samplers
uniform samplerCube cubeMap;
uniform sampler2D diffMap; //1-bit alpha in alpha, for alpha-testing only
uniform sampler2D specMap; //sqrt(shininess) in alpha
uniform sampler2D glowMap; //ambient occlusion in alpha
uniform sampler2D normMap; //U in .rgb; V in alpha
uniform sampler2D damgMap; //"is_dielectric" in 1-bit alpha
uniform sampler2D detailMap; //.rgb adds to diffuse, subtracts from spec; alpha mods shininess
//other uniforms
uniform vec4 cloakdmg; //.rg=cloak, .ba=damage
//envColor won't be needed, since we're fetching it from the envmap
//NOTE: Since the term "binormal" has been rightly deprecated, I use "cotangent" instead :)
vec3 lerp( in float f, in vec3 a, in vec3 b)
{
return (1.0-f)*a + f*b;
}
vec3 fastnormalize( in vec3 input ) //less accurate than normalize() but should use less instructions
{
float tmp = dot( input, input );
tmp = 1.5 - (0.5*tmp);
return tmp * input;
}
vec3 norm_decode( in vec4 input )
{
//The LaGrande normalmap noodle does away with the z-term for the normal by encoding U and V
//as 0.5*tan( angle ), where angle is arcsin( U ) or arcsin( V ), respectively. To fit that
//into a 0-1 range, we multiply by 0.5 once again, and add 0.5.
//To reverse the encoding, we first subtract 0.5, then multiply by four, fill the z term with
//1.0, and normalize. But multiplying by four is not needed if instead we fill the z term with
//0.25, instead; *then* normalize:
vec3 result;
result.x = 0.3333*(input.r+input.g+input.b) - 0.5;
result.y = input.a - 0.5;
result.z = 0.25;
return normalize( result ); //can't use fastnormalize() here
}
vec3 imatmul( in vec3 tan, in vec3 cotan, in vec3 norm, in vec3 light )
{
return light.xxx*tan + light.yyy*cotan + light.zzz*norm;
}
float shininess2Lod( in float alphashininess )
{
//return clamp( 7.0 - log2( shininess + 1.0 ), 0.0, 7.0 );
return 0.5 + 7.0 * ( 1.0 - alphashininess );
}
float alpha2shininess( in float alpha )
{
return pow( 255.0, alpha ); //means that alpha is log255( shininess )
}
float limited_shininess( in float shine )
{
float limit = 50.0; //50^2 is 2500. 2500*0.001 = 2.5 --enough risk of saturation!
return (shine*limit)/(shine+limit);
}
float specularNormalizeFactor( in float limited_shininess )
{
return pow(1.7/(1.0+limited_shininess/10.0),-1.7);
}
vec3 ambientMapping( in vec3 normal )
{
vec4 result = textureCubeLod( cubeMap, normal, 7.7 );
return result.rgb * result.a;
}
vec3 envMapping( in vec3 reflection )
{
vec4 result = textureCube( cubeMap, reflection );
return result.rgb * result.a;
}
vec3 envMappingLOD( in vec3 reflection, in float LoD )
{
vec4 result = textureCubeLod( cubeMap, reflection, LoD );
return result.rgb * result.a;
}
float soft_NdotL( in float NdotL ) //for soft penumbras
{
float s = 1.0 - (NdotL*NdotL); //s is 1.0 at penumbra point, falls slowly
s *= s; //falls faster
s *= s; //falls much faster either way from the penumbra point
s *= NdotL; //s is now zero at penumbra but has tiny +/- wavelets to the sides
return clamp( 0.98*NdotL + 0.02 - s, 0.0, 1.0 ); //we shrink NdotL by 2%, shift
//it up by 2%, and subtract the s wavelet to flatten the penumbra area
}
float selfshadow( in float sNdotL ) //use of soft NdotL should be most correct
{
float s = clamp(1.0 - sNdotL, 0.0, 1.0);
s *= s;
s *= s;
s *= s;
return clamp(1.0 - s, 0.0, 1.0);
}
void lightingLight
(
in vec3 light, in vec3 normal, in vec3 vnormal, in vec3 reflection,
in vec3 lightDiffuse, in float lightAtt, in float ltd_gloss,
inout vec3 diff_acc, inout vec3 spec_acc
)
{
float NdotL = clamp( dot(normal,light), 0.0, 1.0 );
float sNdotL = soft_NdotL( dot(vnormal,light) );
float RdotL = clamp( dot(reflection,light), 0.0, 1.0 );
float selfshadow = selfshadow( sNdotL );
float spec = pow( RdotL, ltd_gloss );
diff_acc += ( NdotL * lightDiffuse.rgb * lightAtt * selfshadow );
spec_acc += ( lightDiffuse.rgb * lightAtt * selfshadow );
}
#define lighting(name, lightno_gl, lightno_tex) \
void name( \
in vec3 normal, in vec3 vnormal, in vec3 reflection, \
in float limited_gloss, \
inout vec3 diff_acc, inout vec3 spec_acc) \
{ \
lightingLight( \
normalize(gl_TexCoord[lightno_tex].xyz), \
normal, vnormal, reflection, \
gl_FrontLightProduct[lightno_gl].diffuse.rgb, \
gl_TexCoord[lightno_tex].w, \
limited_gloss, \
diff_acc, spec_acc); \
}
lighting(lite0, 0, 5)
lighting(lite1, 1, 6)
void main()
{
///VARIABLE DECLARATIONS
//vector variables
vec4 temp4; //all-purpose vec4 temporary
vec3 eye_vec3;
vec3 vnormal_vec3;
vec3 normal_vec3;
vec3 tangent_vec3;
vec3 cotangent_vec3; //"binormal" ;-)
vec3 reflect_vec3;
vec3 light0_vec3;
vec3 light1_vec3;
//material color variables
vec3 diff_mat3;
vec3 damg_mat3;
vec3 spec_mat3;
vec3 glow_mat3;
//inferent light variables
vec3 light0_il3;
vec3 light1_il3;
vec3 ambient_il3; //to be fetched from envmap via normal
vec3 specular_il3; //to be fetched from envmap via reflect vector
vec3 spec_light_acc3; //specular light accumulator
vec3 diff_light_acc3; //diffuse light accumulator
//afferent light variables
vec3 diff_contrib_al3;
vec3 spec_contrib_al3;
vec3 envm_contrib_al3;
vec3 frsn_contrib_al3;
vec3 glow_contrib_al3;
vec3 amb_contrib_al3;
//accumulator:
vec4 result4;
//scalar factors and coefficients
float ao_glow_fac1; //plain ambient occlusion factor, used for ambient contribution
float ao_spec_fac1; //squared ambient occlusion, used for specular modulation
float ao_diff_fac1; //square root of ambient occlusion, used for diffuse
float is_dielectric_mat1; //0.0 = metal; 1.0 = dielectric
float gloss_mat1; //A.K.A. "shininess"
float limited_gloss_fac1; //smooth-limited gloss to use for spotlights
//interpolated mesh data fetches
vec2 texcoords2 = gl_TexCoord[0].xy;
vnormal_vec3 = fastnormalize( gl_TexCoord[1].xyz );
tangent_vec3 = gl_TexCoord[2].xyz;
cotangent_vec3 = gl_TexCoord[3].xyz;
///MOSTLY TEXTURE FETCHES (start with spec, as we'll need shininess at the earliest time):
//read specular into temp4, then spec_mat gets .rgb, and gloss_mat gets .a^2 (assume gamma=0.5)
temp4 = texture2D(specMap,texcoords2).rgba;
spec_mat3 = temp4.rgb;
// gloss_mat1 = clamp( 255.0 * temp4.a * temp4.a, 1.0, 255.0 );
gloss_mat1 = alpha2shininess( temp4.a );
float gloss_LoD1 = shininess2Lod( temp4.a );
//read normalmap into temp4, then .rgb goes to U, .a goes to V (tangent space just for now)
temp4 = texture2D(normMap,texcoords2).rgba;
normal_vec3 = norm_decode( temp4 );
//read glow texture into temp4, then .rgb^2 goes to glow_mat, and .a goes to ao_glo_fac
temp4 = texture2D(glowMap,texcoords2).rgba;
glow_mat3 = temp4.rgb * temp4.rgb; ao_glow_fac1 = temp4.a;
//read diffuse into temp4, then rgb goes to diff_mat, a goes to alpha
temp4 = texture2D(diffMap,texcoords2).rgba;
diff_mat3 = temp4.rgb; result4.a = temp4.a;
//read damage texture into temp4, then .rgb goes to damg_mat3, .a goes to is_dielectric
temp4 = texture2D(damgMap,texcoords2).rgba;
damg_mat3 = temp4.rgb; is_dielectric_mat1 = temp4.a;
//blend damage back into the diffuse
diff_mat3 = lerp( cloakdmg.b, diff_mat3, damg_mat3 );
//we need a darkening color to limit specularity as a function of damage, also
vec3 darkenin3;
temp4.rgb = vec4( 1.0 );
darkenin3 = vec3( 0.333 * dot( damg_mat3, damg_mat3 ) );
darkenin3 = lerp( cloakdmg, temp4.rgb, darkenin3 );
//and darken specular material by it
spec_mat3 *= darkenin3;
//read detail texture into temp4; then .rgb modulates diffuse/spec, .a modulates shininess
temp4 = texture2D(detailMap,16.0*texcoords2);
temp4 -= vec4( 0.5 ); temp4 *= 0.12345;
diff_mat3 -= temp4.rgb; spec_mat3 += temp4.rgb; gloss_mat1 -= temp4.a;
///OTHER PRE-PER-LIGHT COMPUTATIONS
//normalmapping-derived vector computations (normal (using tangent))
normal_vec3 = fastnormalize(imatmul(tangent_vec3,cotangent_vec3,vnormal_vec3,normal_vec3));
//reflection vector computation
reflect_vec3 = -reflect( eye_vec3, normal_vec3 );
//compute smooth shininess limit for spotlights
limited_gloss_fac1 = limited_shininess( gloss_mat1 );
//initialize accumulators
diff_light_acc3 = spec_light_acc3 = vec3( 0.0 );
//and might as well compute the shininess adjusted specularity
float spec_gloss_adj = specularNormalizeFactor( limited_gloss_fac1 );
//and might as well compute other gammas of ambient occlusion
ao_diff_fac1 = sqrt( ao_glow_fac1 );
ao_spec_fac1 = ao_glow_fac1 * ao_glow_fac1;
///PER-LIGHT COMPUTATIONS
if( light_enabled[0] != 0 )
lite0(normal_vec3,vnormal_vec3,reflect_vec3,limited_gloss_fac1,diff_light_acc3,spec_light_acc3);
if( light_enabled[1] != 0 )
lite1(normal_vec3,vnormal_vec3,reflect_vec3,limited_gloss_fac1,diff_light_acc3,spec_light_acc3);
//we will process the accumulators later, to give the above loops time to finish
//AMBIENT CONTRIBUTION
//assume the environment cube map is encoded with gamma = 0.5 (but keep it in the family ;-)
amb_contrib_al3 = ambientMapping( normal_vec3 );
frsn_contrib_al3 = envMapping( reflect_vec3 ); //fresnel env mapping, while we're at it...
amb_contrib_al3 *= ( amb_contrib_al3 * ao_glow_fac1 * diff_mat3 );
//now we can multiply material albedos by the flavors of ambient occlusion
spec_mat3 *= ao_spec_fac1;
diff_mat3 *= ao_diff_fac1;
///FRESNEL STUFF begins
//Fresnel evaluates to a coefficient that will be used to blend white specular specularity with
//the diffuse AND specular contributions, in the case of dielectrics. For non-dielectrics, fresnel
//will be zero. Shininess for fresnel specularity is always maxed out. Specularity and shininess
//specified through textures, with a dielectric material, will constitute a "third layer" for the
//material, and will allow representation of metallized paints.
float fresnel_alpha = 1.0 - clamp( dot( eye_vec3, normal_vec3 ), 0.0, 1.0 );
fresnel_alpha *= fresnel_alpha;
fresnel_alpha = clamp( 0.0625 + ( 0.9375 * fresnel_alpha ), 0.0625, 1.0 );
fresnel_alpha *= ( is_dielectric_mat1 * (1.0-cloakdmg.b) ); //cloakdmg.b is the damage
float fresnel_beta = 1.0 - fresnel_alpha; // ;-)
///ENVIRONMENT MAPPING
//shininess to env map LOD
//read env LOD (reflect); .rgb^2 goes to specular_il3 (assume gamma=0.5)
//assume the environment cube map is encoded with gamma = 0.5 (but keep it in the family ;-)
envm_contrib_al3 = envMappingLOD( reflect_vec3, gloss_LoD1 );
envm_contrib_al3 *= envm_contrib_al3;
//FRESNEL STUFF continues; now we apply it:
//essentially, total specular contribution is
//specular_material * (1-fresnel) * LODenv + fresnel * env (fresnel shininess always maxed out)
frsn_contrib_al3 *= fresnel_alpha; //don't multiply fresnel contrib by material spec; think...
diff_mat3 *= fresnel_beta;
envm_contrib_al3 *= ( fresnel_beta * spec_mat3 );
//diffuse contribution also gets multiplied by 1-fresnel
diff_contrib_al3 = diff_light_acc3 * diff_mat3 * ao_diff_fac1 * fresnel_beta;
//specular contribution is a bit of a hard question. Theoretically it should be multiplied by
//1-fresnel, but then we should add fresnel reflection of lights to the lighting loop, which
//would be expensive. Furthermore, specular spotlights are already gloss-limited to account for
//non-point-light sources; and this would apply to fresnel reflectivity. In summary, forget it.
//what the spec contribution needs to be multiplied by is the specular gloss adjustment; AND
//faded down by damage
spec_contrib_al3 = spec_light_acc3 * spec_mat3 * ao_spec_fac1 * spec_gloss_adj;
//GLOW (we got it, already, in glow_mat3; well, not quite; we want to darken it by damage
glow_mat3 *= ( 0.5 * (2.0-cloakdmg.b) );
//process accumulations
result4.rgb = amb_contrib_al3 + diff_contrib_al3 + frsn_contrib_al3 + spec_contrib_al3 + glow_mat3;
//ALPHA and CLOAK
result4.rgb *= result4.a;
result4 *= cloakdmg.rrrg;
//WRITE
gl_FragColor = result4;
}
Code: Select all
!!ARBfp1.0
OPTION NV_fragment_program2;
# cgc version 2.0.0012, build date Jan 30 2008
# command line args: -profile fp40 -oglsl
# source file: new_shader.fp
#vendor NVIDIA Corporation
#version 2.0.0.12
#profile fp40
#program main
#semantic light_enabled
#semantic max_light_enabled
#semantic cubeMap
#semantic diffMap
#semantic specMap
#semantic glowMap
#semantic normMap
#semantic damgMap
#semantic detailMap
#semantic cloakdmg
#semantic gl_FrontLightProduct : state.lightprod.front
#var int light_enabled[0] : : c[0] : -1 : 1
#var int light_enabled[1] : : c[1] : -1 : 1
#var int light_enabled[2] : : : -1 : 0
#var int light_enabled[3] : : : -1 : 0
#var int light_enabled[4] : : : -1 : 0
#var int light_enabled[5] : : : -1 : 0
#var int light_enabled[6] : : : -1 : 0
#var int light_enabled[7] : : : -1 : 0
#var int max_light_enabled : : : -1 : 0
#var samplerCUBE cubeMap : : texunit 6 : -1 : 1
#var sampler2D diffMap : : texunit 3 : -1 : 1
#var sampler2D specMap : : texunit 0 : -1 : 1
#var sampler2D glowMap : : texunit 2 : -1 : 1
#var sampler2D normMap : : texunit 1 : -1 : 1
#var sampler2D damgMap : : texunit 4 : -1 : 1
#var sampler2D detailMap : : texunit 5 : -1 : 1
#var float4 cloakdmg : : c[2] : -1 : 1
#var float4 gl_FrontLightProduct[0].ambient : state.lightprod[0].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[0].diffuse : state.lightprod[0].front.diffuse : c[3] : -1 : 1
#var float4 gl_FrontLightProduct[0].specular : state.lightprod[0].front.specular : : -1 : 0
#var float4 gl_FrontLightProduct[1].ambient : state.lightprod[1].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[1].diffuse : state.lightprod[1].front.diffuse : c[4] : -1 : 1
#var float4 gl_FrontLightProduct[1].specular : state.lightprod[1].front.specular : : -1 : 0
#var float4 gl_FrontLightProduct[2].ambient : state.lightprod[2].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[2].diffuse : state.lightprod[2].front.diffuse : : -1 : 0
#var float4 gl_FrontLightProduct[2].specular : state.lightprod[2].front.specular : : -1 : 0
#var float4 gl_FrontLightProduct[3].ambient : state.lightprod[3].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[3].diffuse : state.lightprod[3].front.diffuse : : -1 : 0
#var float4 gl_FrontLightProduct[3].specular : state.lightprod[3].front.specular : : -1 : 0
#var float4 gl_FrontLightProduct[4].ambient : state.lightprod[4].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[4].diffuse : state.lightprod[4].front.diffuse : : -1 : 0
#var float4 gl_FrontLightProduct[4].specular : state.lightprod[4].front.specular : : -1 : 0
#var float4 gl_FrontLightProduct[5].ambient : state.lightprod[5].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[5].diffuse : state.lightprod[5].front.diffuse : : -1 : 0
#var float4 gl_FrontLightProduct[5].specular : state.lightprod[5].front.specular : : -1 : 0
#var float4 gl_FrontLightProduct[6].ambient : state.lightprod[6].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[6].diffuse : state.lightprod[6].front.diffuse : : -1 : 0
#var float4 gl_FrontLightProduct[6].specular : state.lightprod[6].front.specular : : -1 : 0
#var float4 gl_FrontLightProduct[7].ambient : state.lightprod[7].front.ambient : : -1 : 0
#var float4 gl_FrontLightProduct[7].diffuse : state.lightprod[7].front.diffuse : : -1 : 0
#var float4 gl_FrontLightProduct[7].specular : state.lightprod[7].front.specular : : -1 : 0
#var float4 gl_FragColor : $vout.COLOR : COL : -1 : 1
#var float4 gl_TexCoord[0] : $vin.TEX0 : TEX0 : -1 : 1
#var float4 gl_TexCoord[1] : $vin.TEX1 : TEX1 : -1 : 1
#var float4 gl_TexCoord[2] : $vin.TEX2 : TEX2 : -1 : 1
#var float4 gl_TexCoord[3] : $vin.TEX3 : TEX3 : -1 : 1
#var float4 gl_TexCoord[4] : : : -1 : 0
#var float4 gl_TexCoord[5] : $vin.TEX5 : TEX5 : -1 : 1
#var float4 gl_TexCoord[6] : $vin.TEX6 : TEX6 : -1 : 1
#var float4 gl_TexCoord[7] : : : -1 : 0
#const c[5] = 2 0.5 1.5 0.98000002
#const c[6] = 1 0.02 0 0.333
#const c[7] = 16 0.12345 255 50
#const c[8] = 5 0 1.7 -1.7
#const c[9] = 0.25 0.33329999 0.9375 0.0625
#const c[10] = 7.6999998
PARAM c[11] = { program.local[0..2],
state.lightprod[0].front.diffuse,
state.lightprod[1].front.diffuse,
{ 2, 0.5, 1.5, 0.98000002 },
{ 1, 0.02, 0, 0.333 },
{ 16, 0.12345, 255, 50 },
{ 5, 0, 1.7, -1.7 },
{ 0.25, 0.33329999, 0.9375, 0.0625 },
{ 7.6999998 } };
TEMP R0;
TEMP R1;
TEMP R2;
TEMP R3;
TEMP R4;
TEMP R5;
TEMP R6;
TEMP R7;
TEMP R8;
TEMP R9;
TEMP RC;
TEMP HC;
OUTPUT oCol = result.color;
TEX R0, fragment.texcoord[0], texture[1], 2D;
ADDR R0.x, R0, R0.y;
DP3R R0.y, fragment.texcoord[5], fragment.texcoord[5];
RSQR R0.y, R0.y;
MULR R1.xyz, R0.y, fragment.texcoord[5];
TEX R7, fragment.texcoord[0], texture[3], 2D;
MOVR R5.xw, c[5].yyzx;
ADDR R0.x, R0.z, R0;
MADR R2.x, R0, c[9].y, -R5;
ADDR R2.y, R0.w, -c[5];
MOVR R2.z, c[9].x;
DP3R R0.x, R2, R2;
RSQR R1.w, R0.x;
MULR R2.xyz, R1.w, R2;
MULR R3.xyz, R2.y, fragment.texcoord[3];
DP3R R0.x, fragment.texcoord[1], fragment.texcoord[1];
MADR R0.x, -R0, c[5].y, c[5].z;
MULR R0.xyz, R0.x, fragment.texcoord[1];
DP3R R0.w, R0, R1;
MADR R3.xyz, R2.x, fragment.texcoord[2], R3;
MADR R2.xyz, R0, R2.z, R3;
MADR R1.w, -R0, R0, c[6].x;
MULR R1.w, R1, R1;
MULR R1.w, R1, R1;
MULR R1.w, R0, R1;
MADR R0.w, R0, c[5], -R1;
DP3R R2.w, R2, R2;
MADR R1.w, -R2, c[5].y, c[5].z;
MULR R2.xyz, R1.w, R2;
DP3R_SAT R1.x, R1, R2;
ADDR_SAT R0.w, R0, c[6].y;
ADDR_SAT R0.w, -R0, c[6].x;
MULR R0.w, R0, R0;
MULR R1.xyz, R1.x, c[3];
MULR R0.w, R0, R0;
TEX R3, fragment.texcoord[0], texture[4], 2D;
MADR_SAT R0.w, -R0, R0, c[6].x;
MOVR R6.xyz, c[6].z;
MOVXC RC.x, c[0];
MULR R1.xyz, fragment.texcoord[5].w, R1;
MULR R6.xyz(NE.x), R0.w, R1;
MOVR R5.xyz, c[6].z;
MULR R1.xyz, fragment.texcoord[5].w, c[3];
MULR R5.xyz(NE.x), R1, R0.w;
DP3R R0.w, fragment.texcoord[6], fragment.texcoord[6];
RSQR R0.w, R0.w;
MULR R1.xyz, R0.w, fragment.texcoord[6];
DP3R R0.x, R0, R1;
MADR R0.y, -R0.x, R0.x, c[6].x;
MULR R0.y, R0, R0;
MULR R0.y, R0, R0;
MULR R0.y, R0.x, R0;
MADR R0.x, R0, c[5].w, -R0.y;
DP3R_SAT R0.y, R1, R2;
ADDR_SAT R0.x, R0, c[6].y;
ADDR_SAT R0.x, -R0, c[6];
MULR R0.w, R0.x, R0.x;
MULR R0.xyz, R0.y, c[4];
MULR R0.w, R0, R0;
MULR R1.xy, fragment.texcoord[0], c[7].x;
TEX R1, R1, texture[5], 2D;
ADDR R1, R1, -c[5].y;
MULR R1, R1, c[7].y;
MADR_SAT R0.w, -R0, R0, c[6].x;
MULR R0.xyz, fragment.texcoord[6].w, R0;
MOVXC RC.x, c[1];
MADR R6.xyz(NE.x), R0.w, R0, R6;
MULR R0.xyz, fragment.texcoord[6].w, c[4];
MADR R5.xyz(NE.x), R0, R0.w, R5;
DP3R_SAT R0.x, R2, R4;
ADDR R0.x, -R0, c[6];
MULR R0.x, R0, R0;
MADR R0.x, R0, c[9].z, c[9].w;
MADR R0.y, R3.w, -c[2].z, R3.w;
MAXR_SAT R0.x, R0, c[9].w;
MULR R3.w, R0.x, R0.y;
MADR R0.xyz, R7, -c[2].z, R7;
MADR R7.xyz, R3, c[2].z, R0;
DP3R R3.x, R3, R3;
TEX R0, fragment.texcoord[0], texture[2], 2D;
RSQR R4.w, R0.w;
ADDR R2.w, -R3, c[6].x;
ADDR R7.xyz, -R1, R7;
RCPR R4.w, R4.w;
MULR R8.xyz, R7, R4.w;
MULR R8.xyz, R8, R2.w;
MULR R6.xyz, R6, R8;
MULR R6.xyz, R6, R4.w;
MULR R8.xyz, R6, R2.w;
MOVR R2.w, c[10].x;
TXL R6, R2, texture[6], CUBE;
MULR R6.xyz, R6, R6.w;
MULR R9.xyz, R0.w, R6;
MULR R7.xyz, R9, R7;
MADR R7.xyz, R6, R7, R8;
MULR R0, R0, R0;
TEX R6, fragment.texcoord[0], texture[0], 2D;
MULR R3.x, R3, c[2];
MOVR R2.w, c[2].x;
MADR R2.w, R3.x, c[6], -R2;
MADR R3.xyz, R2.w, R6, R6;
DP3R R2.w, R2, R4;
MULR R2.xyz, R2, R2.w;
ADDR R1.xyz, R3, R1;
MULR R1.xyz, R0.w, R1;
MULR R1.xyz, R5, R1;
MULR R1.xyz, R0.w, R1;
POWR R0.w, c[7].z, R6.w;
ADDR R1.w, -R1, R0;
MADR R2.xyz, -R2, c[5].x, R4;
TEX R2, -R2, texture[6], CUBE;
MULR R2.xyz, R2, R2.w;
ADDR R0.w, R1, c[7];
RCPR R2.w, R0.w;
MADR R2.xyz, R2, R3.w, R7;
MOVR R0.w, c[6].x;
MULR R1.w, R1, R2;
MADR R0.w, R1, c[8].x, R0;
RCPR R0.w, R0.w;
MULR R0.w, R0, c[8].z;
POWR R0.w, R0.w, c[8].w;
MADR R1.xyz, R1, R0.w, R2;
ADDR R0.w, R5, -c[2].z;
MULR R0.xyz, R0.w, R0;
MADR R0.xyz, R0, c[5].y, R1;
MULR R0.xyz, R0, R7.w;
MOVR R0.w, R7;
MULR oCol, R0, c[2].xxxy;
END
# 128 instructions, 10 R-regs, 0 H-regs
131,506,848 pixels/s / 60 FPS = 2191780.8 pixels per frame.
1400 x 1400 approx.
So at 1280 x 1024 we'd get like 75 fps. And thats based on G70 series gpu. And we've got it all...
Klauss, give it a good read when you got a chance; I'll start working on the glass and engines exhausts shader.