mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-23 13:49:23 +02:00
73 lines
No EOL
1.7 KiB
Text
73 lines
No EOL
1.7 KiB
Text
<@include gpu/Config.slh@>
|
|
<$VERSION_HEADER$>
|
|
// Generated on <$_SCRIBE_DATE$>
|
|
//
|
|
// simple_transparent_textured_fade.slf
|
|
// 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 DeferredBufferWrite.slh@>
|
|
<@include DeferredGlobalLight.slh@>
|
|
<$declareEvalGlobalLightingAlphaBlendedWithHaze()$>
|
|
|
|
<@include gpu/Transform.slh@>
|
|
<$declareStandardCameraTransform()$>
|
|
|
|
<@include Fade.slh@>
|
|
|
|
// the albedo texture
|
|
uniform sampler2D originalTexture;
|
|
|
|
in vec4 _positionES;
|
|
in vec3 _normalWS;
|
|
in vec4 _color;
|
|
in vec2 _texCoord0;
|
|
in vec4 _positionWS;
|
|
|
|
// 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.st);
|
|
float opacity = _color.a;
|
|
if (_color.a <= 0.0) {
|
|
texel = color_sRGBAToLinear(texel);
|
|
opacity = -_color.a;
|
|
}
|
|
opacity *= texel.a;
|
|
vec3 albedo = _color.rgb * texel.rgb;
|
|
|
|
vec3 fragPosition = _positionES.xyz;
|
|
vec3 fragNormal = normalize(_normalWS);
|
|
|
|
TransformCamera cam = getTransformCamera();
|
|
|
|
_fragColor0 = vec4(evalGlobalLightingAlphaBlendedWithHaze(
|
|
cam._viewInverse,
|
|
1.0,
|
|
1.0,
|
|
fragPosition,
|
|
fragNormal,
|
|
albedo,
|
|
DEFAULT_FRESNEL,
|
|
0.0f,
|
|
fadeEmissive,
|
|
DEFAULT_ROUGHNESS,
|
|
opacity),
|
|
opacity);
|
|
|
|
} |