From 2d9dcc85953523b173564643a2dd042c085f97bb Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Mon, 18 Apr 2016 16:02:45 -0700 Subject: [PATCH] Fix text3d to allow transparent text --- .../render-utils/src/DeferredBufferWrite.slh | 1 + libraries/render-utils/src/sdf_text3D.slf | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/libraries/render-utils/src/DeferredBufferWrite.slh b/libraries/render-utils/src/DeferredBufferWrite.slh index 2a2c2883d3..24a2f0d8a5 100755 --- a/libraries/render-utils/src/DeferredBufferWrite.slh +++ b/libraries/render-utils/src/DeferredBufferWrite.slh @@ -46,6 +46,7 @@ const float DEFAULT_METALLIC = 0; const vec3 DEFAULT_SPECULAR = vec3(0.1); const vec3 DEFAULT_EMISSIVE = vec3(0.0); const float DEFAULT_OCCLUSION = 1.0; +const vec3 DEFAULT_FRESNEL = DEFAULT_EMISSIVE; void packDeferredFragment(vec3 normal, float alpha, vec3 albedo, float roughness, float metallic, vec3 emissive, float occlusion) { diff --git a/libraries/render-utils/src/sdf_text3D.slf b/libraries/render-utils/src/sdf_text3D.slf index 854221a5cf..f5385c23b7 100644 --- a/libraries/render-utils/src/sdf_text3D.slf +++ b/libraries/render-utils/src/sdf_text3D.slf @@ -41,20 +41,15 @@ void main() { float w = clamp( s, 0.0, 0.5); float a = smoothstep(0.5 - w, 0.5 + w, sdf); - // gamma correction for linear attenuation - a = pow(a, 1.0 / gamma); - // discard if unvisible if (a < 0.01) { discard; } - packDeferredFragmentLightmap( - normalize(_normal), - 1.0, - vec3(1.0), - DEFAULT_ROUGHNESS, - DEFAULT_METALLIC, - DEFAULT_SPECULAR, - Color.rgb); + packDeferredFragmentTranslucent( + normalize(_normal), + a, + Color.rgb, + DEFAULT_FRESNEL, + DEFAULT_ROUGHNESS); } \ No newline at end of file