하나의 HTML 파일로 3D 메카 고질라 만들어
- User
하나의 HTML 파일로 3D 메카 고질라 만들어
Assistant
3D 메카 고질라를 HTML 파일 하나로 만들어드리겠습니다. Three.js를 사용해서 구현하겠습니다.
<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>3D 메카 고질라</title> <style> body { margin: 0; padding: 0; background: linear-gradient(to bottom, #001122, #003366); overflow: hidden; font-family: Arial, sans-serif; } #info { position: absolute; top: 10px; left: 10px; color: #00ff00; font-size: 14px; z-index: 100; text-shadow: 0 0 10px #00ff00; } #controls { position: absolute; bottom: 10px; left: 10px; color: #00ff00; font-size: 12px; z-index: 100; } </style> </head> <body> <div id="info"> <h3>🦖 메카 고질라 3D</h3> <p>로딩 중...</p> </div> <div id="controls"> <p>마우스: 회전 | 휠: 줌 | 스페이스바: 애니메이션</p> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script> <script> // 기본 설정 let scene, camera, renderer, mechaGodzilla; let isAnimating = false; let animationMixer; // 마우스 컨트롤 let mouseX = 0, mouseY = 0; let targetRotationX = 0, targetRotationY = 0; init(); animate(); function init() { // 씬 생성 scene = new THREE.Scene(); scene.fog = new THREE.Fog(0x001122, 50, 200); // 카메라 설정 camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); camera.position.set(0, 10, 30); // 렌더러 설정 renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); renderer.setClearColor(0x001122); renderer.shadowMap.enabled = true; renderer.shadowMap.type = THREE.PCFSoftShadowMap; document.body.appendChild(renderer.domElement); // 조명 설정 setupLights(); // 메카 고질라 생성 createMechaGodzilla(); // 환경 생성 createEnvironment(); // 이벤트 리스너 setupEventListeners(); // 정보 업데이트 document.querySelector('#info p').textContent = '준비 완료!'; } function setupLights() { // 주변광 const ambientLight = new THREE.AmbientLight(0x404040, 0.3); scene.add(ambientLight); // 주 조명 (파란색) const mainLight = new THREE.DirectionalLight(0x4488ff, 1); mainLight.position.set(10, 20, 10); mainLight.castShadow = true; mainLight.shadow.mapSize.width = 2048; mainLight.shadow.mapSize.height = 2048; scene.add(mainLight); // 보조 조명 (빨간색) const redLight = new THREE.PointLight(0xff4444, 0.8, 50); redLight.position.set(-10, 15, 5); scene.add(redLight); // 눈 조명 효과 const eyeLight1 = new THREE.PointLight(0xff0000, 2, 20); eyeLight1.position.set(2, 12, 8); scene.add(eyeLight1); const eyeLight2 = new THREE.PointLight(0xff0000, 2, 20); eyeLight2.position.set(-2, 12, 8); scene.add(eyeLight2); } function createMechaGodzilla() { mechaGodzilla = new THREE.Group(); // 몸통 const bodyGeometry = new THREE.CylinderGeometry(3, 4, 8, 8); const bodyMaterial = new THREE.MeshPhongMaterial({ color: 0x333333, shininess: 100, specular: 0x444444 }); const body = new THREE.Mesh(bodyGeometry, bodyMaterial); body.position.y = 4; body.castShadow = true; mechaGodzilla.add(body); // 머리 const headGeometry = new THREE.BoxGeometry(4, 3, 5); const headMaterial = new THREE.MeshPhongMaterial({ color: 0x444444, shininess: 100 }); const head = new THREE.Mesh(headGeometry, headMaterial); head.position.y = 10; head.castShadow = true; mechaGodzilla.add(head); // 눈 (빨간색 발광) const eyeGeometry = new THREE.SphereGeometry(0.3, 8, 8); const eyeMaterial = new THREE.MeshBasicMaterial({ color: 0xff0000, emissive: 0xff0000, emissiveIntensity: 0.5 }); const leftEye = new THREE.Mesh(eyeGeometry, eyeMaterial); leftEye.position.set(1, 10.5, 2); mechaGodzilla.add(leftEye); const rightEye = new THREE.Mesh(eyeGeometry, eyeMaterial); rightEye.position.set(-1, 10.5, 2); mechaGodzilla.add(rightEye); // 팔 const armGeometry = new THREE.CylinderGeometry(0.8, 1, 6, 8); const armMaterial = new THREE.MeshPhongMaterial({ color: 0x555555 }); const leftArm = new THREE.Mesh(armGeometry, armMaterial); leftArm.position.set(4, 5, 0); leftArm.rotation.z = Math.PI / 6; leftArm.castShadow = true; mechaGodzilla.add(leftArm); const rightArm = new THREE.Mesh(armGeometry, armMaterial); rightArm.position.set(-4, 5, 0); rightArm.rotation.z = -Math.PI / 6; rightArm.castShadow = true; mechaGodzilla.add(rightArm); // 다리 const legGeometry = new THREE.CylinderGeometry(1, 1.5, 8, 8); const legMaterial = new THREE.MeshPhongMaterial({ color: 0x666666 }); const leftLeg = new THREE.Mesh(legGeometry, legMaterial); leftLeg.position.set(1.5, -4, 0); leftLeg.castShadow = true; mechaGodzilla.add(leftLeg); const rightLeg = new THREE.Mesh(legGeometry, legMaterial); rightLeg.position.set(-1.5, -4, 0); rightLeg.castShadow = true; mechaGodzilla.add(rightLeg); // 꼬리 const tailGeometry = new THREE.ConeGeometry(1, 12, 8); const tailMaterial = new THREE.MeshPhongMaterial({ color: 0x444444 }); const tail = new THREE.Mesh(tailGeometry, tailMaterial); tail.position.set(0, 2, -8); tail.rotation.x = Math.PI / 4; tail.castShadow = true; mechaGodzilla.add(tail); // 등 가시 (메카닉 스타일) for (let i = 0; i < 5; i++) { const spikeGeometry = new THREE.ConeGeometry(0.5, 2, 4); const spikeMaterial = new THREE.MeshPhongMaterial({ color: 0x666666, shininess: 100 }); const spike = new THREE.Mesh(spikeGeometry, spikeMaterial); spike.position.set(0, 6 + i * 0.5, -1 - i * 0.8); spike.rotation.x = Math.PI / 8; spike.castShadow = true; mechaGodzilla.add(spike); } // 메카닉 디테일 추가 addMechanicDetails(); scene.add(mechaGodzilla); } function addMechanicDetails() { // 가슴 패널 const chestPanelGeometry = new THREE.BoxGeometry(2, 1, 0.2); const chestPanelMaterial = new THREE.MeshPhongMaterial({ color: 0x00ff00, emissive: 0x004400, emissiveIntensity: 0.3 }); const chestPanel = new THREE.Mesh(chestPanelGeometry, chestPanelMaterial); chestPanel.position.set(0, 5, 3); mechaGodzilla.add(chestPanel); // 어깨 장갑 const shoulderGeometry = new THREE.SphereGeometry(1.5, 8, 8); const shoulderMaterial = new THREE.MeshPhongMaterial({ color: 0x777777 }); const leftShoulder = new THREE.Mesh(shoulderGeometry, shoulderMaterial); leftShoulder.position.set(3, 7, 0); leftShoulder.scale.set(1, 0.7, 1); mechaGodzilla.add(leftShoulder); const rightShoulder = new THREE.Mesh(shoulderGeometry, shoulderMaterial); rightShoulder.position.set(-3, 7, 0); rightShoulder.scale.set(1, 0.7, 1); mechaGodzilla.add(rightShoulder); } function createEnvironment() { // 바닥 const floorGeometry = new THREE.PlaneGeometry(100, 100); const floorMaterial = new THREE.MeshLambertMaterial({ color: 0x222222 }); const floor = new THREE.Mesh(floorGeometry, floorMaterial); floor.rotation.x = -Math.PI / 2; floor.position.y = -8; floor.receiveShadow = true; scene.add(floor); // 파티클 효과 (별) createStars(); } function createStars() { const starGeometry = new THREE.BufferGeometry(); const starMaterial = new THREE.PointsMaterial({ color: 0xffffff, size: 2, sizeAttenuation: false }); const starVertices = []; for (let i = 0; i < 1000; i++) { const x = (Math.random() - 0.5) * 200; const y = Math.random() * 100 + 20; const z = (Math.random() - 0.5) * 200; starVertices.push(x, y, z); } starGeometry.setAttribute('position', new THREE.Float32BufferAttribute(starVertices, 3)); const stars = new THREE.Points(starGeometry, starMaterial); scene.add(stars); } function setupEventListeners() { // 마우스 이벤트 document.addEventListener('mousemove', onMouseMove, false); document.addEventListener('wheel', onMouseWheel, false); // 키보드 이벤트 document.addEventListener('keydown', onKeyDown, false); // 윈도우 리사이즈 window.addEventListener('resize', onWindowResize, false); } function onMouseMove(event) { mouseX = (event.clientX - window.innerWidth / 2) / 100; mouseY = (event.clientY - window.innerHeight / 2) / 100; } function onMouseWheel(event) { camera.position.z += event.deltaY * 0.01; camera.position.z = Math.max(10, Math.min(50, camera.position.z)); } function onKeyDown(event) { if (event.code === 'Space') { isAnimating = !isAnimating; event.preventDefault(); } } function onWindowResize() { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize(window.innerWidth, window.innerHeight); } function animate() { requestAnimationFrame(animate); // 마우스 기반 회전 targetRotationY = mouseX * 0.5; targetRotationX = mouseY * 0.3; if (mechaGodzilla) { mechaGodzilla.rotation.y += (targetRotationY - mechaGodzilla.rotation.y) * 0.05; mechaGodzilla.rotation.x += (targetRotationX - mechaGodzilla.rotation.x) * 0.05; // 애니메이션 모드 if (isAnimating) { const time = Date.now() * 0.001; // 몸체 움직임 mechaGodzilla.position.y = Math.sin(time * 2) * 0.5; mechaGodzilla.rotation.z = Math.sin(time) * 0.1; // 눈 깜빡임 효과 const eyes = mechaGodzilla.children.filter(child => child.material && child.material.emissive ); eyes.forEach(eye => { eye.material.emissiveIntensity = 0.5 + Math.sin(time * 10) * 0.3; }); } } //
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
amazon.nova-pro-v1:0Compare side by side →
- gpt-4.1-2025-04-14Compare side by side →
mistral-medium-2505Compare side by side →
qwen-max-2025-01-25Compare side by side →
qwen3-30b-a3bCompare side by side →
llama-4-maverick-17b-128e-instructCompare side by side →
claude-3-7-sonnet-20250219-thinking-32kCompare side by side →
gemini-2.5-flash-preview-04-17Compare side by side →
- gpt-4.1-2025-04-14Compare side by side →
- gpt-4.1-2025-04-14Compare side by side →
gemini-2.0-flash-001Compare side by side →