#Start Colors
;Because of the way the colors.tbl parser is set up, this section MUST be present, even if it is empty
#End
#Team Colors
$Team Name: Vaygr
$Team Stripe Color: ( 10 240 10 )
$Team Base Color: ( 240 10 10 )
#End
#ifdef FLAG_LIGHT
uniform int n_lights;
#endif
#ifdef FLAG_DIFFUSE_MAP
uniform sampler2D sBasemap;
#endif
#ifdef FLAG_GLOW_MAP
uniform sampler2D sGlowmap;
#endif
#ifdef FLAG_SPEC_MAP
uniform sampler2D sSpecmap;
#endif
#ifdef FLAG_ENV_MAP
uniform samplerCube sEnvmap;
uniform bool alpha_spec;
varying vec3 envReflect;
#endif
#ifdef FLAG_NORMAL_MAP
uniform sampler2D sNormalmap;
varying mat3 tbnMatrix;
#endif
#ifdef FLAG_TEAMCOLOR
uniform vec3 base_color;
uniform vec3 stripe_color;
#endif
#ifdef FLAG_FOG
varying float fogDist;
#endif
#ifdef FLAG_ANIMATED
uniform sampler2D sFramebuffer;
uniform int effect_num;
uniform float anim_timer;
uniform float vpwidth;
uniform float vpheight;
#endif
varying vec4 position;
varying vec3 lNormal;
#if SHADER_MODEL == 2
#define MAX_LIGHTS 2
#else
#define MAX_LIGHTS 8
#endif
#define SPEC_INTENSITY_POINT 5.3 // Point light
#define SPEC_INTENSITY_DIRECTIONAL 3.0 // Directional light
#define SPECULAR_FACTOR 1.75
#define SPECULAR_ALPHA 0.1
#define SPEC_FACTOR_NO_SPEC_MAP 0.6
#define ENV_ALPHA_FACTOR 0.3
#define GLOW_MAP_INTENSITY 1.5
#define AMBIENT_LIGHT_BOOST 1.0
void main()
{
vec3 eyeDir = vec3(normalize(-position).xyz); // Camera is at (0,0,0) in ModelView space
vec4 lightAmbientDiffuse = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightDiffuse = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightAmbient = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightSpecular = vec4(0.0, 0.0, 0.0, 1.0);
vec2 texCoord = gl_TexCoord[0].xy;
#ifdef FLAG_SPEC_MAP
vec4 specColour = texture2D(sSpecmap, texCoord);
#endif
#ifdef FLAG_LIGHT
#ifdef FLAG_NORMAL_MAP
// Normal map - convert from DXT5nm
vec3 normal;
vec4 NormalMap = texture2D(sNormalmap, texCoord);
#ifdef FLAG_TEAMCOLOR
vec2 teamMask = NormalMap.rb;
#endif
normal.rg = (NormalMap.ag * 2.0) - 1.0;
#ifdef FLAG_ENV_MAP
vec3 envOffset = vec3(0.0);
envOffset.xy = normal.xy;
vec3 envReflectNM = envReflect + envOffset;
vec4 envColour = textureCube(sEnvmap, envReflectNM);
#endif
normal.b = sqrt(1.0 - dot(normal.rg, normal.rg));
normal = tbnMatrix * normal;
float norm = length(normal);
// prevent breaking of normal maps
if (length(normal) > 0.0)
normal /= norm;
else
normal = tbnMatrix * vec3(0.0, 0.0, 1.0);
#else
vec3 normal = lNormal;
#ifdef FLAG_ENV_MAP
vec4 envColour = textureCube(sEnvmap, envReflect);
#endif
#endif
vec3 lightDir;
lightAmbient = gl_FrontMaterial.emission + (gl_LightModel.ambient * gl_FrontMaterial.ambient);
float dist;
#pragma optionNV unroll all
for (int i = 0; i < MAX_LIGHTS; ++i) {
#if SHADER_MODEL > 2
if (i > n_lights)
break;
#endif
float specularIntensity = 1.0;
float attenuation = 1.0;
// Attenuation and light direction
#if SHADER_MODEL > 2
if (gl_LightSource[i].position.w == 1.0) {
#else
if (gl_LightSource[i].position.w == 1.0 && i != 0) {
#endif
// Positional light source
dist = distance(gl_LightSource[i].position.xyz, position.xyz);
lightDir = (gl_LightSource[i].position.xyz - position.xyz);
#if SHADER_MODEL > 2
if (gl_LightSource[i].spotCutoff < 91.0) { // Tube light
float beamlength = length(gl_LightSource[i].spotDirection);
vec3 beamDir = normalize(gl_LightSource[i].spotDirection);
// Get nearest point on line
float neardist = dot(position.xyz - gl_LightSource[i].position.xyz , beamDir);
// Move back from the endpoint of the beam along the beam by the distance we calculated
vec3 nearest = gl_LightSource[i].position.xyz - beamDir * abs(neardist);
lightDir = nearest - position.xyz;
dist = length(lightDir);
}
#endif
lightDir = normalize(lightDir);
attenuation = 1.0 / (gl_LightSource[i].constantAttenuation + (gl_LightSource[i].linearAttenuation * dist) + (gl_LightSource[i].quadraticAttenuation * dist * dist));
specularIntensity = SPEC_INTENSITY_POINT;
} else {
// Directional light source
lightDir = normalize(gl_LightSource[i].position.xyz);
specularIntensity = SPEC_INTENSITY_DIRECTIONAL;
}
vec3 half_vec = normalize(lightDir + eyeDir);
// Ambient and Diffuse
lightAmbient += (gl_FrontLightProduct[i].ambient * attenuation);
lightDiffuse += (gl_FrontLightProduct[i].diffuse * (max(dot(normal, lightDir), 0.0)) * attenuation);
// Specular
float NdotHV = clamp(dot(normal, half_vec), 0.0, 1.0);
lightSpecular += ((gl_FrontLightProduct[i].specular * pow(NdotHV, gl_FrontMaterial.shininess)) * attenuation) * specularIntensity;
}
lightAmbientDiffuse = lightAmbient + lightDiffuse;
#else
lightAmbientDiffuse = gl_Color;
lightSpecular = gl_SecondaryColor;
#endif
#ifdef FLAG_ANIMATED
vec2 distort = vec2(cos(position.x*position.w*0.005+anim_timer*20.0)*sin(position.y*position.w*0.005),sin(position.x*position.w*0.005+anim_timer*20.0)*cos(position.y*position.w*0.005))*0.03;
#endif
// Base color
#ifdef FLAG_DIFFUSE_MAP
#ifdef FLAG_ANIMATED
vec4 baseColor;
if (effect_num == 2) {
baseColor = texture2D(sBasemap, texCoord + distort*(1.0-anim_timer));
} else {
baseColor = texture2D(sBasemap, texCoord);
}
#else
vec4 baseColor = texture2D(sBasemap, texCoord);
#endif
#else
vec4 baseColor = gl_Color;
#endif
#ifdef FLAG_TEAMCOLOR
vec3 base = base_color - vec3(0.5);
vec3 stripe = stripe_color - vec3(0.5);
baseColor.rgb += (base * teamMask.x) + (stripe * teamMask.y);
#endif
vec4 fragmentColor;
fragmentColor.rgb = baseColor.rgb * max(lightAmbientDiffuse.rgb * AMBIENT_LIGHT_BOOST, gl_LightModel.ambient.rgb - 0.425);
fragmentColor.a = baseColor.a;
// Spec color
#ifdef FLAG_SPEC_MAP
#ifdef FLAG_TEAMCOLOR
specColour.rgb += ((base * teamMask.x) + (stripe * teamMask.y)) * 0.3;
#endif
fragmentColor.rgb += lightSpecular.rgb * (specColour.rgb * SPECULAR_FACTOR);
fragmentColor.a += (dot(lightSpecular.a, lightSpecular.a) * SPECULAR_ALPHA);
#else
fragmentColor.rgb += lightSpecular.rgb * (baseColor.rgb * SPEC_FACTOR_NO_SPEC_MAP);
#endif
// Env color
#ifdef FLAG_ENV_MAP
vec3 envIntensity = (alpha_spec) ? vec3(specColour.a) : specColour.rgb;
fragmentColor.a += (dot(envColour.rgb, envColour.rgb) * ENV_ALPHA_FACTOR);
fragmentColor.rgb += envColour.rgb * envIntensity;
#endif
// Glow color
#ifdef FLAG_GLOW_MAP
fragmentColor.rgb += texture2D(sGlowmap, texCoord).rgb * GLOW_MAP_INTENSITY;
#endif
#ifdef FLAG_FOG
fragmentColor.rgb = mix(fragmentColor.rgb, gl_Fog.color.rgb, fogDist);
#endif
//Commented out. If HDR makes a comeback, we may need this.
//fragmentColor.a = clamp(fragmentColor.a ,0.0,1.0);
#ifdef FLAG_ANIMATED
if (effect_num == 0) {
float shinefactor = 1.0/(1.0 + pow((fract(abs(gl_TexCoord[0].x))-anim_timer) * 1000.0, 2.0)) * 1000.0;
gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor);
gl_FragColor.a = fragmentColor.a * clamp(shinefactor * (fract(abs(gl_TexCoord[0].x))-anim_timer) * -10000.0,0.0,1.0);
}
if (effect_num == 1) {
float shinefactor = 1.0/(1.0 + pow((position.y-anim_timer), 2.0));
gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor);
#ifdef FLAG_LIGHT
gl_FragColor.a = fragmentColor.a;
#else
// ATI Wireframe fix *grumble*
gl_FragColor.a = clamp((position.y-anim_timer) * 10000.0,0.0,1.0);
#endif
}
if (effect_num == 2) {
vec2 screenPos = gl_FragCoord.xy * vec2(vpwidth,vpheight);
gl_FragColor.a = fragmentColor.a;
float cloak_interp = (sin(position.x*position.w*0.005+anim_timer*20.0)*sin(position.y*position.w*0.005)*0.5)-0.5;
#ifdef FLAG_LIGHT
gl_FragColor.rgb = mix(texture2D(sFramebuffer, screenPos + distort*anim_timer + anim_timer*0.1*normal.xy).rgb,fragmentColor.rgb,clamp(cloak_interp+anim_timer*2.0,0.0,1.0));
#else
gl_FragColor.rgb = mix(texture2D(sFramebuffer, screenPos + distort*anim_timer + anim_timer*0.1*lNormal.xy).rgb,fragmentColor.rgb,clamp(cloak_interp+anim_timer*2.0,0.0,1.0));
#endif
}
#else
gl_FragColor = fragmentColor;
#endif
}
First, you need to make a few adaptations to the textures used by the model you wish to recolor. This feature uses the heretofore unused red and blue channels on the normal map. Areas you wish to carry the base colour should receive a full value in the red channel, while areas that should get the stripe colour should receive a full value in the blue channel.
Wow, this is incredible. I wonder if Esarai's ships could be adapted to use this...from what i've seen in the shaders, it does not yet do anything. one of the ideas was to add a 4th value to the table, and then determine how strongly will the color be applied on the specular side.
BTW, how to distinguish stripes from base on the texture itself? And how does this work with shinemaps?
from what i've seen in the shaders, it does not yet do anything. one of the ideas was to add a 4th value to the table, and then determine how strongly will the color be applied on the specular side.
c0=0'40'0
c1=0'20'0
c2=0'33'0
c3=0'26'0
so long as there exists max (31) red and min (0) blue or min blue and max red, no change to magnitude calculations should occur. becakse 0+31 == 31+0 and when you add green to the equation the darkest color has the lowest green value and the brightest color contains the brightest green, so no accuracy is lost. of course when the texture artists get ahold of this what will happen is they will do something stupid like try to soften their edges of these areas. so you now have green and blue channels which may be anything between 0 and 31. and this is where you run into troble. say a block has a softened edge running paralel to the sides of the block so that the range of red is 0-18 and the range of blue is 0-31, you might have a bright pixel of 18'20'31 and a dark pixel of 0'30'0. the pixel with the highest green value is actually the dim pixel. the color table would look like this:c0=18'20'31
c1=0'30'0
c2=12'23'20
c3=6'26'10
in that case a pixel may exist in the source color block of value 0'63'0, however c2 (though it may be c1, im not sure how the closest color is chosen, but even then the point is still valid) is the closest value and so that index will be assigned to that pixel and when uncompressed at the video card will be read as 12'23'20, which has a much lower green value than it should, and thus its normal will be greatly innacurate. id question whether or not the unused red or blue channels are really unused. i think using them would reduce the quality of the normal map. the color portion of a dxt* block(technically its the same for 1, 3, 5, and 5_nm and slightly different in 1a).
[...]
tldr: you might get more normal map artifacts if you use pixel values other than 0'x'31 or 31'x'0 (where x can be any value).
what about using a channel in the height map? as far as i know the height map uses all 3 channels as grey, what if we just keep it in green and then use red or blue for the mask channel. we also get another channel for future use, or we can allocate it so we can do 2 tone team colors.heightmaps have been disabled in the engine for the time being, afaik. my original idea for the implementation was to go that way and not to mess with normal maps.
what about an alpha channel in the glowmap?WHY THE **** DOES IT MATTER RIGHT NOW?!? Stop being whiny little pricks and use u8888 if you dont want compression artifacts, end of story god ****ing dammit!
what about an alpha channel in the glowmap?WHY THE **** DOES IT MATTER RIGHT NOW?!? Stop being whiny little pricks and use u8888 if you dont want compression artifacts, end of story god ****ing dammit!
[edit] for the records sake, TAP is using the glowmap alpha as a gloss map channel
Yes, we -do- have two unused channels in the normal map and at some point it might be nice to correct that, though if a 3dc/bc5 is the same size as a DXT5, might as well stick to DXT5_NM. Yes, we do have an alpha channel on the diffuse and the glow maps (and they actually DO affect the maps when not otherwise told to do so). Yes, they -could- be re-purposed into providing extended functionality, but it hampers adoption by others that may be interested in doing so by -requiring- all previous maps to be either redone, or potentially introduce quality loss by editing and re-saving them to do so. Or introduces garbage if/when somebody introduces an asset to an adoption system that isn't made to utilize that feature, which is why Anisotropic Reflection isn't using the 2 "unused" channels in a normal map either and I'd hate to see what would happen if somebody inadvertently tried to do both AR and Team Colors at the same time.
If we were to introduce a new map type, I would suggest to call it a "misc" map, to indicate that it's just a way for a mod to store 4 more float values per texture rather than implicating that there's a fixed use for that texture (unlike, say, glow or normal maps).
The bmpman limit is there, but the average mod likely won't (or shouldn't) every hit it. But this new '-Misc' map is also optional and not necessary for every single ship. Shouldn't be an issue, unless you are going nuts with misc maps.
Nuke, you say animated glow maps are a waste of slots, but isn't an animated glow map how the lights on the "runway" of the Orion work? Also aren't there several other ships that look far better for having animated lights on them?
i think the best way to use team colors is sparingly, enough to mark the ship as being on a specific team, and it should be visible from any angle, but i wouldnt paint the whole ship with it like in the example.Many ships are using something other than metal gray as their main hull color, and I'm converting this color to main one, and the "secondary" color (if present) to stripes.
Technically, the feature can exists with BOTH options available to it simultaneously (with a little modification).As far as TAP assets go, dont worry about our stuff. I can always change the textures in a matter of 2 hours of work tops.
Simply allow the specification (to either the colors.tbl or mod.tbl or whatever) to define the "Team Color Read From:" to allow either "-normal" or "-misc" maps.
Course, if you go about mixing the two, then that could be a problem unless we really want the flexibility to define on a per declaration as well as a universal.
I only bring this up because I think it possible that the intended requesting mod for this feature may have already gone and created all their content based on how it is already implemented, namely in the normal map unused channels. And it would be utterly unfair to force them into the same amount of work that we ourselves don't want to do, which is to port all that work to yet another map.
I just can not agree to sticking it into the normal map channels and calling it a day and marking the feature as complete.
I'm interested, I just don't have the ability to modify shaders... :(grab either me or the e on irc for a quick walkthrough to modify the shaders for -misc texture useage.
Nor do I want to bother with as many shader changes that are going on recently.
#Start Colors
;Because of the way the colors.tbl parser is set up, this section MUST be present, even if it is empty
#End
#Team Colors
$Team Name: Vaygr
$Team Stripe Color: ( 10 240 10 )
$Team Base Color: ( 240 10 10 )
#End
$Default Team: None
If you want to enable a particular team:$Default Team: <Team name as defined in colors.tbl>
...
$POF file: VGR_Destroyer.pof
$Detail distance: (0)
$Default Team: Vaygr
$Show damage: YES
$Density: 1
$Damp: 0.4
...
#ifdef FLAG_LIGHT
uniform int n_lights;
#endif
#ifdef FLAG_DIFFUSE_MAP
uniform sampler2D sBasemap;
#endif
#ifdef FLAG_GLOW_MAP
uniform sampler2D sGlowmap;
#endif
#ifdef FLAG_SPEC_MAP
uniform sampler2D sSpecmap;
#endif
#ifdef FLAG_ENV_MAP
uniform samplerCube sEnvmap;
uniform bool alpha_spec;
varying vec3 envReflect;
#endif
#ifdef FLAG_NORMAL_MAP
uniform sampler2D sNormalmap;
varying mat3 tbnMatrix;
#endif
#ifdef FLAG_FOG
varying float fogDist;
#endif
#ifdef FLAG_ANIMATED
uniform sampler2D sFramebuffer;
uniform int effect_num;
uniform float anim_timer;
uniform float vpwidth;
uniform float vpheight;
#endif
#ifdef FLAG_TEAMCOLOR
uniform vec3 base_color;
uniform vec3 stripe_color;
vec2 teamMask = vec2(0.0, 0.0);
#endif
#ifdef FLAG_MISC_MAP
uniform sampler2D sMiscmap;
#endif
varying vec4 position;
varying vec3 lNormal;
#if SHADER_MODEL == 2
#define MAX_LIGHTS 2
#else
#define MAX_LIGHTS 8
#endif
#define SPEC_INTENSITY_POINT 5.3 // Point light
#define SPEC_INTENSITY_DIRECTIONAL 3.0 // Directional light
#define SPECULAR_FACTOR 1.75
#define SPECULAR_ALPHA 0.1
#define SPEC_FACTOR_NO_SPEC_MAP 0.6
#define ENV_ALPHA_FACTOR 0.3
#define GLOW_MAP_INTENSITY 1.5
#define AMBIENT_LIGHT_BOOST 1.0
void main()
{
vec3 eyeDir = vec3(normalize(-position).xyz); // Camera is at (0,0,0) in ModelView space
vec4 lightAmbientDiffuse = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightDiffuse = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightAmbient = vec4(0.0, 0.0, 0.0, 1.0);
vec4 lightSpecular = vec4(0.0, 0.0, 0.0, 1.0);
vec2 texCoord = gl_TexCoord[0].xy;
#ifdef FLAG_SPEC_MAP
vec4 specColour = texture2D(sSpecmap, texCoord);
#endif
#ifdef FLAG_MISC_MAP
#ifdef FLAG_TEAMCOLOR
vec2 teamMask = vec2(0.0, 0.0);
teamMask = texture2D(sMiscmap, texCoord).rg;
#endif
#endif
#ifdef FLAG_LIGHT
#ifdef FLAG_NORMAL_MAP
// Normal map - convert from DXT5nm
vec3 normal;
normal.rg = (texture2D(sNormalmap, texCoord).ag * 2.0) - 1.0;
#ifdef FLAG_ENV_MAP
vec3 envOffset = vec3(0.0);
envOffset.xy = normal.xy;
vec3 envReflectNM = envReflect + envOffset;
vec4 envColour = textureCube(sEnvmap, envReflectNM);
#endif
normal.b = sqrt(1.0 - dot(normal.rg, normal.rg));
normal = tbnMatrix * normal;
float norm = length(normal);
// prevent breaking of normal maps
if (length(normal) > 0.0)
normal /= norm ;
else
normal = tbnMatrix * vec3(0.0, 0.0, 1.0);
#else
vec3 normal = lNormal;
#ifdef FLAG_ENV_MAP
vec4 envColour = textureCube(sEnvmap, envReflect);
#endif
#endif
vec3 lightDir;
lightAmbient = gl_FrontMaterial.emission + (gl_LightModel.ambient * gl_FrontMaterial.ambient);
float dist;
#pragma optionNV unroll all
for (int i = 0; i < MAX_LIGHTS; ++i) {
#if SHADER_MODEL > 2
if (i > n_lights)
break;
#endif
float specularIntensity = 1.0;
float attenuation = 1.0;
// Attenuation and light direction
#if SHADER_MODEL > 2
if (gl_LightSource[i].position.w == 1.0) {
#else
if (gl_LightSource[i].position.w == 1.0 && i != 0) {
#endif
// Positional light source
dist = distance(gl_LightSource[i].position.xyz, position.xyz);
lightDir = (gl_LightSource[i].position.xyz - position.xyz);
#if SHADER_MODEL > 2
if (gl_LightSource[i].spotCutoff < 91.0) { // Tube light
float beamlength = length(gl_LightSource[i].spotDirection);
vec3 beamDir = normalize(gl_LightSource[i].spotDirection);
// Get nearest point on line
float neardist = dot(position.xyz - gl_LightSource[i].position.xyz , beamDir);
// Move back from the endpoint of the beam along the beam by the distance we calculated
vec3 nearest = gl_LightSource[i].position.xyz - beamDir * abs(neardist);
lightDir = nearest - position.xyz;
dist = length(lightDir);
}
#endif
lightDir = normalize(lightDir);
attenuation = 1.0 / (gl_LightSource[i].constantAttenuation + (gl_LightSource[i].linearAttenuation * dist) + (gl_LightSource[i].quadraticAttenuation * dist * dist));
specularIntensity = SPEC_INTENSITY_POINT;
} else {
// Directional light source
lightDir = normalize(gl_LightSource[i].position.xyz);
specularIntensity = SPEC_INTENSITY_DIRECTIONAL;
}
vec3 half_vec = normalize(lightDir + eyeDir);
// Ambient and Diffuse
lightAmbient += (gl_FrontLightProduct[i].ambient * attenuation);
lightDiffuse += (gl_FrontLightProduct[i].diffuse * (max(dot(normal, lightDir), 0.0)) * attenuation);
// Specular
float NdotHV = clamp(dot(normal, half_vec), 0.0, 1.0);
lightSpecular += ((gl_FrontLightProduct[i].specular * pow(NdotHV, gl_FrontMaterial.shininess)) * attenuation) * specularIntensity;
}
lightAmbientDiffuse = lightAmbient + lightDiffuse;
#else
lightAmbientDiffuse = gl_Color;
lightSpecular = gl_SecondaryColor;
#endif
#ifdef FLAG_ANIMATED
vec2 distort = vec2(cos(position.x*position.w*0.005+anim_timer*20.0)*sin(position.y*position.w*0.005),sin(position.x*position.w*0.005+anim_timer*20.0)*cos(position.y*position.w*0.005))*0.03;
#endif
// Base color
#ifdef FLAG_DIFFUSE_MAP
#ifdef FLAG_ANIMATED
vec4 baseColor;
if (effect_num == 2) {
baseColor = texture2D(sBasemap, texCoord + distort*(1.0-anim_timer));
} else {
baseColor = texture2D(sBasemap, texCoord);
}
#else
vec4 baseColor = texture2D(sBasemap, texCoord);
#endif
#else
vec4 baseColor = gl_Color;
#endif
#ifdef FLAG_TEAMCOLOR
vec3 base = base_color - vec3(0.5);
vec3 stripe = stripe_color - vec3(0.5);
baseColor.rgb += (base * teamMask.x) + (stripe * teamMask.y);
#endif
vec4 fragmentColor;
fragmentColor.rgb = baseColor.rgb * max(lightAmbientDiffuse.rgb * AMBIENT_LIGHT_BOOST, gl_LightModel.ambient.rgb - 0.425);
fragmentColor.a = baseColor.a;
// Spec color
#ifdef FLAG_SPEC_MAP
fragmentColor.rgb += lightSpecular.rgb * (specColour.rgb * SPECULAR_FACTOR);
fragmentColor.a += (dot(lightSpecular.a, lightSpecular.a) * SPECULAR_ALPHA);
#else
fragmentColor.rgb += lightSpecular.rgb * (baseColor.rgb * SPEC_FACTOR_NO_SPEC_MAP);
#endif
// Env color
#ifdef FLAG_ENV_MAP
vec3 envIntensity = (alpha_spec) ? vec3(specColour.a) : specColour.rgb;
fragmentColor.a += (dot(envColour.rgb, envColour.rgb) * ENV_ALPHA_FACTOR);
fragmentColor.rgb += envColour.rgb * envIntensity;
#endif
// Glow color
#ifdef FLAG_GLOW_MAP
fragmentColor.rgb += texture2D(sGlowmap, texCoord).rgb * GLOW_MAP_INTENSITY;
#endif
#ifdef FLAG_FOG
fragmentColor.rgb = mix(fragmentColor.rgb, gl_Fog.color.rgb, fogDist);
#endif
#ifdef FLAG_ANIMATED
if (effect_num == 0) {
float shinefactor = 1.0/(1.0 + pow((fract(abs(gl_TexCoord[0].x))-anim_timer) * 1000.0, 2.0)) * 1000.0;
gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor);
gl_FragColor.a = fragmentColor.a * clamp(shinefactor * (fract(abs(gl_TexCoord[0].x))-anim_timer) * -10000.0,0.0,1.0);
}
if (effect_num == 1) {
float shinefactor = 1.0/(1.0 + pow((position.y-anim_timer), 2.0));
gl_FragColor.rgb = fragmentColor.rgb + vec3(shinefactor);
#ifdef FLAG_LIGHT
gl_FragColor.a = fragmentColor.a;
#else
// ATI Wireframe fix *grumble*
gl_FragColor.a = clamp((position.y-anim_timer) * 10000.0,0.0,1.0);
#endif
}
if (effect_num == 2) {
vec2 screenPos = gl_FragCoord.xy * vec2(vpwidth,vpheight);
gl_FragColor.a = fragmentColor.a;
float cloak_interp = (sin(position.x*position.w*0.005+anim_timer*20.0)*sin(position.y*position.w*0.005)*0.5)-0.5;
#ifdef FLAG_LIGHT
gl_FragColor.rgb = mix(texture2D(sFramebuffer, screenPos + distort*anim_timer + anim_timer*0.1*normal.xy).rgb,fragmentColor.rgb,clamp(cloak_interp+anim_timer*2.0,0.0,1.0));
#else
gl_FragColor.rgb = mix(texture2D(sFramebuffer, screenPos + distort*anim_timer + anim_timer*0.1*lNormal.xy).rgb,fragmentColor.rgb,clamp(cloak_interp+anim_timer*2.0,0.0,1.0));
#endif
}
#else
gl_FragColor = fragmentColor;
#endif
}
Updated wiki to match the format of the rest of the tables. :PThanks :)
Given how messy the lab code already is and how few people actually use team colors...Coming from one of the people who do. :D
But I've found myself wishing I could rotate through the various Team Colors I've got setup in the Lab. The only way to view colors on any given ship is to set the default in ships.tbl, load FSO, view it, exit FSO, alter the default in ships.tbl... repeat. A scroll through would be mighty helpful. But it'd also only be helpful for the few times a modder actually needs that functionality, so the code time may not equal the benefit time.
The problem, at least as far as I can work it out, is that there's no "selection" type control in the lab UI code. So I think what I'm probably going to do will be a few boxes where you can enter RGB values directly.Even better. Would that a be possible to make a button to dump those settings to a text file? That'd greatly speed up fine-tuning the colors.
But I've found myself wishing I could rotate through the various Team Colors I've got setup in the Lab. The only way to view colors on any given ship is to set the default in ships.tbl, load FSO, view it, exit FSO, alter the default in ships.tbl... repeat. A scroll through would be mighty helpful. But it'd also only be helpful for the few times a modder actually needs that functionality, so the code time may not equal the benefit time.
The problem, at least as far as I can work it out, is that there's no "selection" type control in the lab UI code. So I think what I'm probably going to do will be a few boxes where you can enter RGB values directly.
You could use key input to rotate through the team colors similar to what it does for throttle settings or insignia switching without adding new interface parts - but a new box to input RGB values sounds lot more useful :)Wait. You can control insignia and throttle in the lab? Since when, how and where is it documented? Is there any complete list of what you can do in the lab?
We're also going to need sexp control of team colors so that we can have color-cycling psychedelic disco ships. Thank you.
I looked at what code is in there that could be used as an example. I don't know of any lab documentation so I guess it doesn't exist??You could use key input to rotate through the team colors similar to what it does for throttle settings or insignia switching without adding new interface parts - but a new box to input RGB values sounds lot more useful :)Wait. You can control insignia and throttle in the lab? Since when, how and where is it documented? Is there any complete list of what you can do in the lab?