PLEASE chime in if a modded shader of another source works or does not work. My shader has been known to malfunction even though it works fine on other computers, I have witnessed it myself on other computers both through teamviewer and at a friend's house. One had a ATi graphic card, one an intelHD, I have an Nvidia. here's what the malfunction may look like. often the icons will show up not like this but a multitude of bright colors that cycle if you zoom in or out. you can see them working correctly in my signature and in this tutorial on how to install my mod. provided you have a counter-example of either my mod working on ATi or intelHD or it having the same issue with nvidia my hypothesis is wrong, otherwise it is true. either way this would help me out very much. thanks.
but why do you edit the shaders ? as far as I can see you only use black and the main teamcolour .. am I wrong?!.. by the way .. ATI card and icons are rainbows .. keep it up, moldez
NO my shader inverts main and border color when the body color is too dark (E.G. black) and keeps nuke icons yellow whatever the team color.
ah okay .. someday you have to tell me how to edit the shaders .. its a gordian knot for me :-/ and I only have a wooden spoon .. no sword
best person to ask on here is xedi in my opinion. but he just told me to document myself. he did my shader. I've toyed around with it but haven't optained better results. I'm still learning. When I figure it out well I'll give you a PM.
Well, I'm not sure at all why there would be an issue with different GPU... Here's the code I'm currently using for my strategic icons... EDITED: I updated this for v61694, which I didn't realise changed this file! Code: #version 150 #ifdef GL_ES precision mediump float; #endif uniform sampler2D Texture; uniform vec4 TeamColor_Primary; uniform vec4 TeamColor_Secondary; in vec2 v_TexCoord; out vec4 out_FragColor; // lightness calculation float getLuma (in vec3 col) { return ( 0.3*col.r+0.59*col.g+0.11*col.b ); } // arguments: input colour, and blending colours (edges of RGB cube) // i.e. col000 corresponds to what the black pixels turn into, // col100 what the red pixels turn into, col101 the magenta pixels, etc... // this function turns the input colour into a blend of the given colours vec4 combo(in vec3 col, in vec4 col000, in vec4 col111, in vec4 col100, in vec4 col010, in vec4 col001, in vec4 col110, in vec4 col101, in vec4 col011) { vec3 loc = vec3(1.0,1.0,1.0) - col; return ( col.x*col.y*col.z*col111 + col.x*col.y*loc.z*col110 + col.x*loc.y*col.z*col101 + col.x*loc.y*loc.z*col100 + loc.x*col.y*col.z*col011 + loc.x*col.y*loc.z*col010 + loc.x*loc.y*col.z*col001 + loc.x*loc.y*loc.z*col000 ); } void main() { vec4 texel = texture(Texture, v_TexCoord); vec4 Black = vec4(0.0,0.0,0.0,1.0); vec4 White = vec4(1.0,1.0,1.0,1.0); float luma = getLuma(TeamColor_Primary.rgb); vec4 border; if (luma > 0.2) { border = Black; } else { border = White; } // temporary hack to allow icon highlight on selection // works because primary team colour is converted to cyan upon selection, // and because no actual team colour is pure cyan RGB(0,1,1) vec4 highlight; vec4 primary; if (TeamColor_Primary == vec4(0.0,1.0,1.0,1.0)) { highlight = vec4(0.0,0.8,0.8,0.8); primary = vec4(0.0,0.0,0.0,0.0); } else { highlight = vec4(0.0,0.0,0.0,0.0); primary = TeamColor_Primary; } vec4 pip = vec4(1-border.x, 1-border.y, 1-border.z,border.a); vec4 shots = vec4(0.8,0.8,0,1); // NOTE: it seems that texel.r and texel.b are switched?! // this is why I'm using texel.bgr instead of texel.rgb vec4 final_color = combo(texel.bgr, border, pip, primary, TeamColor_Secondary, White, shots, White, highlight); out_FragColor = texel.a * final_color.a * final_color; } The only thing you need to understand about this code that might not be completely clear is how my combo function works. The idea is that RGB space forms a cube [0,1] x [0,1] x [0,1]... so the shading works by mapping each vertex of the cube to a colour, and interpolating. So my function call: Code: combo(texel.bgr, border, pip, primary, TeamColor_Secondary, White, shots, White, highlight); does the following: for each pixel of the icon (they look like this ), it looks what colour it is, and from that it interpolates using the other arguments. For instance, a pixel coloured RGB(0,0,0) = black is turned into the border colour, RGB(1,1,1) = white is turned into the pip colour, RGB(0,1,0)=green is turned into secondary team colour, etc... and then things in between are turned into blends, so RGB(0.5,0,0) would be turned into a mix of border colour and primary team colour. I don't see any reason this code shouldn't work for ATI cards, but then I don't see why tatsu's code shouldn't work either. (EDIT: well, now I see the code needed updating for v61694!) In any case, I think with this explanation, tatsu, you should be able to write the shader your want. I know you have some annoying case analysis so that you can use yellow to indicate nuclear weapon related icons, but I don' think that's a great idea as I think it looks inconsistent (especially if your team colour is yellow) and a bit cluttered... but you can implement that just fine anyway if you want to. I'm still just waiting for Uber to fix the resizing issues...
Well when I start PA with that shader file shadowed it just crashes PA.exe If I remove the shader it magically works again.
Ah, sorry, I didn't realise they updated this file in the last patch... I need to change some variable names, give me a few minutes.
well so far (I know three votes only... thanks again @cptconundrum and whichever shy moderator ) we have no counter examples. I'm pretty much forced to believe that any shader that isn't stock won't work on ATi and intelHD rigs. I'm comparing the two shaders now, seeing what I can improve.
Haha, I never reported it or said anything to a moderator. All I did was ask you why it was in General.
no you said would have been better. and nothing at all better yet. Don't worry, I'm not going to hold it against you. future reference stuff I guess. this thread never disserved to be moved. Sinking to the bottom of general it would have piled up much more votes than this and that's all I wanted for it.
It's a shorthand that in my opinion makes the code quite readable and symmetric. loc is col written backwards because loc is the opposite of col. You don't need to understand the code for the combo function, as long as you have faith in my explanation of what it does...!
I do believe it works! I have the most faith! I honestly am trying my best but I cannot decipher it. Here's all the possibilities listed out including null: Code: vec4 combo(in vec3 col, in vec4 col000, in vec4 col111, in vec4 col100, in vec4 col010, in vec4 col001, in vec4 col110, in vec4 col101, in vec4 col011) what the litteral fu ck? : Code: { vec3 loc = vec3(1.0,1.0,1.0) - col; return ( col.x*col.y*col.z*col111 + col.x*col.y*loc.z*col110 + col.x*loc.y*col.z*col101 + col.x*loc.y*loc.z*col100 + loc.x*col.y*col.z*col011 + loc.x*col.y*loc.z*col010 + loc.x*loc.y*col.z*col001 + loc.x*loc.y*loc.z*col000 ); } I get that it's a cube of colour so there's x, y and z but that doesn't help my brain figure this out
Well the vertices of the cube are labeled by triples of 0 or 1, and the notation reflects that. I'm just linearly interpolating inside the cube. Think about it like this. Red pixels turn into col100 (because RGB(1,0,0) is red)... and my measure of redness is r*(1-g)*(1-b). I can't just only look at the first component, because then magenta (RGB(1,0,1)) would also get sent to col100. For magenta, I have the factor r*(1-g)*b, etc... If you follow this reasoning, you get the expression I wrote for the function: Code: col.r*col.g*col.b*col111 + col.r*col.g*loc.b*col110 + col.r*loc.g*col.b*col101 + col.r*loc.g*loc.b*col100 + loc.r*col.g*col.b*col011 + loc.r*col.g*loc.b*col010 + loc.r*loc.g*col.b*col001 + loc.r*loc.g*loc.b*col000 I just use loc.r to mean (1-col.r), etc.