Pages: [1]
  Print  
Author Topic: Dynamic player palette swapping  (Read 8367 times)
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« on: April 04, 2017, 12:51:23 AM »

another brainfart


RENDERER: Find special _colors.tga texture loading with a player texture (i.e. loading models/players/sorceress/skin.tga also checks models/players/sorceress/skin_colors.tga)

if found, mark the loaded shader as special colorable shader, internally rename the shadername after the relevant clientnumber that is using it, and load _colors.tga into SYSTEM MEMORY (don't upload the texture until we're done blending on)

Check connected client for color parameters set through some cl_ cvar, like cl_playerColors "24 75 33 22"

Numbers represent pre-defined gradient ramps from external files (similar to palette ramps in quake), maybe gradient maps could be gimp format or some other plain text?

_colors.tga has 4 channels, one channel each dedicated to a certain chosen gradient ramp. All channels (including alpha values) blend additively on each other with their ramps. Alpha channel isn't really an alpha here, it's a 4th color.

Then this result is additvely blended (or overlaid with 0 value being alpha?) on the base texture. Alpha unaffected (if any)

Like the scratchpad textures, a client player slot would allocate one of these textures (and only ONE!!!!!!!!!!!!!!!!!!! ONE)


ADVANTAGES:
- colored skins with nice colors similar to fighting game palette swaps
- lighting works
- vertex lighting works, as this approach would function with single stage texturing
- art can still be art and still have base color underneath
- really really cool sense of individuality

DISADVANTAGES:
- maybe slightly cpu choking at deferred loading (MMX optimizing is theoretically feasible for that however)
- someone could flood it to cause some slowdown (i.e. some clever person wanting a rapid color cycling script, this was a big problem in the glquake days)
- more texture memory use if everyone's the same character on different colors
- JPEG format would ruin the color ramps and DDS would be hard to process with too
« Last Edit: April 04, 2017, 01:23:22 AM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Gig
In the year 3000
***

Cakes 45
Posts: 4394


WWW
« Reply #1 on: April 04, 2017, 03:28:20 PM »

Interesting idea, although maybe a little complex.
The idea of changing the color of some details of your clothing more or less the way you set your railgun effect colors may be nice...

What about team skins? Would this system be disabled during team modes, to prevent possible confusion due to too many "red" details in a "blue" character?
Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« Reply #2 on: April 04, 2017, 06:42:36 PM »

Having this involved with team skins would be a waste.
Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
cheb
Lesser Nub


Cakes 3
Posts: 127



WWW
« Reply #3 on: April 06, 2017, 06:59:27 PM »

A great idea (I'm sure I suggested this some years ago but no one understood me) Sad

Quote
more texture memory use if everyone's the same character on different colors
Think in terms of worst case scenario: your best FPS doesn't matter, it's your worst that defines the perception.
In this case, worst case is when every player uses a unique skin.
There is no difference between that and different palettes.

P.S. Just quoting that book about making Quake, AFAIR it was like "no one will care if your best FPS is 60 if your worst FPS is 15, it's better to use a solution that gives constant 30 fps" or something like that.

P.P.S. No one uses palettes nowadays  Angry When I'd finally tear out of the bog of routine stuff, the first thing I will implement in my engine would be palettes. Built right into the basic GLSL fragment program  mad

Quote
Having this involved with team skins would be a waste.
On the other hand, IF your basic skins are B&W (dark trousers light shirt / light trousers dark shirt / checkered / striped / swirly AND you slap palette swapping on top of that, you get tons of unique variants, with most players looking unique.

It's like 2 dimensions multiplying, if you have like 5 patterns x 5 palettes you already get 25 unique variants.
And making patterns could be relatively quick and dirty.

Would even work with team skins IF you allow to vary palette colors inside a certain gamut (yellow/orange/red for the red team, cyan/blue/purple for the blue team)
« Last Edit: April 06, 2017, 07:06:13 PM by cheb » Logged

Imma lazy dreamer. I achieved nothing.
Neon_Knight
In the year 3000
***

Cakes 49
Posts: 3775


Trickster God.


« Reply #4 on: April 07, 2017, 06:20:50 AM »

In that last case of yours, perhaps for team games there could be a default hue (¿even a range of saturation?) forced onto all of the players, so they can still be recognizable while avoiding confusion.
Logged


"Detailed" is nice, but if it gets in the way of clarity, it ceases being a nice addition and becomes a problem. - TVT
Want to contribute? Read this.
Pages: [1]
  Print  
 
Jump to: