User panel stuff on forum
  36 posts on 2 pages  First page12Last page
Client Talk
2009-04-15, 07:45
Member
1433 posts

Registered:
Jan 2006
IWANTIT :>
2009-04-16, 22:45
Member
60 posts

Registered:
Apr 2006
Yeah it's looking pretty clean This i what the bsp bump pixel shader looks like (scroll to the end for the main code):

const int REPLACE = 0;
const int MODULATE = 1;
const int DECAL = 2;
const int BLEND = 3;
const int ADD = 4;
const int SUBTRACT = 5;
const int COMBINE = 5;

void applyTexture2D(in sampler2D texUnit, in int type, in int index, inout vec4 color)
{
// Read from the texture
vec4 texture = texture2D(texUnit, gl_TexCoord[index].st);

if (type == REPLACE)
{
color = texture;
}
else if (type == MODULATE)
{
color *= texture;
}
else if (type == DECAL)
{
vec3 temp = mix(color.rgb, texture.rgb, texture.a);

color = vec4(temp, color.a);
}
else if (type == BLEND)
{
vec3 temp = mix(color.rgb, gl_TextureEnvColor[index].rgb, texture.rgb);

color = vec4(temp, color.a * texture.a);
}
else if (type == ADD)
{
color.rgb += texture.rgb;
color.a *= texture.a;

color = clamp(color, 0.0, 1.0);
}
else if (type == SUBTRACT)
{
color.rgb -= texture.rgb;
color.a *= texture.a;

color = clamp(color, 0.0, 1.0);
}
else
{
color = clamp(texture * color, 0.0, 1.0);
}
}

void applyBumpMap2D(in vec3 bump, in vec3 deluxe, inout vec4 color)
{
/*
decode the normal and light direction (it's encoded in an rgb value) and
re-normalize the light and reflection normals. Remember that during
interpolation by the GL these values can become non unit length
*/
vec3 decbump = bump * 2.0 - 1.0;
vec3 decdeluxe = deluxe * 2.0 - 1.0;

/*
sample the color map to get our diffuse color
*/
color.rgb *= max(dot(normalize(decbump), normalize(decdeluxe) ), 0.0);
color.rgb = min(color.rgb, vec3(1.0));
}

void applyGlossMap2D(in vec3 gloss, in vec3 bump, in vec4 localView, inout vec4 color)
{
// decode the normal (it's encoded in an rgb value)
vec3 decbump = bump * 2.0 - 1.0;

// get the specular amount
float spec = dot(localView.xyz, normalize(decbump));
vec3 colorSpec = pow(spec, 8.0)*gloss;
color.rgb = mix(color.rgb, gl_TextureEnvColor[0].rgb,colorSpec);
}

uniform sampler2D base_map;
uniform sampler2D light_map;
uniform sampler2D luma_map;
uniform sampler2D deluxe_map;
uniform sampler2D bump_map;
uniform sampler2D gloss_map;

uniform int renderluma, renderbump, renderspec;

varying vec4 viewTangetSpace;
varying mat3 tbn;

void main()
{
vec4 pixel = gl_Color;
applyTexture2D(base_map, REPLACE, 0, pixel);
applyTexture2D(light_map, BLEND, 1, pixel);

if (renderluma) applyTexture2D(luma_map, ADD, 0, pixel);

vec4 bump, deluxe, gloss;

if (renderbump) {
// sample the normal for the bumpiness at this pixel.
applyTexture2D(bump_map, REPLACE, 0, bump);
// sample the deluxe for the light direction at this pixel.
applyTexture2D(deluxe_map, REPLACE, 1, deluxe);
// apply the bump map
applyBumpMap2D(bump.rgb, deluxe.rgb, pixel);
}

if (renderspec) {
// sample the gloss for the glossiness at this pixel.
applyTexture2D(gloss_map, REPLACE, 0, gloss);
// apply the gloss map
applyGlossMap2D(gloss.rgb, bump.rgb, normalize(viewTangetSpace), pixel);
}

/*
compute our final fragment color as a combination of
diffuse map, light map, bump map and the specular highlight
*/
gl_FragColor = vec4(pixel.rgb, 1.0);
}
2011-07-24, 21:41
Member
622 posts

Registered:
Jan 2006
Is there anything out there that can make the textures look like in warsow?!
2011-07-25, 07:55
Member
344 posts

Registered:
Feb 2006
phrenic wrote:
Is there anything out there that can make the textures look like in warsow?!

Screenshot of what you mean?
2011-07-25, 13:09
Member
792 posts

Registered:
Feb 2006
http://www.google.de/search?q=warsow&hl=en&biw=1216&bih=806&prmd=ivnsm&source=lnms&tbm=isch&ei=AGstTsbUAYiM-wb85PDsDQ&sa=X&oi=mode_link&ct=mode&cd=2&sqi=2&ved=0CAsQ_AUoAQ
2011-08-11, 09:11
Member
1 post

Registered:
Jan 1970
hello friends
thanks for sharing the post
  36 posts on 2 pages  First page12Last page