/*{
"CATEGORIES": [
"Automatically Converted",
"Shadertoy"
],
"DESCRIPTION": "Automatically converted from https://www.shadertoy.com/view/tsdSzn by jaszunio15. Many thanks to pik33. I was inspired by his shader: \nhttps://www.shadertoy.com/view/wdcSzr",
"IMPORTED": {},
"INPUTS": [],
"PASSES": [
{},
{}
]
}*/#defineTIMESCALE1.0//Uncoment if you have better PC//#define HIGH_QUALITY//Display parameters#ifdefHIGH_QUALITY #defineSTRENGTH0.7#defineLAYERS_COUNT200.0#defineLAYERS_DISTANCE0.00225#defineCOLOR_MULTIPLIER0.05#defineNOISE_SHARPNESS0.9#defineVOLUMETRIC_CUT_WIDTH0.01#defineDISTORTION_POW1.3#defineDISTORTION_SPEED0.4#defineDISTORTION_BASE_ITERATION8.0#defineDISTORTION_ITERATIONS20.0#defineFOG_DISTANCE17.0#else#defineSTRENGTH0.7#defineLAYERS_COUNT45.0#defineLAYERS_DISTANCE0.0095#defineCOLOR_MULTIPLIER0.074#defineNOISE_SHARPNESS1.0#defineVOLUMETRIC_CUT_WIDTH0.05#defineDISTORTION_POW1.3#defineDISTORTION_SPEED0.4#defineDISTORTION_BASE_ITERATION8.0#defineDISTORTION_ITERATIONS15.0#defineFOG_DISTANCE17.0#endif//Misc#defineTIME(TIME * TIMESCALE)//Useful functionsfloathash12(vec2 x){returnfract(sin(dot(x,vec2(342.243,234.4281)))*235.2412);}floathash11(float x){returnfract(sin(x *342.243)*235.2412);}floatnoise12(vec2 uv){vec2 rootUV =floor(uv);vec2 fractUV =smoothstep(0.0,1.0,fract(uv));float v00 =hash12(rootUV +vec2(0.0,0.0));float v01 =hash12(rootUV +vec2(0.0,1.0));float v10 =hash12(rootUV +vec2(1.0,0.0));float v11 =hash12(rootUV +vec2(1.0,1.0));float v0 =mix(v00, v01, fractUV.y);float v1 =mix(v10, v11, fractUV.y);returnpow(mix(v0, v1, fractUV.x), NOISE_SHARPNESS);}/*
Many thanks to pik33. I was inspired by his shader:
https://www.shadertoy.com/view/wdcSzr
I reused his idea to distort space using only sine functions, but I made it as a 3D volumetric plane.
You can switch to HIGH_QUALITY mode in the common tab :)
Preview generated at 11.88 s.
1.01 - add HIGH QUALITY
1.02 - add balanced HIGH_QUALITY and vignette
1.03 - lower flight
*/vec3colorFromUV(vec2 uv,float shift){return0.7+0.3*cos(TIME *0.2+ uv.xyx *0.1+vec3(0,2,4)+pow(shift,4.0));//XD}vec3fancyLayer(vec2 uv,float cut){
uv *=0.1;for(float i = DISTORTION_BASE_ITERATION; i <= DISTORTION_BASE_ITERATION + DISTORTION_ITERATIONS; i++){
uv.x += STRENGTH *sin(uv.y *pow(DISTORTION_POW, i)+ TIME * DISTORTION_SPEED + i *0.18)/pow(DISTORTION_POW, i);
uv.y += STRENGTH *sin(uv.x *pow(DISTORTION_POW, i)+ TIME * DISTORTION_SPEED + i *0.21)/pow(DISTORTION_POW, i);}float fancyness =noise12(uv *10.0+ TIME *0.1*5.0);float noise =noise12(uv *2.0+ TIME *0.5+21.0);vec3 col =colorFromUV(uv, noise);returnsmoothstep(cut - VOLUMETRIC_CUT_WIDTH, cut + VOLUMETRIC_CUT_WIDTH, fancyness)*(2.0+ fancyness)/3.0* col;}vec3uvToCastPlane(vec2 uv){returnvec3(uv.x, uv.y,-1.0+sin(TIME *0.2)*0.2);}//xy - plane uv//z - distance to plane pointvec3rayCastPlane(vec3 rayOrigin,vec3 rayDirection,float planeHeight){
rayDirection /= rayDirection.y;float distanceToPlane =abs(rayOrigin.y - planeHeight);
rayDirection *= distanceToPlane;returnvec3(rayOrigin.xz + rayDirection.xz,length(rayDirection));}voidmain(){if(PASSINDEX ==0){}elseif(PASSINDEX ==1){vec2 uv =(2.0* gl_FragCoord.xy - RENDERSIZE.xy)/ RENDERSIZE.x;//Camera rotation and positionvec3 angle =vec3(-0.42+cos(TIME *0.3)*0.08,sin(TIME *0.2)*0.5,cos(TIME *0.21)*0.1);mat3x3 rotationMatrix =mat3x3(cos(angle.z),-sin(angle.z),0.0,sin(angle.z),cos(angle.z),0.0,0.0,0.0,1.0)*mat3x3(1.0,0.0,0.0,0.0,cos(angle.x),-sin(angle.x),0.0,sin(angle.x),cos(angle.x))*mat3x3(cos(angle.y),0.0,-sin(angle.y),0.0,1.0,0.0,sin(angle.y),0.0,cos(angle.y));vec3 cameraShift =vec3(0.0,sin(TIME *0.24)*0.12-0.36, TIME *1.3);//Creating rayvec3 rayOrigin =vec3(0.0,0.0,0.0)+ cameraShift;vec3 castPoint =uvToCastPlane(uv)* rotationMatrix + cameraShift;vec3 rayDirection = castPoint - rayOrigin;//Raycast vase plane to get fogvec3 planeUV =rayCastPlane(rayOrigin, rayDirection,-0.5);float fog =0.0;if(rayDirection.y >0.0) fog =1.0;else fog =sqrt(smoothstep(-0.1, FOG_DISTANCE,distance(cameraShift.xz, planeUV.xy)));//ambient lightingvec3 backgroundColor =colorFromUV(rayOrigin.xz,0.0)*0.3*smoothstep(0.14,0.0,abs(rayDirection.y -0.02));//Adding many planes with small height differencies to create volumentric effectvec3 col =vec3(0.0)+colorFromUV(rayOrigin.xz,0.0)*0.2;for(float i =1.0; i <= LAYERS_COUNT ; i++){
planeUV =rayCastPlane(rayOrigin, rayDirection,-0.5- i * LAYERS_DISTANCE -hash12(planeUV.xy)* LAYERS_DISTANCE);
col +=fancyLayer(planeUV.xy,1.1-pow(i / LAYERS_COUNT,2.0))* COLOR_MULTIPLIER *pow(0.99, i);}//Mixing volumetric plane, fog and ambient lighting with some postprocessingfloat vignette =smoothstep(2.5,0.4,length(uv));
col =smoothstep(-0.0,1.1, col *(1.0- fog)+ backgroundColor * fog)* vignette;//Output to screen
gl_FragColor =vec4(col,1.0);}}
Upgrade Your Visual Performances
Join and get updates on new plugins and offerings. Your email is encrypted and never shared.