StepByStep: Shaders on skins

color a whole skin

The making of the skin
1. Open the skin you’re going to use in Gimp/Photoshop
2. make sure you’re in rgb mode
3. make an alpha channel
4. select the area you want to affect
5. paste it into an alpha channel
6. save as tga 32 bit
7. put it in /textures

The writing of the shader
map textures/doomface_alpha.tga
blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
The running the shader in CSQC
1. CSQCinit,
2. forceshader
Note: you can make sure your users have it via:
// puts a nice shader on the lockdown walls
float(float isnew) updatewall =
{
if(isnew)
{
//self.forceshader = shaderforname(“nameofshader”, “{\ndefaultshaderbodytouseifthesahderdoesntexist\n}\n”);
// shaderforname
// 1 you need a nameofshader (this WONT work: shaderforname(“”, “your shader”);
// 2. the shader code needs to be in 1 line per string
// 3. each line must end with a \n
self.forceshader = shaderforname(“glass_barrier”,
“{\n”
“qer_editorimage textures/aedm7/dsiglass_checker.tga\n”
“qer_trans 0\n”
“surfaceparm lightfilter // Use texture’s RGB and alpha channels to generate colored alpha shadows in the lightmap.\n”
“surfaceparm nolightmap\n”
“surfaceparm trans\n”
“{\n”
“map textures/aedm7/dsitinfx.tga\n”
“blendfunc blend\n”
“tcGen environment\n”
“alphagen const 0.1 \n”
“}\n”
“}\n”
);
}

return TRUE; // you need this

}

notes:
http://icculus.org/gtkradiant/documentation/Q3AShader_Manual/ch06/pg6_1.htm
http://www.quakelive.com/forum/showthread.php?32510-Creating-Your-Own-Shader-The-Basics
15[20:07] * omc-afk is now known as OneManClan
15[20:07] <OneManClan> I’m still trying to figure out how to do it ..
15[20:08] <OneManClan> I’ve got the ‘how to make a player turn blue’ part
15[20:09] <OneManClan> and ive got the ‘how to make him fade/pulse to blue and back
15[20:09] <OneManClan> the only think i dont understand is “how to make the effect only affect the face”
15[20:10] <OneManClan> IIUC, it has something to do with ‘masking’ and ‘alpha channels’
15[20:11] <OneManClan> Q: Has anyone messed with alpha channels and shaders?

[20:12] <shpuld_travel> yeah I’ve done some stuff with alpha channels
15[20:14] <OneManClan> could you help me w a ‘step by step’ re how to make shader ‘do something’ to only a portion of a skin?
15[20:15] <OneManClan> IIUC you make an alpha channel, where all the parts you DON’T want affected are bkack
15[20:15] <OneManClan> black
15[20:16] <OneManClan> and in the shader, you put a line/command which specifies ‘only affect the non black areas’

[20:16] <shpuld_travel> alpha channels are simple if you’re using an image editor that’s not mspaint
15[20:16] <OneManClan> ok, but do i have (roughly) the right idea?
[20:16] <shpuld_travel> and in the q3 shaders blendmode is important when dealing with transparency
15[20:17] <OneManClan> ok

