Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "#define ETA(SPECTRUM_PART) (1.0/(ior+abbe*SPECTRUM_PART))\n"
- "#define N 30\n"
- "vec3 samples = vec3(0);\n"
- "vec3 total = vec3(0);\n"
- "for (int i=0;i<N;++i) {\n"
- " float part = float(i)/float(N);\n"
- " float H = part * 300.0;\n" //Not not using all of the hues
- " vec3 mask = HSL_to_RGB(H);\n"
- " samples += mask * get_cubemap_refract(texCube_1,vec_norm_wld,ETA(part)).rgb;\n"
- " total += mask;\n"
- "}\n"
- "vec4 sample_refract = vec4(samples/total,1.0);\n"
- "vec3 HSL_to_RGB(float H) {\n" //S==L==1
- " #define C 1\n"
- " float Hp = H / 60.0;\n"
- " float X = C*(1.0 - abs(mod(Hp,2.0)-1.0));\n"
- " if (Hp>=0.0 && Hp<1.0) return vec3(C,X,0);\n"
- " if (Hp>=1.0 && Hp<2.0) return vec3(X,C,0);\n"
- " if (Hp>=2.0 && Hp<3.0) return vec3(0,C,X);\n"
- " if (Hp>=3.0 && Hp<4.0) return vec3(0,X,C);\n"
- " if (Hp>=4.0 && Hp<5.0) return vec3(X,0,C);\n"
- " return vec3(C,0,X);\n"
- "}\n"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement