Browse Source

Updated shaders pack

Some deep review of this shaders is required for optimization...
pull/137/head
raysan5 8 years ago
parent
commit
61558ab83f
25 changed files with 59 additions and 58 deletions
  1. +1
    -1
      shaders/glsl100/bloom.fs
  2. +4
    -3
      shaders/glsl100/blur.fs
  3. +1
    -1
      shaders/glsl100/cross_hatching.fs
  4. +4
    -3
      shaders/glsl100/cross_stitching.fs
  5. +1
    -1
      shaders/glsl100/dream_vision.fs
  6. +1
    -1
      shaders/glsl100/fisheye.fs
  7. +4
    -3
      shaders/glsl100/pixel.fs
  8. +1
    -1
      shaders/glsl100/posterization.fs
  9. +1
    -1
      shaders/glsl100/predator.fs
  10. +1
    -1
      shaders/glsl100/scanlines.fs
  11. +4
    -9
      shaders/glsl100/standard.fs
  12. +4
    -3
      shaders/glsl100/swirl.fs
  13. +1
    -1
      shaders/glsl330/bloom.fs
  14. +4
    -3
      shaders/glsl330/blur.fs
  15. +1
    -1
      shaders/glsl330/cross_hatching.fs
  16. +4
    -3
      shaders/glsl330/cross_stitching.fs
  17. +1
    -1
      shaders/glsl330/depth.fs
  18. +1
    -1
      shaders/glsl330/dream_vision.fs
  19. +1
    -1
      shaders/glsl330/fisheye.fs
  20. +4
    -3
      shaders/glsl330/pixel.fs
  21. +1
    -1
      shaders/glsl330/posterization.fs
  22. +1
    -1
      shaders/glsl330/predator.fs
  23. +5
    -2
      shaders/glsl330/scanlines.fs
  24. +4
    -9
      shaders/glsl330/standard.fs
  25. +4
    -3
      shaders/glsl330/swirl.fs

+ 1
- 1
shaders/glsl100/bloom.fs View File

@ -8,7 +8,7 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 4
- 3
shaders/glsl100/blur.fs View File

@ -8,12 +8,13 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
const float renderWidth = 1280;
const float renderHeight = 720;
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 );
float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 );

+ 1
- 1
shaders/glsl100/cross_hatching.fs View File

@ -8,7 +8,7 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 4
- 3
shaders/glsl100/cross_stitching.fs View File

@ -8,12 +8,13 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
const float renderWidth = 1280;
const float renderHeight = 720;
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float stitchingSize = 6.0f;

+ 1
- 1
shaders/glsl100/dream_vision.fs View File

@ -8,7 +8,7 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 1
- 1
shaders/glsl100/fisheye.fs View File

@ -8,7 +8,7 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 4
- 3
shaders/glsl100/pixel.fs View File

@ -8,12 +8,13 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
const float renderWidth = 1280;
const float renderHeight = 720;
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
uniform float pixelWidth = 5.0f;
uniform float pixelHeight = 5.0f;

+ 1
- 1
shaders/glsl100/posterization.fs View File

@ -8,7 +8,7 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 1
- 1
shaders/glsl100/predator.fs View File

@ -8,7 +8,7 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 1
- 1
shaders/glsl100/scanlines.fs View File

@ -8,7 +8,7 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 4
- 9
shaders/glsl100/standard.fs View File

@ -34,7 +34,6 @@ struct Light {
};
const int maxLights = 8;
uniform int lightsCount;
uniform Light lights[maxLights];
vec3 CalcPointLight(Light l, vec3 n, vec3 v, float s)
@ -134,19 +133,15 @@ void main()
float spec = 1.0;
if (useSpecular == 1) spec *= normalize(texture2D(texture2, fragTexCoord).r);
for (int i = 0; i < lightsCount; i++)
for (int i = 0; i < maxLights; i++)
{
// Check if light is enabled
if (lights[i].enabled == 1)
{
// Calculate lighting based on light type
switch (lights[i].type)
{
case 0: lighting += CalcPointLight(lights[i], n, v, spec); break;
case 1: lighting += CalcDirectionalLight(lights[i], n, v, spec); break;
case 2: lighting += CalcSpotLight(lights[i], n, v, spec); break;
default: break;
}
if(lights[i].type == 0) lighting += CalcPointLight(lights[i], n, v, spec);
else if(lights[i].type == 1) lighting += CalcDirectionalLight(lights[i], n, v, spec);
else if(lights[i].type == 2) lighting += CalcSpotLight(lights[i], n, v, spec);
}
}

