mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-14 06:16:44 +02:00
48 lines
No EOL
1.4 KiB
Text
48 lines
No EOL
1.4 KiB
Text
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// simple_transparent_textured_unlit_fade.frag
|
|
// fragment shader
|
|
//
|
|
// Created by Olivier Prat on 06/05/17.
|
|
// 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
|
|
//
|
|
|
|
<@include gpu/Color.slh@>
|
|
|
|
<@include Fade.slh@>
|
|
|
|
<@include render-utils/ShaderConstants.h@>
|
|
|
|
// the albedo texture
|
|
LAYOUT(binding=0) uniform sampler2D originalTexture;
|
|
|
|
layout(location=RENDER_UTILS_ATTR_COLOR) in vec4 _color;
|
|
layout(location=RENDER_UTILS_ATTR_TEXCOORD01) in vec4 _texCoord01;
|
|
#define _texCoord0 _texCoord01.xy
|
|
#define _texCoord1 _texCoord01.zw
|
|
layout(location=RENDER_UTILS_ATTR_POSITION_WS) in vec4 _positionWS;
|
|
|
|
layout(location=0) out vec4 _fragColor0;
|
|
|
|
// Declare after all samplers to prevent sampler location mix up with originalTexture
|
|
<$declareFadeFragmentInstanced()$>
|
|
|
|
void main(void) {
|
|
vec3 fadeEmissive;
|
|
FadeObjectParams fadeParams;
|
|
|
|
<$fetchFadeObjectParamsInstanced(fadeParams)$>
|
|
applyFade(fadeParams, _positionWS.xyz, fadeEmissive);
|
|
|
|
vec4 texel = texture(originalTexture, _texCoord0);
|
|
texel = mix(texel, color_sRGBAToLinear(texel), float(_color.a <= 0.0));
|
|
texel.rgb *= _color.rgb;
|
|
texel.a *= abs(_color.a);
|
|
|
|
_fragColor0 = vec4(texel.rgb + fadeEmissive, texel.a);
|
|
} |