Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // by IQ
- // just another march, this time to accumulate the difference
- // between points across the normal (i.e. little means dark means occluded)
- // requires a fair bit of fucking around to make this look good
- float calcAO( in vec3 pos, in vec3 nor, in float strength)
- {
- float occ = 0.0;
- float sca = 1.0;
- for( int i=0; i<16; i++ )
- {
- float h = 0.001 + strength*float(i)/4.0;
- float d = fScene( pos + h*nor );
- occ += (h-d)*sca;
- sca *= 0.95;
- }
- return clamp( 1.0 - 1.5*occ /* was 1.5 */, 0.0, 1.0 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement