Skip to content

Commit

Permalink
renderer: fix grey infuriating line
Browse files Browse the repository at this point in the history
  • Loading branch information
illwieckz committed Feb 10, 2020
1 parent 85623e0 commit 0b237d2
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 28 deletions.
5 changes: 1 addition & 4 deletions src/engine/renderer/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,10 +722,7 @@ std::string GLShaderManager::BuildGPUShaderText( Str::StringRef mainShaderNa
AddDefine( env, "MAX_REF_LIGHTS", MAX_REF_LIGHTS );
AddDefine( env, "TILE_SIZE", TILE_SIZE );

float fbufWidthScale = 1.0f / glConfig.vidWidth;
float fbufHeightScale = 1.0f / glConfig.vidHeight;

AddDefine( env, "r_FBufScale", fbufWidthScale, fbufHeightScale );
AddDefine( env, "r_FBufSize", glConfig.vidWidth, glConfig.vidHeight );

AddDefine( env, "r_tileStep", glState.tileStep[ 0 ], glState.tileStep[ 1 ] );

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/cameraEffects_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DECLARE_OUTPUT(vec4)
void main()
{
// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 st = gl_FragCoord.st * r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

vec4 original = clamp(texture2D(u_CurrentMap, st), 0.0, 1.0);

Expand Down
7 changes: 3 additions & 4 deletions src/engine/renderer/glsl_source/contrast_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ vec4 f(vec4 color) {

void main()
{
vec2 scale = r_FBufScale;
vec2 st = gl_FragCoord.st;

// calculate the screen texcoord in the 0.0 to 1.0 range
st *= r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

// multiply with 4 because the FBO is only 1/4th of the screen resolution
st *= vec2(4.0, 4.0);

vec2 scale = 1 / r_FBufSize;

// perform a box filter for the downsample
vec4 color = f(texture2D(u_ColorMap, st + vec2(-1.0, -1.0) * scale));
color += f(texture2D(u_ColorMap, st + vec2(-1.0, 1.0) * scale));
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/depthtile1_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ IN(flat) vec3 unprojectionParams;

uniform vec3 u_zFar;

const vec2 pixelScale = r_FBufScale;
const vec2 pixelScale = 1 / r_FBufSize;

DECLARE_OUTPUT(vec4)

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/fogGlobal_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ out vec4 outputColor;
void main()
{
// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 st = gl_FragCoord.st * r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

// reconstruct vertex position in world space
float depth = texture2D(u_DepthMap, st).r;
Expand Down
10 changes: 5 additions & 5 deletions src/engine/renderer/glsl_source/forwardLighting_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ vec3 RandomVec3(vec2 uv)

dir = normalize(vec3(cos(angle), sin(angle), r));
#else
// dir = texture2D(u_NoiseMap, gl_FragCoord.st * r_FBufScale).rgb;
// dir = texture2D(u_NoiseMap, gl_FragCoord.st / r_FBufSize).rgb;
dir = normalize(2.0 * (texture2D(u_RandomMap, uv).xyz - 0.5));
#endif

Expand Down Expand Up @@ -357,7 +357,7 @@ vec4 PCF(vec3 Pworld, float filterWidth, float samples, out vec4 clipMoments)
{
for(int j = 0; j < samples; j++)
{
vec3 rand = RandomVec3(gl_FragCoord.st * r_FBufScale + vec2(i, j)) * filterWidth;
vec3 rand = RandomVec3(gl_FragCoord.st / r_FBufSize + vec2(i, j)) * filterWidth;
// rand.z = 0;
// rand = normalize(rand) * filterWidth;

Expand Down Expand Up @@ -420,7 +420,7 @@ vec4 PCF(vec4 shadowVert, float filterWidth, float samples, out vec4 clipMoments
{
for(int j = 0; j < samples; j++)
{
vec3 rand = RandomVec3(gl_FragCoord.st * r_FBufScale + vec2(i, j)) * filterWidth;
vec3 rand = RandomVec3(gl_FragCoord.st / r_FBufSize + vec2(i, j)) * filterWidth;
// rand = vec3(0.0, 0.0, 1.0);
// rand.z = 0;
// rand = normalize(rand);// * filterWidth;
Expand Down Expand Up @@ -484,7 +484,7 @@ vec4 PCF(vec4 incidentRay, float filterWidth, float samples, out vec4 clipMoment
{
for(int j = 0; j < samples; j++)
{
vec3 rand = RandomVec3(gl_FragCoord.st * r_FBufScale + vec2(i, j)) * filterWidth;
vec3 rand = RandomVec3(gl_FragCoord.st / r_FBufSize + vec2(i, j)) * filterWidth;
// rand.z = 0;
// rand = normalize(rand) * filterWidth;

Expand Down Expand Up @@ -750,7 +750,7 @@ void main()
{
#if 0
// create random noise vector
vec3 rand = RandomVec3(gl_FragCoord.st * r_FBufScale);
vec3 rand = RandomVec3(gl_FragCoord.st / r_FBufSize);

outputColor = vec4(rand * 0.5 + 0.5, 1.0);
return;
Expand Down
4 changes: 2 additions & 2 deletions src/engine/renderer/glsl_source/fxaa_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ out vec4 outputColor;
void main()
{
outputColor = FxaaPixelShader(
gl_FragCoord.xy * r_FBufScale, //pos
gl_FragCoord.xy / r_FBufSize, //pos
vec4(0.0), //not used
u_ColorMap, //tex
u_ColorMap, //not used
u_ColorMap, //not used
r_FBufScale, //fxaaQualityRcpFrame
1 / r_FBufSize, //fxaaQualityRcpFrame
vec4(0.0), //not used
vec4(0.0), //not used
vec4(0.0), //not used
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/generic_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void main()
#endif

#if defined(USE_DEPTH_FADE) || defined(USE_VERTEX_SPRITE)
float depth = texture2D(u_DepthMap, gl_FragCoord.xy * r_FBufScale).x;
float depth = texture2D(u_DepthMap, gl_FragCoord.xy / r_FBufSize).x;
float fadeDepth = 0.5 * var_FadeDepth.x / var_FadeDepth.y + 0.5;
color.a *= smoothstep(gl_FragCoord.z, fadeDepth, depth);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/heatHaze_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void main()
vec3 normal = NormalInTangentSpace(var_TexCoords);

// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 st = gl_FragCoord.st * r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

// offset by the scaled normal and clamp it to 0.0 - 1.0
st += normal.xy * var_Deform;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/lightVolume_omni_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ DECLARE_OUTPUT(vec4)
void main()
{
// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 st = gl_FragCoord.st * r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

// reconstruct vertex position in world space
float depth = texture2D(u_DepthMap, st).r;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/liquid_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void main()
}

// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 texScreen = gl_FragCoord.st * r_FBufScale;
vec2 texScreen = gl_FragCoord.st / r_FBufSize;
vec2 texNormal = var_TexCoords;

#if defined(USE_PARALLAX_MAPPING)
Expand Down
3 changes: 1 addition & 2 deletions src/engine/renderer/glsl_source/motionblur_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ out vec4 outputColor;

void main()
{
vec2 st = gl_FragCoord.st;
vec4 color = vec4( 0.0 );

// calculate the screen texcoord in the 0.0 to 1.0 range
st *= r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

float depth = texture2D( u_DepthMap, st ).r;

Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/portal_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DECLARE_OUTPUT(vec4)
void main()
{
// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 st = gl_FragCoord.st * r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

vec4 color = texture2D(u_CurrentMap, st);
color *= var_Color;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/screen_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DECLARE_OUTPUT(vec4)
void main()
{
// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 st = gl_FragCoord.st * r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

vec4 color = texture2D(u_CurrentMap, st);
color *= var_Color;
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/ssao_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DECLARE_OUTPUT(vec4)

uniform vec3 u_zFar;

const vec2 pixelScale = r_FBufScale;
const vec2 pixelScale = 1 / r_FBufSize;
const float haloCutoff = 15.0;

float depthToZ(float depth) {
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/glsl_source/volumetricFog_fp.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ float DecodeDepth(vec4 color)
void main()
{
// calculate the screen texcoord in the 0.0 to 1.0 range
vec2 st = gl_FragCoord.st * r_FBufScale;
vec2 st = gl_FragCoord.st / r_FBufSize;

// calculate fog volume depth
float fogDepth;
Expand Down

0 comments on commit 0b237d2

Please sign in to comment.