Skip to content

Commit

Permalink
Smol stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Eldeston committed Mar 13, 2022
1 parent 18b003b commit 4cfde68
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions shaders/main/composite.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ varying vec2 screenCoord;
posVector.eyePlayerPos = mat3(gbufferModelViewInverse) * posVector.viewPos;
posVector.feetPlayerPos = posVector.eyePlayerPos + gbufferModelViewInverse[3].xyz;

// Get scene color
vec3 sceneCol = texture2D(gcolor, screenCoord).rgb;

#if ANTI_ALIASING == 2
Expand All @@ -111,13 +112,11 @@ varying vec2 screenCoord;
vec2 matRaw0 = texture2D(colortex3, screenCoord).xy;
material.metallic = matRaw0.x; material.smoothness = matRaw0.y;

// Apply deffered shading
sceneCol = complexShadingDeferred(material, posVector, sceneCol, dither);

// Get sky color
vec3 skyRender = getSkyRender(vec3(0), normalize(posVector.eyePlayerPos), false);

// Fog calculation
sceneCol = getFogRender(posVector.eyePlayerPos, sceneCol, skyRender, posVector.feetPlayerPos.y + cameraPosition.y, false);
// Fog and sky calculation
sceneCol = getFogRender(posVector.eyePlayerPos, sceneCol, getSkyRender(vec3(0), normalize(posVector.eyePlayerPos), false), posVector.feetPlayerPos.y + cameraPosition.y, false);
}
}

Expand Down
9 changes: 4 additions & 5 deletions shaders/main/deferred.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,9 @@ varying vec2 screenCoord;
posVector.eyePlayerPos = mat3(gbufferModelViewInverse) * posVector.viewPos;
posVector.feetPlayerPos = posVector.eyePlayerPos + gbufferModelViewInverse[3].xyz;

// Get scene color
vec3 sceneCol = texture2D(gcolor, screenCoord).rgb;

// Get sky color and do skyCol with vanilla sun and moon and skybox blend and input as new skyCol
vec3 skyRender = getSkyRender(sceneCol, normalize(posVector.eyePlayerPos), skyMask, true);

// If not sky, don't calculate lighting
if(!skyMask){
// Declare and get materials
Expand All @@ -124,6 +122,7 @@ varying vec2 screenCoord;
vec3 dither = getRand3(gl_FragCoord.xy * 0.03125);
#endif

// Apply deffered shading
sceneCol = complexShadingDeferred(material, posVector, sceneCol, dither);

#ifdef OUTLINES
Expand All @@ -132,8 +131,8 @@ varying vec2 screenCoord;
#endif
}

// Fog calculation
sceneCol = getFogRender(posVector.eyePlayerPos, sceneCol, skyRender, posVector.feetPlayerPos.y + cameraPosition.y, skyMask);
// Fog and sky calculation
sceneCol = getFogRender(posVector.eyePlayerPos, sceneCol, getSkyRender(sceneCol, normalize(posVector.eyePlayerPos), skyMask, true), posVector.feetPlayerPos.y + cameraPosition.y, skyMask);

/* DRAWBUFFERS:0 */
gl_FragData[0] = vec4(sceneCol, 1); //gcolor
Expand Down

0 comments on commit 4cfde68

Please sign in to comment.