SHADERSTATICPARM_SHADOWSAMPLER = 10, ///< sampler
SHADERSTATICPARM_CELSHADING = 11, ///< celshading (alternative diffuse and specular math)
SHADERSTATICPARM_CELOUTLINES = 12, ///< celoutline (depth buffer analysis to produce outlines)
- SHADERSTATICPARM_FXAA = 13 ///< fast approximate anti aliasing
+ SHADERSTATICPARM_FXAA = 13, ///< fast approximate anti aliasing
+ SHADERSTATICPARM_BORDERSHADING = 14 ///< darken edges of screen with shaded gradient
};
-#define SHADERSTATICPARMS_COUNT 14
+#define SHADERSTATICPARMS_COUNT 15
static const char *shaderstaticparmstrings_list[SHADERSTATICPARMS_COUNT];
static int shaderstaticparms_count = 0;
if (r_celoutlines.integer)
R_COMPILESHADER_STATICPARM_ENABLE(SHADERSTATICPARM_CELOUTLINES);
+ R_COMPILESHADER_STATICPARM_ENABLE(SHADERSTATICPARM_BORDERSHADING);
+
return memcmp(r_compileshader_staticparms, r_compileshader_staticparms_save, sizeof(r_compileshader_staticparms)) != 0;
}
R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_CELSHADING, "USECELSHADING");
R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_CELOUTLINES, "USECELOUTLINES");
R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_FXAA, "USEFXAA");
+ R_COMPILESHADER_STATICPARM_EMIT(SHADERSTATICPARM_BORDERSHADING, "USEBORDERSHADING");
}
/// information about each possible shader permutation
" dp_FragColor.rgb = dp_FragColor.rgb * (1.0 + UserVec2.x) + vec3(max(0.0, sobel - UserVec2.z))*UserVec2.y;\n",
"#endif\n",
"\n",
+"#ifdef USEBORDERSHADING\n",
+" // scaled simple border shading\n",
+" // todo: replace the following with cvarred settings\n",
+" float vertpad = 0.15;\n",
+" float horipad = 0.1;\n",
+" float multiplier = 4.0;\n",
+" float dist = min(horipad + TexCoord1.x, min(vertpad + TexCoord1.y, min((1.0 + horipad) - TexCoord1.x, (1.0 + vertpad) - TexCoord1.y)));\n",
+"\n",
+" dist = clamp(dist * multiplier, 0.0, 1.0);\n",
+" dp_FragColor.xyz *= dist;\n",
+"#endif\n",
+"\n",
"#ifdef USEBLOOM\n",
" dp_FragColor += max(vec4(0,0,0,0), dp_texture2D(Texture_Second, TexCoord2) - BloomColorSubtract);\n",
"#endif\n",
" dp_FragColor.rgb = dp_FragColor.rgb * (1.0 + UserVec2.x) + float3(1,1,1)*max(0.0, sobel - UserVec2.z)*UserVec2.y;\n",
"#endif\n",
"\n",
+"#ifdef USEBORDERSHADING\n",
+" // scaled simple border shading\n",
+" // todo: replace the following with cvarred settings\n",
+" float vertpad = 0.15;\n",
+" float horipad = 0.1;\n",
+" float multiplier = 4.0;\n",
+" float dist = min(horipad + TexCoord1.x, min(vertpad + TexCoord1.y, min((1.0 + horipad) - TexCoord1.x, (1.0 + vertpad) - TexCoord1.y)));\n",
+"\n",
+" dist = clamp(dist * multiplier, 0.0, 1.0);\n",
+" dp_FragColor.xyz *= dist;\n",
+"#endif\n",
+"\n",
"#ifdef USEBLOOM\n",
" dp_FragColor += max(float4(0,0,0,0), tex2D(Texture_Second, TexCoord2) - BloomColorSubtract);\n",
"#endif\n",