Here's my starting file:

Code: Select all

```
//NEW SHADER (high end)
//samplers
uniform samplerCube cubeMap;
uniform sampler2D diffuseMap;
uniform sampler2D specMap;
uniform sampler2D glowMap;
uniform sampler2D normalMap;
uniform sampler2D damageMap;
uniform sampler2D detailMap;
//other uniforms
uniform vec4 cloaking; //why is cloaking a vec4, anyways?
uniform vec4 damage; //why is damage a vec4, anyways?
//how about uniform vec4 uniforms4; //.r=cloak, .g=damage, .b=?, .a=?
//envColor won't be needed, since we're fetching it from the envmap
//etceteras
//main
main()
{
///VARIABLE DECLARATIONS
//vector variables
vec4 temp4; //all-purpose vec4 variable
vec3 eye_vec3;
vec3 vnormal_vec3;
vec3 normal_vec3;
vec3 tangent_vec3;
vec3 cotangent_vec3; //"binormal" ;-)
vec3 reflection_vec3;
vec3 light0_vec3;
vec3 light1_vec3;
//material color variables
vec3 diff_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
//afferent light variables
vec3 diff_contrib_al3;
vec3 spec_contrib_al3;
vec3 glow_contrib_al3;
vec3 amb_contrib_al3;
//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 alpha_mat1;
float gloss_mat1; //A.K.A. "shininess"
float limited_gloss_fac1; //smooth-limited gloss to use for spotlights
///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)
//read normalmap into temp4, then .rgb goes to U, .a goes to V
//read glow texture into temp4, then .rgb^2 goes to glow_mat, and .a goes to ao_glo_fac
//read diffuse into temp4, then rgb goes to diff_mat, a goes to alpha
//read damage texture into temp4, then .rgb goes to damg_mat3, .a goes to is_dielectric
//read detail texture into temp4; then .rgb modulates diffuse/spec, .a modulates shininess
///VECTOR COMPUTATIONS (MOSTLY, some shininess post-processing interspersed):
//mesh-derived vector computations (vnormal, tangent, cotangent)
//soft penumbra stuff
//self-shadow stuff
//normalmapping-derived vector computations (normal (using tangent))
//shininess to env map LOD
//reflection vector computation
//compute smooth shininess limit for spotlights
//compute spot brighness factor from limited shininess
//read env LOD (normal); .rgb^2 goes to ambient_il3 (assume gamma=0.5)
//read env LOD (reflect); .rgb^2 goes to specular_il3 (assume gamma=0.5)
//FRESNEL STUFF
//other gammas of ambient occlusion
ao_diff_fac1 = sqrt( ao_glow_fac1 );
ao_spec_fac1 = ao_glow_fac1 * ao_glow_fac1;
//AMBIENT CONTRIBUTION
//DIFFUSE LIGHT0
//DIFFUSE LIGHT1
//SPEC-SPOTLIGHT LIGHT 0
//SPEC-SPOTLIGHT LIGHT 1
//ENVIRONMENT MAPPING
//GLOW
//CLOAK
//WRITE
}
```

Anyways, Klauss, if you want to start throwing in some code, be my guest

First part is the hardest for me; I don't even know what the gl_TexCoord[BLAH].xyz things do, like where the numbers come from.

Needless to say, I'm not familiar with cubemap stuff; and I hope there's a textureCube

**() function...**

*LOD*And where do other interpolants come from, like attenuation?

I guess I could look it up but gotta go to bed; working early tomorrow.

EDIT:

Phewww... Yes, it exists:

Code: Select all

`vec4 textureCubeLod(samplerCube s, vec3 coord , float lod);`