Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. float3 vPos =extractViewPos( float2 texCoord) ;
  2.  
  3. float3 vNor = vNormal;
  4. float2 rotTexCoord = { TexCords.x * TextureSize.x / 4.0f, TexCords.y * TextureSize.y / 4.0f };
  5. float3 plane =vNor;
  6. float att = 0.0f;
  7. for ( int i = 0; i < 12; ++i ) {
  8. float2 sampleTex;
  9. if ( vPos.z < minDist ) {
  10. sampleTex = TexCords + ( radius * reflect( float3( rndTable[ i ], 0.0f ), plane ).xy ) / ( minDist * 2.0f );
  11. } else {
  12. sampleTex = TexCords + ( radius * reflect( float3( rndTable[ i ], 0.0f ), plane ).xy ) / ( vPos.z * 2.0f );
  13. }
  14.  
  15. float3 vRay = extractViewPos(sampleTex).xyz;
  16. float3 vRayVec = vRay - vPos;
  17. float dist = length( vRayVec );
  18. vRayVec /= dist;
  19. float normAtten = saturate( dot( vRayVec, vNor ) * creaseScale - minCrease );
  20. float rangleAtten = saturate( ( distScale - dist ) / distScale );
  21. att += normAtten * rangleAtten; //
  22. }
  23. //const float res = saturate( pow( ( 1.0f - att / 12.0f ) * 1.0f, 1.0f ) );
  24. float result = 1.0f - att / 12.0f;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement