[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56356] trunk/blender/intern/opencolorio/ ocio_impl_glsl.cc: This glsl shader works for OCIO with alpha.

Ton Roosendaal ton at blender.org
Sun Apr 28 12:46:19 CEST 2013


Revision: 56356
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56356
Author:   ton
Date:     2013-04-28 10:46:18 +0000 (Sun, 28 Apr 2013)
Log Message:
-----------
This glsl shader works for OCIO with alpha. OSX iMac with ATI.

There's no logical reason I can find... but I commit it because many others have
the same error, so we can check.

Modified Paths:
--------------
    trunk/blender/intern/opencolorio/ocio_impl_glsl.cc

Modified: trunk/blender/intern/opencolorio/ocio_impl_glsl.cc
===================================================================
--- trunk/blender/intern/opencolorio/ocio_impl_glsl.cc	2013-04-28 09:47:11 UTC (rev 56355)
+++ trunk/blender/intern/opencolorio/ocio_impl_glsl.cc	2013-04-28 10:46:18 UTC (rev 56356)
@@ -92,19 +92,16 @@
 "void main()\n"
 "{\n"
 "    vec4 col = texture2D(tex1, gl_TexCoord[0].st);\n"
-"    if (predivide == false || col[3] == 1.0 || col[3] == 0.0) {\n"
-"      gl_FragColor = OCIODisplay(col, tex2);\n"
-"    } else {\n"
-"      float alpha = col[3];\n"
-"      float inv_alpha = 1.0 / alpha;\n"
+"    float inv_alpha = 1.0;"
+"    if (predivide == false || col[3] <= 0.0 || col[3] >= 1.0) {\n"
+"        float inv_alpha = 1.0 / col[3];\n"
+"}\n"
+"    col[0] *= inv_alpha;\n"
+"    col[1] *= inv_alpha;\n"
+"    col[2] *= inv_alpha;\n"
 "\n"
-"      col[0] *= inv_alpha;\n"
-"      col[1] *= inv_alpha;\n"
-"      col[2] *= inv_alpha;\n"
+"    gl_FragColor = OCIODisplay(col, tex2);\n"
 "\n"
-"      gl_FragColor = OCIODisplay(col, tex2);\n"
-"    }\n"
-"\n"
 "}\n";
 
 static GLuint compileShaderText(GLenum shaderType, const char *text)




More information about the Bf-blender-cvs mailing list