Merge pull request #7706 from zzmp/fix/text3d-font

Fix text3d to allow transparent text
This commit is contained in:
Brad Hefta-Gaub 2016-04-19 07:50:36 -07:00
commit c41b320d40
2 changed files with 7 additions and 11 deletions

View file

@ -46,6 +46,7 @@ const float DEFAULT_METALLIC = 0;
const vec3 DEFAULT_SPECULAR = vec3(0.1); const vec3 DEFAULT_SPECULAR = vec3(0.1);
const vec3 DEFAULT_EMISSIVE = vec3(0.0); const vec3 DEFAULT_EMISSIVE = vec3(0.0);
const float DEFAULT_OCCLUSION = 1.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) { void packDeferredFragment(vec3 normal, float alpha, vec3 albedo, float roughness, float metallic, vec3 emissive, float occlusion) {

View file

@ -41,20 +41,15 @@ void main() {
float w = clamp( s, 0.0, 0.5); float w = clamp( s, 0.0, 0.5);
float a = smoothstep(0.5 - w, 0.5 + w, sdf); float a = smoothstep(0.5 - w, 0.5 + w, sdf);
// gamma correction for linear attenuation
a = pow(a, 1.0 / gamma);
// discard if unvisible // discard if unvisible
if (a < 0.01) { if (a < 0.01) {
discard; discard;
} }
packDeferredFragmentLightmap( packDeferredFragmentTranslucent(
normalize(_normal), normalize(_normal),
1.0, a,
vec3(1.0), Color.rgb,
DEFAULT_ROUGHNESS, DEFAULT_FRESNEL,
DEFAULT_METALLIC, DEFAULT_ROUGHNESS);
DEFAULT_SPECULAR,
Color.rgb);
} }