Visualize grid resolution when base layers are disabled

This commit is contained in:
Erik Broberg
2016-06-28 19:28:54 -04:00
parent cdc3daedca
commit 3e53ff45b0
4 changed files with 28 additions and 3 deletions

View File

@@ -82,6 +82,8 @@ Fragment getFragment() {
ColorTexturesParent1,
ColorTexturesParent2);
#else
frag.color = calculateDebugColor(fs_uv, fs_position);
#endif // USE_COLORTEXTURE
#if USE_GRAYSCALE_OVERLAY

View File

@@ -54,7 +54,6 @@ layout(location = 1) in vec2 in_uv;
out vec2 fs_uv;
out vec4 fs_position;
out vec3 ellipsoidNormalCameraSpace;
out LevelWeights levelWeights;
PositionNormalPair globalInterpolation() {

View File

@@ -78,9 +78,11 @@ Fragment getFragment() {
ColorTextures,
ColorTexturesParent1,
ColorTexturesParent2);
#else
frag.color = calculateDebugColor(fs_uv, fs_position);
#endif // USE_COLORTEXTURE
#if USE_GRAYSCALE_OVERLAY
frag.color = calculateGrayScaleOverlay(

View File

@@ -63,7 +63,7 @@
#define SHOW_CHUNK_EDGES #{showChunkEdges}
float calculateHeight(
const vec2 uv,
vec2 uv,
LevelWeights levelWeights,
const Tile heightTiles[NUMLAYERS_HEIGHTMAP],
const Tile heightTilesParent1[NUMLAYERS_HEIGHTMAP],
@@ -77,6 +77,8 @@ float calculateHeight(
levelWeights = getDefaultLevelWeights();
#endif // HEIGHTMAP_BLENDING_ENABLED
uv = (65.0 / 65.0) * uv;
#for i in 0..#{lastLayerIndexHeightMaps}
{
float untransformedHeight =
@@ -121,6 +123,26 @@ vec4 calculateColor(
return color;
}
float gridDots(vec2 uv, vec2 gridResolution){
vec2 uvVertexSpace = fract(gridResolution * uv);
vec2 uvDotSpace = abs(2*(uvVertexSpace-0.5));
return 1-length(1-uvDotSpace);
}
vec4 calculateDebugColor(vec2 uv, vec4 fragPos){
vec2 vertexResolution = vec2(64.0);
vec2 uvVertexSpace = fract(vertexResolution * uv);
vec3 colorUv = vec3(0.3*uv.x, 0.3*uv.y, 0);
vec3 colorDistance = vec3(0, 0, 0.4*log(fragPos.w) - 3.9);
vec3 colorVertex = (1.0-length(uvVertexSpace)) * vec3(0.5);
vec3 colorHeightSample = (gridDots(uv, vertexResolution) > 0.9 ? 1 : 0) * vec3(1,0,0);
return vec4(colorUv + colorDistance + colorVertex + colorHeightSample, 1);
}
vec4 calculateNight(
const vec4 currentColor,
const vec2 uv,