Show
Ignore:
Timestamp:
12/04/09 10:57:08 (5 years ago)
Author:
robert
Message:

From Mathieu Marache, "I replaced the Vec4 by a float and used only the x component of the shadow2DProj . This works on my apple box."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgShadow/SoftShadowMap.cpp

    r10699 r10852  
    6363    "  vec4 smCoord  = sceneShadowProj; \n" 
    6464    "  vec3 jitterCoord = vec3( gl_FragCoord.xy / osgShadow_jitteringScale, 0.0 ); \n" 
    65     "  vec4 shadow = vec4(0.0, 0.0, 0.0, 0.0); \n" 
     65    "  float shadow = 0.0; \n" 
    6666// First "cheap" sample test 
    6767    "  const float pass_div = 1.0 / (2.0 * 4.0); \n" 
     
    7373 
    7474    "    smCoord.xy = sceneShadowProj.xy  + (offset.xy) * softFactor; \n" 
    75     "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) * pass_div; \n" 
     75    "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x * pass_div; \n" 
    7676 
    7777    "    smCoord.xy = sceneShadowProj.xy  + (offset.zw) * softFactor; \n" 
    78     "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) *pass_div; \n" 
     78    "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x *pass_div; \n" 
    7979    "  } \n" 
    8080// skip all the expensive shadow sampling if not needed 
     
    8787 
    8888    "      smCoord.xy = sceneShadowProj.xy  + offset.xy * softFactor; \n" 
    89     "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) * INV_SAMPLECOUNT; \n" 
     89    "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x * INV_SAMPLECOUNT; \n" 
    9090 
    9191    "      smCoord.xy = sceneShadowProj.xy  + offset.zw * softFactor; \n" 
    92     "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) * INV_SAMPLECOUNT; \n" 
     92    "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x * INV_SAMPLECOUNT; \n" 
    9393    "    } \n" 
    9494    "  } \n" 
     
    123123    "  vec4 smCoord  = sceneShadowProj; \n" 
    124124    "  vec3 jitterCoord = vec3( gl_FragCoord.xy / osgShadow_jitteringScale, 0.0 ); \n" 
    125     "  vec4 shadow = vec4(0.0, 0.0, 0.0, 0.0); \n" 
     125    "  float shadow = 0.0; \n" 
    126126// First "cheap" sample test 
    127127    "  const float pass_div = 1.0 / (2.0 * 4.0); \n" 
     
    133133 
    134134    "    smCoord.xy = sceneShadowProj.xy  + (offset.xy) * softFactor; \n" 
    135     "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) * pass_div; \n" 
     135    "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x * pass_div; \n" 
    136136 
    137137    "    smCoord.xy = sceneShadowProj.xy  + (offset.zw) * softFactor; \n" 
    138     "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) *pass_div; \n" 
     138    "    shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x *pass_div; \n" 
    139139    "  } \n" 
    140140// skip all the expensive shadow sampling if not needed 
     
    147147 
    148148    "      smCoord.xy = sceneShadowProj.xy  + offset.xy * softFactor; \n" 
    149     "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) * INV_SAMPLECOUNT; \n" 
     149    "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x * INV_SAMPLECOUNT; \n" 
    150150 
    151151    "      smCoord.xy = sceneShadowProj.xy  + offset.zw * softFactor; \n" 
    152     "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ) * INV_SAMPLECOUNT; \n" 
     152    "      shadow +=  shadow2DProj( osgShadow_shadowTexture, smCoord ).x * INV_SAMPLECOUNT; \n" 
    153153    "    } \n" 
    154154    "  } \n"