daily pastebin goal
10%
SHARE
TWEET

fragmentarium ocean shader

a guest Feb 6th, 2012 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float FOV = 0.4;
  2. vec3 Eye = vec3(33.7331,-8.49179,2.31636);
  3. vec3 Target = vec3(39.0618,-14.7221,-2.22206);
  4. vec3 Up = vec3(0,1,0);//vec3(0.376281,-0.313292,0.871889);
  5. int AntiAlias = 1;
  6. float Detail = -3.53094;
  7. float DetailAO = -0.001f;//-0.00707;
  8. float FudgeFactor = 0.4f;//0.6747;
  9. int MaxRaySteps = 256;
  10. float BoundingSphere = 83.019;
  11. float Dither = 1.0f;//0.41228;
  12. vec4 AO = vec4(0.0,0.0,0.0,0.93827);
  13. float Specular = 3.5443;
  14. float SpecularExp = 14.545;
  15. vec4 SpotLight = vec4(1.0f, 1.0f, 0.796078, 0.64706);
  16. vec2 SpotLightDir = vec2(-0.71874,-0.25);
  17. vec4 CamLight = vec4(1,0.960784,0.921569,1.3077);
  18. float CamLightMin = 0.28102;
  19. vec4 Glow = vec4(1,1,1,0);
  20. float Fog = 0.19f;//0.2963;
  21. float HardShadow = 0.63077;
  22. float Reflection = 1.0;
  23. vec3 BaseColor = vec3(1,1,1);
  24. float OrbitStrength = 0.81818;
  25. vec4 X = vec4(0.5,0.6,0.6,1);
  26. vec4 Y = vec4(1,0.6,0,0.48092);
  27. vec4 Z = vec4(0.8,0.78,1,0.26718);
  28. vec4 R = vec4(0.666667,0.666667,0.498039,0.58462);
  29. vec3 BackgroundColor = vec3(0.917647,0.843137,0.564706);
  30. int GradientBackground = 0;
  31. bool CycleColors = false;
  32. float Cycles = 1.29269;
  33. bool EnableFloor = false;
  34. vec3 FloorNormal = vec3(0,0,0);
  35. int FloorHeight = 0;
  36. vec3 FloorColor = vec3(1,1,1);
  37. int NormalBackStep = 1;
  38. int GlowMax = 10;
  39. float ShadowSoft = 2.258;
  40. int Iterations = 6;
  41. int S = 1;
  42. float Slope = -0.06195;
  43. float FreqMul = 2.45458;
  44. float Offset = 0.8122 + 0.25*time;
  45. float AmpMul = 0.32075;
  46. float WaterLevel = 10.48864;
  47. float ClarityPower = 1.0;
  48. vec2 coord = vec2(0.0);
  49. bool fastNormal = false;
  50.  
  51. //////////////////////////////////////////////////////////////////////////////////////////////
  52. //////////////////////////////////////////////////////////////////////////////////////////////
  53. //////////////////////////////////////////////////////////////////////////////////////////////
  54.  
  55.         if (EnableFloor && dist ==floorDist*FudgeFactor) floorHit = true;
  56.        
  57.         vec3 hitColor;
  58.         float stepFactor = clamp((float(fSteps))/float(GlowMax),0.0,1.0);
  59.  
  60.  
  61.         vec3 backColor = BackgroundColor;
  62.         ///////////////////////////////////////////////////
  63.         //SkyColor
  64.                 vec3 viewerF = normalize(-direction.xyz);
  65.  
  66.                 float skydome_radius = 1.0f;
  67.  
  68.                 vec3 zenith_color = vec3(10.0f, 10.0f, 106.0f)/vec3(255.0f);
  69.                 vec3 horizon_color = vec3(79.0f, 121.0f, 205.0f)/vec3(255.0f);
  70.  
  71.                 float height_factor = pow( 1.0 - ( direction.y ) / skydome_radius, 6.75 );
  72.                 vec3 sky_color = mix( zenith_color, horizon_color, clamp( height_factor, 0.0, 1.0 ) );
  73.                 backColor = sky_color;
  74.         ////////////////////////////////////////////////////
  75.        
  76.         if (GradientBackground>0.0) {
  77.                 float t = length(coord);
  78.                 backColor = mix(backColor, vec3(0.0,0.0,0.0), t*GradientBackground);
  79.         }
  80.        
  81.         if (  steps==MaxRaySteps) orbitTrap = vec4(0.0);
  82.  
  83.  
  84. //////////////////////////////////////////////////////////////////////////////////////////////
  85. //////////////////////////////////////////////////////////////////////////////////////////////
  86. //////////////////////////////////////////////////////////////////////////////////////////////
  87.  
  88.         vec3 zenith_color = vec3(10.0f, 10.0f, 106.0f)/vec3(255.0f);
  89.         vec3 horizon_color = vec3(79.0f, 121.0f, 205.0f)/vec3(255.0f);
  90.  
  91.         Color = vec4(multicast, 1.0f);
  92.  
  93.         vec3 color = vec3(0.0,0.0,0.0);
  94.         for (int x = 0; x<AntiAlias; x++) {
  95.                 float  dx = float(x)/float(AntiAlias);
  96.                 for (int y = 0; y<AntiAlias; y++) {
  97.                         float dy = float(y)/float(AntiAlias);
  98.                         vec3 nDir = rd;//dir+dirDx*dx+dirDy*dy;
  99.                         vec3 hitNormal = vec3(0.0);
  100.                         vec3 hit;
  101.                         vec3 c = trace(ro,nDir,hit,hitNormal);
  102.                         if (Reflection>0.0 && (hit != vec3(0))) {
  103.                                 vec3 d; vec3 d2 = vec3(0.0);
  104.                                 // todo: minDist = modifiedEps?
  105.                                 vec3 r = normalize(nDir - 2.0 * dot(hitNormal, nDir) * hitNormal);
  106.        
  107.                                 //Just reflect the sky color instead of marching again.
  108.                                 //vec3 c2 = trace(hit+4.0*r*minDist,r,d,d2);
  109.                                 float height_factor = pow( 1.0 - ( r.y ) / skydome_radius, 6.75 );
  110.                                 vec3 sky_color = mix( zenith_color, horizon_color, clamp( height_factor, 0.0, 1.0 ) );
  111.  
  112.                                 color += c+sky_color*Reflection;
  113.                         } else {
  114.                                 color += c;
  115.                         }                      
  116.  
  117.                 }
  118.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top