Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium-2505· Mistral AIHugging Face LMArena Human Preference 140K

Create a static 3D pergola scene using three.js. Use these imports: <script…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with o4-mini-2025-04-16’s answer.
  1. User

    Create a static 3D pergola scene using three.js.

    Use these imports:

    All dimensions are in feet. Y-axis is up.

    Scene Setup:

    1. Ground: grassy plain
    2. Lighting: ambient light and directional light
    3. Material: wood for all pergola parts
    4. Camera: Position for a good overview

    Pergola Dimensions & Components (Actual lumber dimensions in feet):

    • Post dimensions (nominal 4x4): width/depth = 3.5/12, height = 8.0.
    • Main Beam dimensions (nominal 2x8): thickness (Z-axis for beam along X) = 1.5/12, height (Y-axis) = 7.25/12. Overhang = 1.5.
    • Rafter dimensions (nominal 2x4): thickness (X-axis for rafter along Z) = 1.5/12, height (Y-axis) = 3.5/12. Overhang = 1.5.
    • Purlin dimensions (nominal 2x2): width/height/depth = 1.5/12.

    Construction:

    1. Posts (4 count):

      • Calculate position so as to create a 9ft (X) by 6ft (Z) rectangle.
    2. Main Beams (2 count):

      • Calculate position so as to ride on top of posts
      • Total Length: 9.0 (post span) + 2 * 1.5 (overhangs) = 12.0.
      • Height: 7.25/12. Thickness: 1.5/12. Overhang: 1.5.
      • Cut a tapered relief on the bottom face of each 1.5 overhang, reducing the lumber height to 35% of original by the end of each overhang to create an upward sweep profile, keeping the top face flat.
    3. Rafters (7 count):

      • Calculate positions so as to ride on top of main beams, with end rafters aligning with the ends of the main beam ends.
      • Spacing: Distribute 7 rafters evenly along the 12.0 ft X-length of main beams
      • Total Length: 6.0 (main beam span based on post Z-centers) + 2 * 1.5 (overhangs) = 9.0.
      • Height: 3.5/12. Thickness: 1.5/12. Overhang: 1.5.
      • Cut a tapered relief on the bottom face of each 1.5 overhang, reducing the lumber height to 35% of original by the end of each overhang to create an upward sweep profile, keeping the top face flat.
    4. Purlins (7 count):

      • Calculate positions so as to ride on top of rafters, with end purlins aligning with the ends of the rafter ends.
      • Spacing: Distribute 7 purlins evenly along the 9.0 ft Z-length of rafters.
      • Dimensions: Length = 12.0. Height = 1.5/12. Depth = 1.5/12.

    Add OrbitControls for ease of viewing. It is optional to make the scene more pleasing by simple additions but avoid anything distracting from the main pergola design. Output as a single-file html three.js visualization of the pergola you have designed.

  2. Mistral Assistant

    Here's a complete HTML file with a static 3D pergola scene using Three.js:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>3D Pergola Visualization</title>
        <style>
            body {
                margin: 0;
                overflow: hidden;
                font-family: Arial, sans-serif;
            }
            canvas {
                display: block;
            }
            #info {
                position: absolute;
                top: 10px;
                left: 10px;
                color: white;
                background-color: rgba(0,0,0,0.5);
                padding: 10px;
                border-radius: 5px;
                font-size: 14px;
            }
        </style>
    </head>
    <body>
        <div id="info">
            3D Pergola Visualization<br>
            Dimensions in feet (Y-axis up)<br>
            Use mouse to orbit, scroll to zoom
        </div>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
        <script>
            // Scene setup
            const scene = new THREE.Scene();
            scene.background = new THREE.Color(0x87CEEB); // Sky blue background
    
            // Camera setup
            const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
            camera.position.set(15, 10, 15);
    
            // Renderer setup
            const renderer = new THREE.WebGLRenderer({ antialias: true });
            renderer.setSize(window.innerWidth, window.innerHeight);
            renderer.shadowMap.enabled = true;
            document.body.appendChild(renderer.domElement);
    
            // OrbitControls
            const controls = new THREE.OrbitControls(camera, renderer.domElement);
            controls.enableDamping = true;
            controls.dampingFactor = 0.05;
    
            // Lighting
            const ambientLight = new THREE.AmbientLight(0x404040, 0.5);
            scene.add(ambientLight);
    
            const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
            directionalLight.position.set(10, 20, 10);
            directionalLight.castShadow = true;
            directionalLight.shadow.mapSize.width = 2048;
            directionalLight.shadow.mapSize.height = 2048;
            scene.add(directionalLight);
    
            // Ground (grassy plain)
            const groundGeometry = new THREE.PlaneGeometry(50, 50);
            const groundMaterial = new THREE.MeshStandardMaterial({
                color: 0x3a5f0b,
                roughness: 0.8,
                metalness: 0.2
            });
            const ground = new THREE.Mesh(groundGeometry, groundMaterial);
            ground.rotation.x = -Math.PI / 2;
            ground.receiveShadow = true;
            scene.add(ground);
    
            // Wood material for pergola
            const woodMaterial = new THREE.MeshStandardMaterial({
                color: 0x8B4513,
                roughness: 0.7,
                metalness: 0.1
            });
    
            // Helper function to create tapered overhangs
            function createTaperedBox(width, height, depth, taperLength, taperRatio) {
                const shape = new THREE.Shape();
                const halfWidth = width / 2;
                const halfDepth = depth / 2;
    
                // Main box
                shape.moveTo(-halfWidth, -halfDepth);
                shape.lineTo(halfWidth, -halfDepth);
                shape.lineTo(halfWidth, halfDepth);
                shape.lineTo(-halfWidth, halfDepth);
                shape.lineTo(-halfWidth, -halfDepth);
    
                // Extrude with taper
                const extrudeSettings = {
                    steps: 1,
                    depth: height,
                    bevelEnabled: false,
                    extrudePath: new THREE.LineCurve3(
                        new THREE.Vector3(0, 0, 0),
                        new THREE.Vector3(0, 0, height)
                    )
                };
    
                // Create the geometry
                const geometry = new THREE.ExtrudeGeometry(shape, extrudeSettings);
    
                // Taper the overhangs
                const taperStart = height - taperLength;
                const positions = geometry.attributes.position;
    
                for (let i = 0; i < positions.count; i++) {
                    const z = positions.getZ(i);
                    if (z >= taperStart) {
                        const taperFactor = 1 - (z - taperStart) / taperLength * (1 - taperRatio);
                        const x = positions.getX(i);
                        const y = positions.getY(i);
    
                        positions.setX(i, x * taperFactor);
                        positions.setY(i, y * taperFactor);
                    }
                }
    
                return geometry;
            }
    
            // Create posts (4x4)
            const postWidth = 3.5 / 12;
            const postDepth = 3.5 / 12;
            const postHeight = 8.0;
    
            const postGeometry = new THREE.BoxGeometry(postWidth, postHeight, postDepth);
            const posts = [];
    
            // Post positions (9ft x 6ft rectangle)
            const postPositions = [
                { x: -4.5, z: -3.0 },
                { x: 4.5, z: -3.0 },
                { x: -4.5, z: 3.0 },
                { x: 4.5, z: 3.0 }
            ];
    
            for (const pos of postPositions) {
                const post = new THREE.Mesh(postGeometry, woodMaterial);
                post.position.set(pos.x, postHeight / 2, pos.z);
                post.castShadow = true;
                scene.add(post);
                posts.push(post);
            }
    
            // Create main beams (2x8 with tapered overhangs)
            const mainBeamThickness = 1.5 / 12;
            const mainBeamHeight = 7.25 / 12;
            const mainBeamLength = 12.0;
            const mainBeamOverhang = 1.5;
            const mainBeamTaperRatio = 0.35;
    
            const mainBeamGeometry = createTaperedBox(
                mainBeamLength,
                mainBeamThickness,
                mainBeamHeight,
                mainBeamOverhang,
                mainBeamTaperRatio
            );
    
            // Position main beams on top of posts
            const mainBeams = [];
            const mainBeamY = postHeight + mainBeamHeight / 2;
    
            for (let i = 0; i < 2; i++) {
                const beam = new THREE.Mesh(mainBeamGeometry, woodMaterial);
                beam.rotation.y = Math.PI / 2; // Rotate to span X-axis
                beam.position.set(0, mainBeamY, (i === 0 ? -3.0 : 3.0));
                beam.castShadow = true;
                scene.add(beam);
                mainBeams.push(beam);
            }
    
            // Create rafters (2x4 with tapered overhangs)
            const rafterThickness = 1.5 / 12;
            const rafterHeight = 3.5 / 12;
            const rafterLength = 9.0;
            const rafterOverhang = 1.5;
            const rafterTaperRatio = 0.35;
    
            const rafterGeometry = createTaperedBox(
                rafterLength,
                rafterThickness,
                rafterHeight,
                rafterOverhang,
                rafterTaperRatio
            );
    
            // Position rafters on top of main beams
            const rafterY = mainBeamY + mainBeamHeight / 2 + rafterHeight / 2;
            const rafterSpacing = mainBeamLength / (7 - 1); // 7 rafters
    
            for (let i = 0; i < 7; i++) {
                const rafter = new THREE.Mesh(rafterGeometry, woodMaterial);
                const xPos = -mainBeamLength / 2 + i * rafterSpacing;
                rafter.position.set(xPos, rafterY, 0);
                rafter.castShadow = true;
                scene.add(rafter);
            }
    
            // Create purlins (2x2)
            const purlinWidth = 1.5 / 12;
            const purlinHeight = 1.5 / 12;
            const purlinLength = 12.0;
    
            const purlinGeometry = new THREE.BoxGeometry(purlinLength, purlinWidth, purlinHeight);
    
            // Position purlins on top of rafters
            const purlinY = rafterY + rafterHeight / 2 + purlinWidth / 2;
            const purlinSpacing = rafterLength / (7 - 1); // 7 purlins
    
            for (let i = 0; i < 7; i++) {
                const purlin = new THREE.Mesh(purlinGeometry, woodMaterial);
                const zPos = -rafterLength / 2 + i * purlinSpacing;
                purlin.position.set(0, purlinY, zPos);
                purlin.castShadow = true;
                scene.add(purlin);
            }
    
            // Handle window resize
            window.addEventListener('resize', () => {
                camera.aspect = window.innerWidth / window.innerHeight;
                camera.updateProjectionMatrix();
                renderer.setSize(window.innerWidth, window.innerHeight);
            });
    
            // Animation loop
            function animate() {
                requestAnimationFrame(animate);
                controls.update();
                renderer.render(scene, camera);
            }
    
            animate();
        </script>
    </body>
    </html>
    

    This HTML file creates a complete 3D visualization of a pergola with:

    1. A grassy ground plane
    2. Proper lighting with ambient and directional lights
    3. Wood material for all pergola components
    4. Four posts arranged in a 9ft x 6ft rectangle
    5. Two main beams with tapered overhangs
    6. Seven rafters with tapered overhangs
    7. Seven purlins on top of the rafters
    8. OrbitControls for easy navigation

    The scene is properly scaled with all dimensions in feet (Y-axis up) as requested. The tapered overhangs on the main beams and rafters are implemented with a custom geometry function that creates the upward sweep profile while keeping the top face flat.

    You can save this code as an HTML file and open it in a modern browser to view the pergola. The controls allow you to orbit around the scene and zoom in/out for better viewing.

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