-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge vsm-upgrades and fixed some buggies
- Loading branch information
Showing
25 changed files
with
603 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,4 +85,33 @@ float ComputeHashedAlphaThreshold(vec3 objectSpacePos, float maxObjSpaceDerivLen | |
return clamp(threshold, 1e-6, 1.0); | ||
} | ||
|
||
// Copyright 2019 Google LLC. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Polynomial approximation in GLSL for the Turbo colormap | ||
// Original LUT: https://gist.github.com/mikhailov-work/ee72ba4191942acecc03fe6da94fc73f | ||
|
||
// Authors: | ||
// Colormap Design: Anton Mikhailov ([email protected]) | ||
// GLSL Approximation: Ruofei Du ([email protected]) | ||
|
||
vec3 TurboColormap(float x) | ||
{ | ||
const vec4 kRedVec4 = vec4(0.13572138, 4.61539260, -42.66032258, 132.13108234); | ||
const vec4 kGreenVec4 = vec4(0.09140261, 2.19418839, 4.84296658, -14.18503333); | ||
const vec4 kBlueVec4 = vec4(0.10667330, 12.64194608, -60.58204836, 110.36276771); | ||
const vec2 kRedVec2 = vec2(-152.94239396, 59.28637943); | ||
const vec2 kGreenVec2 = vec2(4.27729857, 2.82956604); | ||
const vec2 kBlueVec2 = vec2(-89.90310912, 27.34824973); | ||
|
||
x = clamp(x, 0, 1); | ||
vec4 v4 = vec4( 1.0, x, x * x, x * x * x); | ||
vec2 v2 = v4.zw * v4.z; | ||
return vec3( | ||
dot(v4, kRedVec4) + dot(v2, kRedVec2), | ||
dot(v4, kGreenVec4) + dot(v2, kGreenVec2), | ||
dot(v4, kBlueVec4) + dot(v2, kBlueVec2) | ||
); | ||
} | ||
|
||
#endif // MATH_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#version 460 core | ||
|
||
#include "../../Config.shared.h" | ||
#include "../../Math.h.glsl" | ||
#include "../../Resources.h.glsl" | ||
|
||
FVOG_DECLARE_ARGUMENTS(ViewerUniforms) | ||
{ | ||
uint textureIndex; | ||
uint samplerIndex; | ||
int texLayer; | ||
int texLevel; | ||
}pc; | ||
|
||
FVOG_DECLARE_SAMPLERS; | ||
FVOG_DECLARE_SAMPLED_IMAGES(utexture2D); | ||
|
||
layout(location = 0) in vec2 v_uv; | ||
|
||
layout(location = 0) out vec4 o_color; | ||
|
||
void main() | ||
{ | ||
const uint overdraw = textureLod(Fvog_usampler2D(pc.textureIndex, pc.samplerIndex), v_uv, pc.texLevel).x; | ||
|
||
o_color = vec4(vec3(TurboColormap(overdraw / VSM_MAX_OVERDRAW)), 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#version 460 core | ||
#extension GL_GOOGLE_include_directive : enable | ||
|
||
#include "../../Config.shared.h" | ||
#include "VsmCommon.h.glsl" | ||
|
||
layout(binding = 1, r32ui) uniform restrict uimage2D i_physicalPagesUint; | ||
|
||
layout(binding = 1, std140) uniform VsmShadowUniforms | ||
{ | ||
uint clipmapLod; | ||
}; | ||
|
||
layout(location = 0) in vec2 v_uv; | ||
|
||
void main() | ||
{ | ||
const uint clipmapIndex = clipmapUniforms.clipmapTableIndices[clipmapLod]; | ||
const ivec2 pageOffset = clipmapUniforms.clipmapPageOffsets[clipmapLod]; | ||
const ivec2 pageAddressXy = ivec2(mod(vec2(ivec2(gl_FragCoord.xy) / PAGE_SIZE + pageOffset), vec2(imageSize(i_pageTables).xy))); | ||
const uint pageData = imageLoad(i_pageTables, ivec3(pageAddressXy, clipmapIndex)).x; | ||
const bool pageIsActive = GetIsPageBacked(pageData) && GetIsPageDirty(pageData); | ||
|
||
if (!pageIsActive) // write stencil ref to active pages only | ||
{ | ||
discard; | ||
} | ||
} |
Oops, something went wrong.