Skip to content
TheChatArchiveThe Chat Archive
Metallama-3.3-70b-instruct· MetaHugging Face LMArena Human Preference 140K

create a shadertoy shader of a yellow emoji with a smiley face that rotates with signed…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with chatgpt-4o-latest-20250326’s answer.
  1. User

    create a shadertoy shader of a yellow emoji with a smiley face that rotates with signed distance fields

  2. Meta Assistant

    Here's a simple example of a Shadertoy shader that renders a yellow smiley face using signed distance fields (SDFs) and rotates it over time.

    // Shadertoy uniforms
    uniform vec2 iResolution; // Viewport resolution
    uniform float iTime;      // Current time in seconds
    
    // Signed distance field for a circle
    float circleSDF(vec2 p, vec2 center, float radius) {
        return length(p - center) - radius;
    }
    
    // Signed distance field for a smiley face
    float smileySDF(vec2 p) {
        // Face
        float face = circleSDF(p, vec2(0.0), 0.4);
        
        // Left eye
        float leftEye = circleSDF(p, vec2(-0.2, 0.2), 0.05);
        
        // Right eye
        float rightEye = circleSDF(p, vec2(0.2, 0.2), 0.05);
        
        // Smile
        float smile = length(p - vec2(0.0, -0.2)) - 0.3;
        smile = max(smile, -circleSDF(p, vec2(0.0, -0.2), 0.3));
        
        // Combine SDFs using union operation
        return min(face, min(leftEye, min(rightEye, smile)));
    }
    
    void mainImage(out vec4 fragColor, in vec2 fragCoord) {
        // Normalize pixel coordinates
        vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
        
        // Rotate the UV coordinates over time
        float angle = iTime;
        uv = vec2(
            uv.x * cos(angle) - uv.y * sin(angle),
            uv.x * sin(angle) + uv.y * cos(angle)
        );
        
        // Evaluate the SDF
        float d = smileySDF(uv);
        
        // Color the pixel based on the SDF value
        vec3 col = vec3(1.0, 1.0, 0.0); // Yellow
        if (d < 0.0) {
            // Inside the shape
            col = vec3(1.0, 1.0, 0.0); // Yellow
        } else if (d < 0.01) {
            // Edge of the shape
            col = vec3(0.0, 0.0, 0.0); // Black
        } else {
            // Outside the shape
            col = vec3(0.0); // Black
        }
        
        // Output to screen
        fragColor = vec4(col, 1.0);
    }
    

    This shader uses the following techniques:

    1. Signed Distance Fields (SDFs): SDFs are used to represent the shape of the smiley face. The smileySDF function returns the signed distance from a given point to the surface of the shape.
    2. Union Operation: The SDFs for the face, eyes, and smile are combined using the union operation, which returns the minimum distance to any of the shapes.
    3. Rotation: The UV coordinates are rotated over time using a simple rotation matrix, creating the illusion of the smiley face rotating.
    4. Coloring: The pixel color is determined based on the SDF value. If the point is inside the shape, it's colored yellow. If it's on the edge of the shape, it's colored black. Otherwise, it's colored black.

    You can copy and paste this code into a Shadertoy shader to see the rotating smiley face in action.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.