NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#define PI 3.14159265359

// Rotation matrix for the cube
mat3 rotationMatrix(vec3 axis, float angle) {
axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;
return mat3(
oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c
);
}

// Smooth min function for soft edges
float smin(float a, float b, float k) {
float h = clamp(0.5 + 0.5 * (b - a) / k, 0.0, 1.0);
return mix(b, a, h) - k * h * (1.0 - h);
}

// SDF for the cube
float sdCube(vec3 p, float s) {
vec3 d = abs(p) - vec3(s);
return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0));
}

// Color palette function
vec3 palette(float t) {
vec3 a = vec3(0.5, 0.5, 0.5);
vec3 b = vec3(0.5, 0.5, 0.5);
vec3 c = vec3(1.0, 1.0, 1.0);
vec3 d = vec3(0.263, 0.416, 0.557);
return a + b * cos(6.28318 * (c * t + d));
}

// Main distance function
float map(vec3 p, float time) {
// Apply rotation
p *= rotationMatrix(normalize(vec3(1.0, 1.0, 1.0)), time * 0.2);

// Apply breathing effect
float breathe = sin(time * 0.5) * 0.05 + 1.0;
p /= breathe;

// Apply subtle distortion
p += 0.05 * sin(p * 5.0 + time);

return sdCube(p, 1.0);
}

// Normal calculation
vec3 calcNormal(vec3 p, float time) {
const float h = 0.0001;
const vec2 k = vec2(1, -1);
return normalize(
k.xyy * map(p + k.xyy * h, time) +
k.yyx * map(p + k.yyx * h, time) +
k.yxy * map(p + k.yxy * h, time) +
k.xxx * map(p + k.xxx * h, time)
);
}

// Ray marching function
float rayMarch(vec3 ro, vec3 rd, float time) {
float t = 0.0;
for (int i = 0; i < 100; i++) {
vec3 p = ro + rd * t;
float d = map(p, time);
if (d < 0.001 || t > 20.0) break;
t += d * 0.5;
}
return t;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
vec2 mouse = iMouse.xy / iResolution.xy;

// Camera setup
vec3 ro = vec3(0.0, 0.0, 5.0);
vec3 rd = normalize(vec3(uv, -1.5));

// Apply user interaction
float interactionStrength = smoothstep(0.0, 0.1, length(mouse));
float timeOffset = interactionStrength * 10.0 * (mouse.x - 0.5);
float time = iTime + timeOffset;

// Ray marching
float t = rayMarch(ro, rd, time);

// Shading
if (t < 20.0) {
vec3 p = ro + rd * t;
vec3 normal = calcNormal(p, time);

// Interior color
vec3 interiorColor = palette(length(p) * 0.1 + time * 0.1);

// Fresnel effect for transparency
float fresnel = pow(1.0 - abs(dot(normal, rd)), 2.0);

// Final color
vec3 color = mix(interiorColor, vec3(1.0), fresnel);

// Add glow
color += vec3(0.1, 0.2, 0.3) * (1.0 - fresnel) * 0.5;

fragColor = vec4(color, 1.0);
} else {
fragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.