Lightweight & failsafe sun.fs for R600g

Discussion in 'Mac and Linux' started by SXX, June 5, 2014.

  1. SXX

    SXX Post Master General

    Messages:
    6,897
    Likes Received:
    1,811
    This is just shader without using noise and unused code but it's still looks valid. Made for R600g Linux users (PA#2321), but will also work to decrease GPU load because default shader is super heavy.

    Save as media/shaders/sun.fs:
    Code:
    #version 150
    
    #ifdef GL_ES
    precision mediump float;
    #endif
    
    uniform vec4 Time;
    uniform vec3 cameraPos;
    
    in vec3 v_Normal;
    in vec3 v_Position;
    in vec3 v_Position_ObjectSpace;
    
    uniform vec4 Color;
    
    out vec4 out_FragColor;
    
    void main()
    {
        float noiseVal = 1.0;
    
        vec3 camera_dir = normalize( cameraPos - v_Position );
        float ndotv = clamp( dot(camera_dir, v_Normal), 0.0, 1.0 );
    
        vec3 color = mix(vec3(1.0,1.0,0.3) * (2.0 + pow(ndotv, 2.0) * 10.0), vec3(1.0,0.24,0.05) * (1.0 + sqrt(ndotv) * 3.0), pow(noiseVal, 0.5 + pow(ndotv, 2.0) * 20.0));
    
        float alpha = clamp(ndotv * 2.0, 0.0, 1.0);
        alpha = pow(alpha,5.0);// + clamp(noiseVal * 2.0 - 1.0, 0.0, 1.0));
    
        out_FragColor = vec4(color * 1.5, -10.0);
    }
    Default shader (usually FPS it's drop even lower):
    SUN_WITH_NOISE.jpg
    This one (less FPS drops on camera movement):
    SUN_WITHOUT_NOISE.jpg
    Last edited: June 5, 2014
    DeathByDenim and thetrophysystem like this.
  2. thetrophysystem

    thetrophysystem Post Master General

    Messages:
    7,050
    Likes Received:
    2,874
    Works on Win7 9500gt
  3. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    As a mod. I didn't notice a big difference from planet view on Intel 5000, but it was pretty dramatic zoomed in on the sun.

    Attached Files:

  4. SXX

    SXX Post Master General

    Messages:
    6,897
    Likes Received:
    1,811
    I suppose you can add it to PAMM? That would be helpful. :)
  5. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    Published.
    SXX likes this.
  6. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    SXX likes this.
  7. PrinceAAwe

    PrinceAAwe Member

    Messages:
    81
    Likes Received:
    23
    is this still useful?
  8. SXX

    SXX Post Master General

    Messages:
    6,897
    Likes Received:
    1,811
    There was some changes in both sun shader and R600g driver so this need to be re-checked again.
    PrinceAAwe likes this.
  9. PrinceAAwe

    PrinceAAwe Member

    Messages:
    81
    Likes Received:
    23
    oh ok then thanks!

Share This Page