From ecf091e171012831cddea59f1f64a46e87ee8c4f Mon Sep 17 00:00:00 2001 From: ztenghui Date: Tue, 17 Feb 2015 13:26:10 -0800 Subject: Update the shadow fall off function from cosine to gaussian. Also tune the parameters to match a better look designed by UX team. For ambient part, the acos transformed alpha is not needed any more. b/19370798 Change-Id: I20d2615d1be502eb900942ed756aecd1660dee48 --- libs/hwui/ProgramCache.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libs/hwui/ProgramCache.cpp') diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp index e9b22e20bc18..41adda15f367 100644 --- a/libs/hwui/ProgramCache.cpp +++ b/libs/hwui/ProgramCache.cpp @@ -240,8 +240,9 @@ const char* gFS_Main_ModulateColor = const char* gFS_Main_ApplyVertexAlphaLinearInterp = " fragColor *= alpha;\n"; const char* gFS_Main_ApplyVertexAlphaShadowInterp = - " fragColor *= (1.0 - cos(alpha)) / 2.0;\n"; - + // Use a gaussian function for the shadow fall off. Note that alpha here + // is actually (1.0 - alpha) for saving computation. + " fragColor *= exp(- alpha * alpha * 4.0) - 0.018;\n"; const char* gFS_Main_FetchTexture[2] = { // Don't modulate " fragColor = texture2D(baseSampler, outTexCoords);\n", -- cgit v1.2.3