Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- varying vec3 o;
- varying mat4 p;
- void main(void) {
- p=gl_ModelViewMatrix;
- o=vec3(gl_Vertex.xy,.99);
- gl_Position=vec4(o,1.);
- }
- uniform sampler3D t;
- varying vec3 o;
- varying mat4 p;
- vec3 e(vec3 s, int i) {
- float n=1.;
- s*=2.;
- vec3 r=vec3(0.);
- for(;i>0;i--) {
- r+=texture3D(t,s).xyz*n;
- n*=0.7;s*=1.93;
- }
- return r;
- }
- void main(void){
- vec3 d=normalize(o*vec3(1.,.6,1.));
- vec3 r=vec3(0.,0.,8.*p[0][1]-8.);
- float s=sin(p[0][3]*9.42);
- float c=cos(p[0][3]*9.42);
- r.xz=r.xz*mat2(c,-s,s,c);
- d.xz=d.xz*mat2(c,-s,s,c);
- s=sin(p[0][2]*9.42);c=cos(p[0][2]*9.42);
- r.yz=r.yz*mat2(c,-s,s,c);
- d.yz=d.yz*mat2(c,-s,s,c);
- vec3 l=vec3(0.,0.,0.);
- float m=0.;
- vec3 w=vec3(.016,.012,.009)*p[1][0];
- while(length(r)<15.&&m<0.95) {
- float i=min(length(r+vec3(0.,9.,0.))-8.2+20.*p[2][1],max(abs(r.y)-1.1-p[1][3]*20.,abs(length(r.xz)-2.+2.*p[1][2])*(.5+p[2][0])-2.*p[1][2]+1.2));
- vec3 n=r;n.y-=p[0][0]*.66;
- vec3 c=e(n*0.03,2)*.04*p[1][1];
- n.y=n.y*(.05+p[1][1])-.5*p[0][0];
- float v=e(c+n*.08,6).r;
- i-=.5*v;
- l+=w;
- m+=.003;
- float t=(1.-m)*clamp(1.-exp(i),0.,1.);
- float f=smoothstep(-2.5,-1.5,-length(r)+v*6.*(p[2][1]+1.));
- l+=(mix(vec3(.7,.2,.0),vec3(.1,.45,.85),f)*clamp(abs(f-.5),-0.5,1.)+clamp(r.y+v.x-2.*p[1][3]-1.,.0,100.))*t;
- m+=t;
- r+=d*max(.02,(i)*.5);
- }
- l+=(1.-m)*mix(vec3(.0,.1,.2),vec3(.0,.0,.1),normalize(r).y);
- gl_FragColor=vec4(l-.3,1.);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement