diff --git a/libraries/render-utils/src/model_translucent_unlit.slf b/libraries/render-utils/src/model_translucent_unlit.slf new file mode 100644 index 0000000000..c982d68d64 --- /dev/null +++ b/libraries/render-utils/src/model_translucent_unlit.slf @@ -0,0 +1,46 @@ +<@include gpu/Config.slh@> +<$VERSION_HEADER$> +// Generated on <$_SCRIBE_DATE$> +// +// model_translucent_unlit.frag +// fragment shader +// +// Created by Zach Pomerantz on 2/3/2016. +// Copyright 2016 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 model/Material.slh@> + +<@include MaterialTextures.slh@> +<$declareMaterialTextures(ALBEDO, ROUGHNESS, _SCRIBE_NULL, _SCRIBE_NULL, EMISSIVE, OCCLUSION)$> + +in vec2 _texCoord0; +in vec3 _color; +in float _alpha; + +out vec4 _fragColor; + +void main(void) { + Material mat = getMaterial(); + int matKey = getMaterialKey(mat); + <$fetchMaterialTextures(matKey, _texCoord0, albedoTex, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL, _SCRIBE_NULL)$> + + float opacity = getMaterialOpacity(mat) * _alpha; + <$evalMaterialOpacity(albedoTex.a, opacity, matKey, opacity)&>; + <$discardTransparent(opacity)$>; + + vec3 albedo = getMaterialAlbedo(mat); + <$evalMaterialAlbedo(albedoTex, albedo, matKey, albedo)$>; + albedo *= _color; + + vec4 albedo = texture(albedoMap, _texCoord0); + + Material mat = getMaterial(); + vec3 fragColor = getMaterialAlbedo(mat) * albedo.rgb * _color; + float fragOpacity = getMaterialOpacity(mat) * albedo.a * _alpha; + + _fragColor = vec4(fragColor, fragOpacity); +} diff --git a/libraries/render-utils/src/overlay3D_translucent_unlit.slf b/libraries/render-utils/src/overlay3D_translucent_unlit.slf new file mode 100644 index 0000000000..18a26d0790 --- /dev/null +++ b/libraries/render-utils/src/overlay3D_translucent_unlit.slf @@ -0,0 +1,27 @@ +<@include gpu/Config.slh@> +<$VERSION_HEADER$> +// Generated on <$_SCRIBE_DATE$> +// +// overlay3D_translucent_unlit.frag +// fragment shader +// +// Created by Zach Pomerantz on 2/2/2016. +// Copyright 2016 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 +// + +uniform sampler2D originalTexture; + +in vec2 _texCoord0; +in vec3 _color; +in float _alpha; + +out vec4 _fragColor; + +void main(void) { + vec4 albedo = texture(originalTexture, _texCoord0); + + _fragColor = vec4(albedo.rgb * _color, albedo.a * _alpha); +} diff --git a/libraries/render-utils/src/overlay3D_unlit.slf b/libraries/render-utils/src/overlay3D_unlit.slf new file mode 100644 index 0000000000..42e51bdc25 --- /dev/null +++ b/libraries/render-utils/src/overlay3D_unlit.slf @@ -0,0 +1,32 @@ +<@include gpu/Config.slh@> +<$VERSION_HEADER$> +// Generated on <$_SCRIBE_DATE$> +// +// overlay3D_unlit.frag +// fragment shader +// +// Created by Zach Pomerantz on 2/2/2016. +// Copyright 2016 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 +// + +uniform sampler2D originalTexture; + +in vec2 _texCoord0; +in vec3 _color; + +out vec4 _fragColor; + +void main(void) { + vec4 albedo = texture(originalTexture, _texCoord0); + + if (albedo.a <= 0.1) { + discard; + } + vec4 color = vec4(albedo.rgb * _color, albedo.a); + + // Apply standard tone mapping + _fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w); +}