Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float3 vPos =extractViewPos( float2 texCoord) ;
- float3 vNor = vNormal;
- float2 rotTexCoord = { TexCords.x * TextureSize.x / 4.0f, TexCords.y * TextureSize.y / 4.0f };
- float3 plane =vNor;
- float att = 0.0f;
- for ( int i = 0; i < 12; ++i ) {
- float2 sampleTex;
- if ( vPos.z < minDist ) {
- sampleTex = TexCords + ( radius * reflect( float3( rndTable[ i ], 0.0f ), plane ).xy ) / ( minDist * 2.0f );
- } else {
- sampleTex = TexCords + ( radius * reflect( float3( rndTable[ i ], 0.0f ), plane ).xy ) / ( vPos.z * 2.0f );
- }
- float3 vRay = extractViewPos(sampleTex).xyz;
- float3 vRayVec = vRay - vPos;
- float dist = length( vRayVec );
- vRayVec /= dist;
- float normAtten = saturate( dot( vRayVec, vNor ) * creaseScale - minCrease );
- float rangleAtten = saturate( ( distScale - dist ) / distScale );
- att += normAtten * rangleAtten; //
- }
- //const float res = saturate( pow( ( 1.0f - att / 12.0f ) * 1.0f, 1.0f ) );
- float result = 1.0f - att / 12.0f;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement