Trying to fix mod

Discussion in 'Mod Discussions' started by tatsujb, February 26, 2014.

?

I have tried you mod and I am in this situation :

  1. Nvidia graphic card and icons work

    33.3%
  2. Nvidia graphic card and icons don't work

    0 vote(s)
    0.0%
  3. ATi graphic card and icons work

    0 vote(s)
    0.0%
  4. ATi graphic card and icons don't work

    66.7%
  5. intelHD and icons work

    0 vote(s)
    0.0%
  6. intelHD and icons don't work

    0 vote(s)
    0.0%
  1. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    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
    
    this soothes my brainsies... Ahhh *Rub* *Rub* Rub* soooothing
    054Psyduck2.png
  2. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385
    am I making progress or does it look like I'm attempting to kick myself in the head? :
    Code:
    float getLuma (in vec3 col)
      { return ( 1.0*col.r+0.0*col.g+0.0*col.b ); }
    
    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);
     vec4 Yellow = vec4(1.0,1.0,0.0,1.0);
     vec4 Blue = vec4(0.0,0.0,1.0,1.0);
      vec4 Green = vec4(0.0,1.0,0.0,1.0);
      float luma = getLuma(TeamColor_Primary.rgb);
      vec4 border;
      if (luma > 0.1)
      { border = Black; }
      else
      { border = White; }
      vec4 primary;
      { primary = TeamColor_Primary; }
    
  3. Dementiurge

    Dementiurge Post Master General

    Messages:
    1,094
    Likes Received:
    693
    I can confirm that Xedi's fixed shader code works on AMD drivers.
    It's mystifying that the broken shader worked on Nvidia at all.
    xedi likes this.
  4. xedi

    xedi Active Member

    Messages:
    135
    Likes Received:
    31
    You shouldn't change this function. This is a lightness calculation to decide whether to use black or white border. With your modification, a color such as cyan (which is very bright) would be considered dark (because you are only using the R component) and thus be given a bright border... I can assure you, it looks clearer with a dark border!

    You haven't done anything else but define a bunch of colors, your code snippet doesn't even say how you're using them, so it's hard to say anything meaningful about that.

    All you should need to do is to plug in the colours you want into the combo function to get the final colour. If you want to do what you had before, with the yellow for nuclear weapons stuff, then you should include a bunch of case analysis (col110 = yellow except if TeamColor_Primary is similar to yellow in which case col110 = something else, etc).
  5. tatsujb

    tatsujb Post Master General

    Messages:
    12,902
    Likes Received:
    5,385

Share This Page