mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Merge and a lot of rewriting the color conversion
This commit is contained in:
parent
b6a4ec910c
commit
9335acc887
35 changed files with 201 additions and 145 deletions
|
@ -30,7 +30,7 @@ void main(void) {
|
|||
varTexcoord = inTexCoord0.st;
|
||||
|
||||
// pass along the diffuse color
|
||||
varColor = colorToLinearRGBA(inColor);
|
||||
varColor = color_sRGBAToLinear(inColor);
|
||||
|
||||
|
||||
// standard transform
|
||||
|
|
|
@ -31,7 +31,7 @@ void main(void) {
|
|||
varTexcoord = inTexCoord0.st;
|
||||
|
||||
// pass along the diffuse color
|
||||
varColor = colorToLinearRGBA(inColor);
|
||||
varColor = color_sRGBAToLinear(inColor);
|
||||
|
||||
|
||||
// standard transform
|
||||
|
|
|
@ -11,18 +11,45 @@
|
|||
<@if not GPU_COLOR_SLH@>
|
||||
<@def GPU_COLOR_SLH@>
|
||||
|
||||
float sRGBFloatToLinear(float value) {
|
||||
// Linear ====> linear RGB
|
||||
// sRGB ======> standard RGB with gamma of 2.2
|
||||
// YCoCg =====> Luma (Y) chrominance green (Cg) and chrominance orange (Co)
|
||||
// https://software.intel.com/en-us/node/503873
|
||||
|
||||
float color_scalar_sRGBToLinear(float value) {
|
||||
const float SRGB_ELBOW = 0.04045;
|
||||
|
||||
return (value <= SRGB_ELBOW) ? value / 12.92 : pow((value + 0.055) / 1.055, 2.4);
|
||||
}
|
||||
|
||||
vec3 colorToLinearRGB(vec3 srgb) {
|
||||
return vec3(sRGBFloatToLinear(srgb.r), sRGBFloatToLinear(srgb.g), sRGBFloatToLinear(srgb.b));
|
||||
vec3 color_sRGBToLinear(vec3 srgb) {
|
||||
return vec3(color_scalar_sRGBToLinear(srgb.r), color_scalar_sRGBToLinear(srgb.g), color_scalar_sRGBToLinear(srgb.b));
|
||||
}
|
||||
|
||||
vec4 colorToLinearRGBA(vec4 srgba) {
|
||||
return vec4(colorToLinearRGB(srgba.xyz), srgba.w);
|
||||
vec4 color_sRGBAToLinear(vec4 srgba) {
|
||||
return vec4(color_sRGBToLinear(srgba.xyz), srgba.w);
|
||||
}
|
||||
|
||||
vec3 color_LinearToYCoCg(vec3 rgb) {
|
||||
// Y = R/4 + G/2 + B/4
|
||||
// Co = R/2 - B/2
|
||||
// Cg = -R/4 + G/2 - B/4
|
||||
return vec3(
|
||||
rgb.x/4.0 + rgb.y/2.0 + rgb.z/4.0,
|
||||
rgb.x/2.0 - rgb.z/2.0,
|
||||
-rgb.x/4.0 + rgb.y/2.0 - rgb.z/4.0
|
||||
);
|
||||
}
|
||||
|
||||
vec3 color_YCoCgToLinear(vec3 ycocg) {
|
||||
// R = Y + Co - Cg
|
||||
// G = Y + Cg
|
||||
// B = Y - Co - Cg
|
||||
return clamp(vec3(
|
||||
ycocg.x + ycocg.y - ycocg.z,
|
||||
ycocg.x + ycocg.z,
|
||||
ycocg.x - ycocg.y - ycocg.z
|
||||
), vec3(0.0), vec3(1.0));
|
||||
}
|
||||
|
||||
<@func declareColorWheel()@>
|
||||
|
|
|
@ -17,7 +17,7 @@ out vec4 _color;
|
|||
|
||||
void main(void) {
|
||||
// pass along the color
|
||||
_color = colorToLinearRGBA(inColor.rgba);
|
||||
_color = color_sRGBAToLinear(inColor.rgba);
|
||||
|
||||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
|
|
|
@ -27,7 +27,7 @@ out vec4 _position;
|
|||
out vec3 _normal;
|
||||
|
||||
void main(void) {
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
_alpha = inColor.w;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -28,7 +28,7 @@ out vec3 _normal;
|
|||
out vec3 _color;
|
||||
|
||||
void main(void) {
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
_alpha = inColor.w;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -28,7 +28,7 @@ out vec3 _color;
|
|||
|
||||
void main(void) {
|
||||
// pass along the color in linear space
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
|
||||
// and the texture coordinates
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -29,7 +29,7 @@ out vec4 _worldPosition;
|
|||
|
||||
void main(void) {
|
||||
// pass along the color in linear space
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
|
||||
// and the texture coordinates
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -29,7 +29,7 @@ out vec3 _color;
|
|||
|
||||
void main(void) {
|
||||
// pass along the color in linear space
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
<$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord0)$>
|
||||
|
|
|
@ -30,7 +30,7 @@ out vec4 _worldPosition;
|
|||
|
||||
void main(void) {
|
||||
// pass along the color in linear space
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
<$evalTexMapArrayTexcoord0(texMapArray, inTexCoord0, _texCoord0)$>
|
||||
|
|
|
@ -30,7 +30,7 @@ out float _alpha;
|
|||
|
||||
void main(void) {
|
||||
// pass along the color
|
||||
_color = colorToLinearRGB(inColor.rgb);
|
||||
_color = color_sRGBToLinear(inColor.rgb);
|
||||
_alpha = inColor.a;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -31,7 +31,7 @@ out float _alpha;
|
|||
|
||||
void main(void) {
|
||||
// pass along the color
|
||||
_color = colorToLinearRGB(inColor.rgb);
|
||||
_color = color_sRGBToLinear(inColor.rgb);
|
||||
_alpha = inColor.a;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -23,7 +23,7 @@ out vec4 _position;
|
|||
out vec3 _normal;
|
||||
|
||||
void main(void) {
|
||||
_color = colorToLinearRGB(inColor.xyz);
|
||||
_color = color_sRGBToLinear(inColor.xyz);
|
||||
_alpha = inColor.w;
|
||||
|
||||
_texCoord0 = inTexCoord0.st;
|
||||
|
|
|
@ -25,7 +25,7 @@ out vec2 _texCoord0;
|
|||
out vec4 _position;
|
||||
|
||||
void main(void) {
|
||||
_color = colorToLinearRGBA(inColor);
|
||||
_color = color_sRGBAToLinear(inColor);
|
||||
_texCoord0 = inTexCoord0.st;
|
||||
_position = inPosition;
|
||||
_modelNormal = inNormal.xyz;
|
||||
|
|
|
@ -29,7 +29,7 @@ out vec4 _position;
|
|||
out vec4 _worldPosition;
|
||||
|
||||
void main(void) {
|
||||
_color = colorToLinearRGBA(inColor);
|
||||
_color = color_sRGBAToLinear(inColor);
|
||||
_texCoord0 = inTexCoord0.st;
|
||||
_position = inPosition;
|
||||
_modelNormal = inNormal.xyz;
|
||||
|
|
|
@ -25,6 +25,6 @@ in vec2 _texCoord0;
|
|||
|
||||
void main(void) {
|
||||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
packDeferredFragmentUnlit(normalize(_normal), 1.0, _color.rgb * texel.rgb);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0);
|
||||
float colorAlpha = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
colorAlpha = -_color.a;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0);
|
||||
float colorAlpha = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
colorAlpha = -_color.a;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float colorAlpha = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
colorAlpha = -_color.a;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float colorAlpha = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
colorAlpha = -_color.a;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float opacity = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
opacity = -_color.a;
|
||||
}
|
||||
opacity *= texel.a;
|
||||
|
|
|
@ -46,7 +46,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float opacity = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
opacity = -_color.a;
|
||||
}
|
||||
opacity *= texel.a;
|
||||
|
|
|
@ -29,7 +29,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float colorAlpha = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
colorAlpha = -_color.a;
|
||||
}
|
||||
_fragColor0 = vec4(_color.rgb * texel.rgb, colorAlpha * texel.a);
|
||||
|
|
|
@ -40,7 +40,7 @@ void main(void) {
|
|||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
float colorAlpha = _color.a;
|
||||
if (_color.a <= 0.0) {
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
colorAlpha = -_color.a;
|
||||
}
|
||||
_fragColor0 = vec4(_color.rgb * texel.rgb+fadeEmissive, colorAlpha * texel.a);
|
||||
|
|
|
@ -25,7 +25,7 @@ in vec2 _texCoord0;
|
|||
|
||||
void main(void) {
|
||||
vec4 texel = texture(originalTexture, _texCoord0.st);
|
||||
texel = colorToLinearRGBA(texel);
|
||||
texel = color_sRGBAToLinear(texel);
|
||||
packDeferredFragmentTranslucent(
|
||||
normalize(_normal),
|
||||
_color.a,
|
||||
|
|
|
@ -36,7 +36,7 @@ void main(void) {
|
|||
skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, position, interpolatedNormal);
|
||||
|
||||
// pass along the color
|
||||
_color = colorToLinearRGB(inColor.rgb);
|
||||
_color = color_sRGBToLinear(inColor.rgb);
|
||||
_alpha = inColor.a;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -37,7 +37,7 @@ void main(void) {
|
|||
skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, position, interpolatedNormal);
|
||||
|
||||
// pass along the color
|
||||
_color = colorToLinearRGB(inColor.rgb);
|
||||
_color = color_sRGBToLinear(inColor.rgb);
|
||||
_alpha = inColor.a;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -38,7 +38,7 @@ void main(void) {
|
|||
skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, inTangent.xyz, position, interpolatedNormal.xyz, interpolatedTangent.xyz);
|
||||
|
||||
// pass along the color
|
||||
_color = colorToLinearRGB(inColor.rgb);
|
||||
_color = color_sRGBToLinear(inColor.rgb);
|
||||
_alpha = inColor.a;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -39,7 +39,7 @@ void main(void) {
|
|||
skinPositionNormalTangent(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, inTangent.xyz, position, interpolatedNormal.xyz, interpolatedTangent.xyz);
|
||||
|
||||
// pass along the color
|
||||
_color = colorToLinearRGB(inColor.rgb);
|
||||
_color = color_sRGBToLinear(inColor.rgb);
|
||||
_alpha = inColor.a;
|
||||
|
||||
TexMapArray texMapArray = getTexMapArray();
|
||||
|
|
|
@ -24,7 +24,7 @@ out vec4 varColor;
|
|||
|
||||
void main(void) {
|
||||
varTexCoord0 = inTexCoord0.st;
|
||||
varColor = colorToLinearRGBA(inColor);
|
||||
varColor = color_sRGBAToLinear(inColor);
|
||||
|
||||
// standard transform
|
||||
TransformCamera cam = getTransformCamera();
|
||||
|
|
|
@ -21,19 +21,15 @@ layout(location = 0) out vec4 outFragColor;
|
|||
void main() {
|
||||
|
||||
vec3 fragUV = taa_findClosestFragment3x3(varTexCoord0);
|
||||
vec3 sourceColor = texture(sourceMap, fragUV.xy).xyz;
|
||||
vec2 fragVel = taa_fetchVelocityMap(fragUV.xy);
|
||||
|
||||
vec2 pixVelocity = texture(velocityMap, fragUV.xy).xy;
|
||||
vec2 velocity = params.motionScale * pixVelocity;
|
||||
vec2 prevTexCoord = varTexCoord0 - velocity;
|
||||
|
||||
vec3 historyColor = sourceColor;
|
||||
|
||||
if (!(any(lessThan(prevTexCoord, vec2(0.0))) || any(greaterThan(prevTexCoord, vec2(1.0))))) {
|
||||
historyColor = texture(historyMap, prevTexCoord).xyz;
|
||||
}
|
||||
vec3 sourceColor;
|
||||
vec3 historyColor;
|
||||
//vec3 nextColor = taa_temporalReprojection(fragUV.xy, fragVel, fragUV.z);
|
||||
vec2 prevFragUV = taa_fetchSourceAndHistory(fragUV.xy, fragVel, sourceColor, historyColor);
|
||||
|
||||
vec3 nextColor = mix(historyColor, sourceColor, params.blend);
|
||||
|
||||
|
||||
outFragColor = vec4(nextColor, 1.0);
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
<@include DeferredTransform.slh@>
|
||||
<$declareDeferredFrameTransform()$>
|
||||
|
||||
<@include gpu/Color.slh@>
|
||||
|
||||
uniform sampler2D depthMap;
|
||||
uniform sampler2D sourceMap;
|
||||
uniform sampler2D historyMap;
|
||||
|
@ -41,10 +43,59 @@ float taa_getDebugOrbZoom() {
|
|||
return params.pixelInfo_orbZoom.z;
|
||||
}
|
||||
|
||||
vec4 taa_fetchColor(sampler2D map, vec2 uv) {
|
||||
#if USE_YCOCG
|
||||
vec4 c = texture(map, uv);
|
||||
return vec4(color_LinearToYCoCg(c.rgb), c.a);
|
||||
#else
|
||||
return texture(map, uv);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec3 taa_resolveColor(vec3 color) {
|
||||
#if USE_YCOCG
|
||||
return color_YCoCgToLinear(color);
|
||||
#else
|
||||
return color;
|
||||
#endif
|
||||
}
|
||||
|
||||
vec4 taa_fetchSourceMap(vec2 uv) {
|
||||
#if USE_YCOCG
|
||||
vec4 c = texture(sourceMap, uv);
|
||||
return vec4(color_LinearToYCoCg(c.rgb), c.a);
|
||||
#else
|
||||
return texture(sourceMap, uv);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec4 taa_fetchHistoryMap(vec2 uv) {
|
||||
#if USE_YCOCG
|
||||
vec4 c = texture(historyMap, uv);
|
||||
return vec4(color_LinearToYCoCg(c.rgb), c.a);
|
||||
#else
|
||||
return texture(historyMap, uv);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec4 taa_fetchNextMap(vec2 uv) {
|
||||
#if USE_YCOCG
|
||||
vec4 c = texture(nextMap, uv);
|
||||
return vec4(color_LinearToYCoCg(c.rgb), c.a);
|
||||
#else
|
||||
return texture(nextMap, uv);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec2 taa_fetchVelocityMap(vec2 uv) {
|
||||
return params.motionScale * texture(velocityMap, uv).xy;
|
||||
}
|
||||
|
||||
float taa_fetchDepth(vec2 uv) {
|
||||
return texture(depthMap, vec2(uv), 0).x;
|
||||
}
|
||||
|
||||
|
||||
#define ZCMP_GT(a, b) (a < b)
|
||||
|
||||
vec3 taa_findClosestFragment3x3(vec2 uv)
|
||||
|
@ -80,8 +131,88 @@ vec3 taa_findClosestFragment3x3(vec2 uv)
|
|||
return vec3(uv + dd.xy * dmin.xy, dmin.z);
|
||||
}
|
||||
|
||||
vec2 taa_fetchSourceAndHistory(vec2 fragUV, vec2 fragVelocity, out vec3 sourceColor, out vec3 historyColor) {
|
||||
sourceColor = taa_fetchSourceMap(fragUV).xyz;
|
||||
vec2 prevFragUV = fragUV - fragVelocity;
|
||||
historyColor = sourceColor;
|
||||
if (!(any(lessThan(prevFragUV, vec2(0.0))) || any(greaterThan(prevFragUV, vec2(1.0))))) {
|
||||
historyColor = taa_fetchHistoryMap(prevFragUV).xyz;
|
||||
}
|
||||
return prevFragUV;
|
||||
}
|
||||
|
||||
vec3 taa_temporalReprojection(vec2 fragUV, vec2 fragVelocity, float fragZe)
|
||||
{
|
||||
vec3 sourceColor;
|
||||
vec3 historyColor;
|
||||
vec2 prevFragUV = taa_fetchSourceAndHistory(fragUV, fragVelocity, sourceColor, historyColor);
|
||||
|
||||
vec3 nextColor = mix(historyColor, sourceColor, params.blend);
|
||||
|
||||
return taa_resolveColor(nextColor);
|
||||
|
||||
/*
|
||||
const float _SubpixelThreshold = 0.5;
|
||||
const float _GatherBase = 0.5;
|
||||
const float _GatherSubpixelMotion = 0.1666;
|
||||
|
||||
float2 texel_vel = ss_vel / _MainTex_TexelSize.xy;
|
||||
float texel_vel_mag = length(texel_vel) * fragZe;
|
||||
float k_subpixel_motion = saturate(_SubpixelThreshold / (FLT_EPS + texel_vel_mag));
|
||||
float k_min_max_support = _GatherBase + _GatherSubpixelMotion * k_subpixel_motion;
|
||||
|
||||
float2 ss_offset01 = k_min_max_support * float2(-_MainTex_TexelSize.x, _MainTex_TexelSize.y);
|
||||
float2 ss_offset11 = k_min_max_support * float2(_MainTex_TexelSize.x, _MainTex_TexelSize.y);
|
||||
float4 c00 = taa_fetchSourceMap(uv - ss_offset11);
|
||||
float4 c10 = taa_fetchSourceMap(uv - ss_offset01);
|
||||
float4 c01 = taa_fetchSourceMap(uv + ss_offset01);
|
||||
float4 c11 = taa_fetchSourceMap(uv + ss_offset11);
|
||||
|
||||
float4 cmin = min(c00, min(c10, min(c01, c11)));
|
||||
float4 cmax = max(c00, max(c10, max(c01, c11)));
|
||||
|
||||
#if USE_YCOCG || USE_CLIPPING
|
||||
float4 cavg = (c00 + c10 + c01 + c11) / 4.0;
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error "missing keyword MINMAX_..."
|
||||
#endif
|
||||
|
||||
// shrink chroma min-max
|
||||
#if USE_YCOCG
|
||||
float2 chroma_extent = 0.25 * 0.5 * (cmax.r - cmin.r);
|
||||
float2 chroma_center = texel0.gb;
|
||||
cmin.yz = chroma_center - chroma_extent;
|
||||
cmax.yz = chroma_center + chroma_extent;
|
||||
cavg.yz = chroma_center;
|
||||
#endif
|
||||
|
||||
// clamp to neighbourhood of current sample
|
||||
#if USE_CLIPPING
|
||||
texel1 = clip_aabb(cmin.xyz, cmax.xyz, clamp(cavg, cmin, cmax), texel1);
|
||||
#else
|
||||
texel1 = clamp(texel1, cmin, cmax);
|
||||
#endif
|
||||
|
||||
// feedback weight from unbiased luminance diff (t.lottes)
|
||||
#if USE_YCOCG
|
||||
float lum0 = texel0.r;
|
||||
float lum1 = texel1.r;
|
||||
#else
|
||||
float lum0 = Luminance(texel0.rgb);
|
||||
float lum1 = Luminance(texel1.rgb);
|
||||
#endif
|
||||
float unbiased_diff = abs(lum0 - lum1) / max(lum0, max(lum1, 0.2));
|
||||
float unbiased_weight = 1.0 - unbiased_diff;
|
||||
float unbiased_weight_sqr = unbiased_weight * unbiased_weight;
|
||||
float k_feedback = lerp(_FeedbackMin, _FeedbackMax, unbiased_weight_sqr);
|
||||
|
||||
// output
|
||||
return lerp(texel0, texel1, k_feedback);
|
||||
*/
|
||||
}
|
||||
|
||||
<@include gpu/Color.slh@>
|
||||
<$declareColorWheel()$>
|
||||
|
||||
vec3 taa_getVelocityColorRelative(float velocityPixLength) {
|
||||
|
|
|
@ -66,7 +66,7 @@ void main(void) {
|
|||
vec2 nextOrbPosToPix = pixPos - nextOrbPos;
|
||||
float nextOrbPosToPixLength = length(nextOrbPosToPix);
|
||||
|
||||
vec2 prevOrbPos = nextOrbPos + cursorVelocityDir * 2.0 * tenPercentHeight;
|
||||
vec2 prevOrbPos = nextOrbPos - cursorVelocityDir * 2.0 * tenPercentHeight;
|
||||
vec2 prevOrbPosToPix = pixPos - prevOrbPos;
|
||||
float prevOrbPosToPixLength = length(prevOrbPosToPix);
|
||||
|
||||
|
|
|
@ -1,99 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
//
|
||||
// gemstoneMagicMaker.js
|
||||
// tablet-sample-app
|
||||
//
|
||||
// Created by Faye Li on Feb 6 2017.
|
||||
// Copyright 2017 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
(function() {
|
||||
var TABLET_BUTTON_NAME = "LUCI";
|
||||
var QMLAPP_URL = Script.resolvePath("../antialiasing.qml");
|
||||
|
||||
|
||||
var onLuciScreen = false;
|
||||
|
||||
function onClicked() {
|
||||
if (onLuciScreen) {
|
||||
tablet.gotoHomeScreen();
|
||||
} else {
|
||||
tablet.loadQMLSource(QMLAPP_URL);
|
||||
}
|
||||
}
|
||||
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var button = tablet.addButton({
|
||||
text: TABLET_BUTTON_NAME,
|
||||
sortOrder: 1
|
||||
});
|
||||
|
||||
var hasEventBridge = false;
|
||||
|
||||
function wireEventBridge(on) {
|
||||
if (!tablet) {
|
||||
print("Warning in wireEventBridge(): 'tablet' undefined!");
|
||||
return;
|
||||
}
|
||||
if (on) {
|
||||
if (!hasEventBridge) {
|
||||
tablet.fromQml.connect(fromQml);
|
||||
hasEventBridge = true;
|
||||
}
|
||||
} else {
|
||||
if (hasEventBridge) {
|
||||
tablet.fromQml.disconnect(fromQml);
|
||||
hasEventBridge = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onScreenChanged(type, url) {
|
||||
if (url === QMLAPP_URL) {
|
||||
onLuciScreen = true;
|
||||
} else {
|
||||
onLuciScreen = false;
|
||||
}
|
||||
|
||||
button.editProperties({isActive: onLuciScreen});
|
||||
wireEventBridge(onLuciScreen);
|
||||
}
|
||||
|
||||
function fromQml(message) {
|
||||
}
|
||||
|
||||
button.clicked.connect(onClicked);
|
||||
tablet.screenChanged.connect(onScreenChanged);
|
||||
|
||||
var moveDebugCursor = false;
|
||||
Controller.mousePressEvent.connect(function (e) {
|
||||
if (e.isMiddleButton) {
|
||||
moveDebugCursor = true;
|
||||
setDebugCursor(e.x, e.y);
|
||||
}
|
||||
});
|
||||
Controller.mouseReleaseEvent.connect(function() { moveDebugCursor = false; });
|
||||
Controller.mouseMoveEvent.connect(function (e) { if (moveDebugCursor) setDebugCursor(e.x, e.y); });
|
||||
|
||||
|
||||
Script.scriptEnding.connect(function () {
|
||||
if (onLuciScreen) {
|
||||
tablet.gotoHomeScreen();
|
||||
}
|
||||
button.clicked.disconnect(onClicked);
|
||||
tablet.screenChanged.disconnect(onScreenChanged);
|
||||
tablet.removeButton(button);
|
||||
});
|
||||
|
||||
function setDebugCursor(x, y) {
|
||||
nx = (x / Window.innerWidth);
|
||||
ny = 1.0 - ((y) / (Window.innerHeight - 32));
|
||||
|
||||
Render.getConfig("RenderMainView").getConfig("Antialiasing").debugCursorTexcoord = { x: nx, y: ny };
|
||||
}
|
||||
|
||||
}());
|
|
@ -12,6 +12,7 @@ import QtQuick.Controls 1.4
|
|||
import "configSlider"
|
||||
|
||||
Column {
|
||||
id: root
|
||||
spacing: 8
|
||||
property var mainViewTask: Render.getConfig("RenderMainView")
|
||||
|
||||
|
|
Loading…
Reference in a new issue