Open Paril opened 7 years ago
A link to the QForcer ones you did would be helpful :)
They were shit, that's why I did the guard one instead :p this one is closer to how you're actually meant to do it - the underlying layer levels also have to be adjusted so that they are 0 to 255.
I'll try to work on this one.
Alpha is now used in tintmaps as a factor for blending between diffuse and tintmap. jdolan/quetoo@e6b17731
@kaadmy Lovely job on the Qforcer default and Guard default.tga! I have a few things that I need you to do before we can button this one up, though.
I think that's all that needs to be done to call this done 4 good
Is a helmet CVar needed? All the skins I've been doing don't use them, should they affect the head trim colors?
Can we get a status update on this? Are Guard and QForcer supported? What about Bunker, Dragoon and Gork? In the near future, I'd love to add Nitro and Brianna as well.
Also, we should update the pk3's for our models to only include the "default"
tint-enabled skin. That means the skin select in the user interface need only concern itself with model names, and the tint controls will work across the board.
Having a skin selection would be nice for some more variety, removing them and keeping only the default is probably good enough though.
@Paril
I noticed some hard seams on the edges of my bunker tintmaps. But it's also on the other skins, I think it's due to the branching in the shader. Also, the tintmaps are supposed to use premultiplied alpha, but the formula in the shader seems to be more of an alpha blending thing?
void TintFragment(inout vec4 diffuse, in vec2 texcoord)
{
if (TINTMAP) {
vec4 tint = texture(SAMPLER6, texcoord);
if (tint.a > 0) {
for (int i = 0; i < 3; i++) {
if (TINTS[i].a > 0 && tint[i] > 0) {
diffuse.rgb = mix(diffuse.rgb, TINTS[i].rgb * tint[i], tint.a);
}
}
}
}
}
Anyway, I changed it to this, and that seems to solve it:
void TintFragment(inout vec4 diffuse, in vec2 texcoord)
{
// tintmaps use premultiplied alpha textures
if (TINTMAP) {
vec4 tint = texture(SAMPLER6, texcoord);
diffuse.rgb *= 1.0 - tint.a;
diffuse.rgb += (TINTS[0].rgb * tint.r);
diffuse.rgb += (TINTS[1].rgb * tint.g);
diffuse.rgb += (TINTS[2].rgb * tint.b);
}
}
Okay if I push the fix?
Dragoon is currently the only player model included in the game data that does not include tintmaps for his default and CTF skins. Would anyone be interested in knocking those out and updating player-dragoon.pk3 to include them?
Alright, so this will take probably a full day of work from somebody who is more good at photoshop than I am. First, grab the sample here:
guard.zip
Extract this to your local data "quetoo\default\players\guard\" (not your data dir, the read-only one) and load the skin in-game, using "cg_third_person 1" to see yourself. (at the time of writing the player model menu does not support the tinting yet - we're waiting to add the HSV sliders for that)
Basically, I added a new system in the game that I'm calling a "tintmap" - this allows for player models (or, well, any model, but only client models use the tints currently) to be tinted by three separate colors that are defined and set up by the engine. The concept is similar to what games like Sim City use to randomly color buildings and stuff.
The problem is that this will require some work to convert our models to use the tintmaps. The concept is simple - you're converting this:
into these:
->
The texture, similar to normal/gloss maps, is simply plopped next to the main texture and has "_tint" appended to it. The game will automatically pick up on this. No extra work is required to get this functionality to work.
Each color channel in the tintmap represents a specific tint color; the red channel is the % of tint color 1 to use, the green channel is the % of tint color 2, and the blue channel is the % of tint color 3. The alpha channel is ignored in the color calculation, but pixels with alpha 0 are not checked for tint values. The color components must be premultiplied by the alpha! That is to say, a value of 255,0,0,0 will not work properly because of the way filtering works. All color components must be pre-multiplied by their alpha value (all empty pixels should be all zero; if you use alpha anywhere in the color masks, multiply that color component by its alpha as well).
Currently, the game uses tint color 1 for "shirt", tint color 2 for "pants" and tint color 3 for "head". I've not used tint color 3 in my sample, but it should work. Only the player model makes use of this system at the moment.
The second part to this is that you can also define what colors are used if shirt/pants/head are set to "default" via a material file. As an example, the guard above had an "upper.mat" like such:
In this case, with those textures above, if you don't explicitly specify a shirt/pants color, you will get one that looks very close to what the old default texture had.
To assign these to tints in-game, use the userinfo cvars "shirt" and "pants" - these can be HTML hexadecimal color values ("rgb" or "rrggbb" format), or "default", which pulls the color from the material file or uses white as a fallback.
I think that covers the complete usage of this feature and hopefully Pan or whomever can take charge in editing our player models to work with this system.