15[22:00] <OneManClan> lotta answers here: http://icculus.org/gtkradiant/documentation/Q3AShader_Manual/ch06/pg6_1.htm
15[22:05] <OneManClan> Shader Cage: https://www.flickr.com/photos/60268498@N06/19634275521
15[22:10] <OneManClan> cage + glass: https://www.flickr.com/photos/60268498@N06/19007383514/
04[22:38] <Lava_Croft> OneManClan: no {texture support?
15[22:38] <OneManClan> how do you mean?
[22:40] <Lava_Croft> https://kneedeepinthedoomed.wordpress.com/rmq-mapping-guide/
[22:40] <Lava_Croft> look for {texturename
[22:40] <Lava_Croft> i know ericw wrote a patch for dp to support it, not sure if its applied yet
15[22:41] <OneManClan> I’m not sure what you’re asking
[22:41] <Lava_Croft> you seem to be wanting transparent textures
15[22:41] <OneManClan> ahhh
[22:41] <Lava_Croft> like, fence textures
[22:41] <Lava_Croft> thats exactly what that is
[22:42] <Lava_Croft> without q3 shaders
[22:42] <Lava_Croft> its just another way of doing what you want
15[22:42] <OneManClan> this is more about shaders + skins, and how to get shaders to do ‘stuff’ to players faces (not bodies)
[22:42] <Lava_Croft> kind of
[22:42] <Lava_Croft> aah
15[22:42] <OneManClan> thanks though!
[22:42] <Lava_Croft> and there was much aaah
[22:42] <Lava_Croft> np!
15[22:43] <OneManClan> lookin to do blood, vomit, illness, drowning, animations etc on players skins
[22:44] <Lava_Croft> oh my
15[22:44] <OneManClan> last time had to actually make a skin for each condition
15[22:45] <OneManClan> ie 4 (blood levels) x 2 (disease on/off) x 4 (expressions) x 8 (classes)
15[22:46] <OneManClan> whereas if you can apply (eg) blood /injuries as a shader…..
15[22:46] <OneManClan> … you just need 4 shaders, and can apply them ‘on top’ of existing skin!
15[22:47] <OneManClan> AND (iiuc) a shader can get access to a players health
15[22:48] <OneManClan> also fire on skin effects (like TF2 has)
15[22:49] <OneManClan> even take it further.. a burnt up crispy looking player! lol
15[22:49] <OneManClan> anyway for now – baby steps
15[22:50] <OneManClan> how to make skin tgas w alpha channels which mask out skin
15[22:56] <OneManClan> “Error while writing output ../csprogs.dat”
15[22:57] <OneManClan> Q: anyone have any idea what that means?
15[22:57] <OneManClan> fteqcc – compiking csqc – no errors
[22:57] <Lava_Croft> “comspoiking csqc”
[22:57] <Lava_Croft> sorry
15[22:57] <OneManClan> thats my typing
15[22:57] <OneManClan> sry
[22:58] <Lava_Croft> dont worry, i type just as awful
15[22:59] <OneManClan> damn i reverted to earlier (working version of (csqc file ive been editing) ) and no diff
[23:00] <Lava_Croft> >_<
15[23:00] <OneManClan> wtf, now it compiled
15[23:00] <OneManClan> hm
[23:02] <Lava_Croft> :DDD
[23:02] <Lava_Croft> forget about it, it compiled
[23:02] <Lava_Croft> time for cake
15[23:09] <OneManClan> !!!!!!!
15[23:10] <OneManClan> stand by for historic moment!
15[23:10] <OneManClan> (for me anyway! lol
15[23:12] <OneManClan> *drum roll*
15[23:12] <OneManClan> https://www.flickr.com/photos/60268498@N06/19443293480
15[23:12] <OneManClan> !!!!!
[23:12] <Lava_Croft> :DDDD
[23:12] <Lava_Croft> haha
[23:12] <Lava_Croft> that is freaky
[23:12] <Lava_Croft> its the invisible man
15[23:13] <OneManClan> yea
15[23:13] <OneManClan> hard to get my head around what exactly is going on
15[23:13] <OneManClan> the face is still there
15[23:13] <OneManClan> a shader is “affecting the entire mdl” ie the whole skin
15[23:14] <OneManClan> BUT only the areas on the alpha channel
[23:14] <Lava_Croft> yeah
[23:14] <Lava_Croft> thats the idea, i remember it from spending a day to get a shiny metal shader going
15[23:14] <OneManClan> I made a tga of the players skin, selected the players face, and pasted it ontp a channel
15[23:15] <OneManClan> which i called ‘alpha channel’
15[23:15] <OneManClan> so i think the shader considers the ‘alpha’ channel to be whatever you called the ‘alpha channel’
[23:16] <Lava_Croft> that i dont know
[23:16] <Lava_Croft> (its also been 5 years or more since i last toyed with q3 shaders)
[23:16] <Lava_Croft> but i remember days and days of fucking about with it
15[23:16] <OneManClan> how far did you go?
[23:16] <Lava_Croft> far enough to get my own mapping stuff working
[23:16] <Lava_Croft> i did not enjoy writing q3 shaders
[23:17] <Lava_Croft> at all
[23:17] <Lava_Croft> i just want to place brushes and texture them and place point lights
15[23:17] <OneManClan> IIUC the shader processes are layered on top of each other
[23:17] <Lava_Croft> q3 shaders made me feel like a coder
[23:17] <Lava_Croft> yea
[23:17] <Lava_Croft> some water shaders are clear with this
[23:17] <Lava_Croft> they have several layers of moving textures on top of each other
15[23:17] <OneManClan> so you can put blood OVER skin
[23:17] <Lava_Croft> yup
15[23:18] <OneManClan> so if theres a blood splotch in middle of face…
15[23:18] <OneManClan> .. and player opens their mouth
15[23:18] <OneManClan> the blackness of the open mouth will not be ‘filled w blood’
15[23:18] <OneManClan> sry i should have used a nicer example
15[23:18] <OneManClan> lol
[23:18] <Lava_Croft> haha
[23:18] <Lava_Croft> #nsa
[23:18] <Lava_Croft> just in case, i will tag it for them
15[23:19] <OneManClan> well this is exciting… id better write an ‘absolute beginners guide’ before i forget all this
[23:19] <Lava_Croft> q3 shaders is meh
[23:19] <Lava_Croft> so much stuff 😀

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>