+ 4
- 3
shaders/glsl100/swirl.fs View File

@ -8,12 +8,13 @@ varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
const float renderWidth = 800.0; // HARDCODED for example!
const float renderHeight = 480.0; // Use uniforms instead...
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float radius = 250.0;
float angle = 0.8;

+ 1
- 1
shaders/glsl330/bloom.fs View File

@ -6,7 +6,7 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;

+ 4
- 3
shaders/glsl330/blur.fs View File

@ -6,15 +6,16 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
const float renderWidth = 1280.0;
const float renderHeight = 720.0;
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float offset[3] = float[](0.0, 1.3846153846, 3.2307692308);
float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703);

+ 1
- 1
shaders/glsl330/cross_hatching.fs View File

@ -6,7 +6,7 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;

+ 4
- 3
shaders/glsl330/cross_stitching.fs View File

@ -6,15 +6,16 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
const float renderWidth = 1280.0;
const float renderHeight = 720.0;
// NOTE: Render size values must be passed from code
const float renderWidth = 800.0;
const float renderHeight = 450.0;
float stitchingSize = 6.0;

+ 1
- 1
shaders/glsl330/depth.fs View File

@ -6,7 +6,7 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0; // Depth texture
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;

+ 1
- 1
shaders/glsl330/dream_vision.fs View File

@ -5,7 +5,7 @@ in vec2 fragTexCoord;
out vec4 fragColor;
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 1
- 1
shaders/glsl330/fisheye.fs View File

@ -5,7 +5,7 @@ in vec2 fragTexCoord;
out vec4 fragColor;
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// NOTE: Add here your custom variables

+ 4
- 3
shaders/glsl330/pixel.fs View File

@ -6,15 +6,16 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
const float renderWidth = 1280.0;
const float renderHeight = 720.0;
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
uniform float pixelWidth = 5.0;
uniform float pixelHeight = 5.0;

+ 1
- 1
shaders/glsl330/posterization.fs View File

@ -6,7 +6,7 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;

+ 1
- 1
shaders/glsl330/predator.fs View File

@ -6,7 +6,7 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;

+ 5
- 2
shaders/glsl330/scanlines.fs View File

@ -6,20 +6,23 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float offset = 0.0;
float frequency = 720.0/3.0;
uniform float time;
void main()
{
float frequency = renderHeight/3.0;
/*
// Scanlines method 1
float tval = 0; //time

+ 4
- 9
shaders/glsl330/standard.fs View File

@ -34,7 +34,6 @@ struct Light {
};
const int maxLights = 8;
uniform int lightsCount;
uniform Light lights[maxLights];
vec3 CalcPointLight(Light l, vec3 n, vec3 v, float s)
@ -134,19 +133,15 @@ void main()
float spec = 1.0;
if (useSpecular == 1) spec *= normalize(texture(texture2, fragTexCoord).r);
for (int i = 0; i < lightsCount; i++)
for (int i = 0; i < maxLights; i++)
{
// Check if light is enabled
if (lights[i].enabled == 1)
{
// Calculate lighting based on light type
switch (lights[i].type)
{
case 0: lighting += CalcPointLight(lights[i], n, v, spec); break;
case 1: lighting += CalcDirectionalLight(lights[i], n, v, spec); break;
case 2: lighting += CalcSpotLight(lights[i], n, v, spec); break;
default: break;
}
if(lights[i].type == 0) lighting += CalcPointLight(lights[i], n, v, spec);
else if(lights[i].type == 1) lighting += CalcDirectionalLight(lights[i], n, v, spec);
else if(lights[i].type == 2) lighting += CalcSpotLight(lights[i], n, v, spec);
}
}

+ 4
- 3
shaders/glsl330/swirl.fs View File

@ -6,15 +6,16 @@ in vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 fragTintColor;
uniform vec4 colDiffuse;
// Output fragment color
out vec4 finalColor;
// NOTE: Add here your custom variables
const float renderWidth = 800.0; // HARDCODED for example!
const float renderHeight = 480.0; // Use uniforms instead...
// NOTE: Render size values must be passed from code
const float renderWidth = 800;
const float renderHeight = 450;
float radius = 250.0;
float angle = 0.8;

Loading…
Cancel
Save